Skip to content

Stop on removal with USB RFID Reader

steveleader edited this page Oct 4, 2021 · 6 revisions

This short description is a status summary of different issues and posts around the "stop on removal" feature. Based on the inital post from zxa which can be seen here: https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/62

Purpose / Issue:

Some of you want that the audio is played as long as the rfid chip is on the reader and stops or pause when its removed. The problem is that the reader transmits the card number via USB only one time after it read it and there's no way via USB to "see" for the RPi if the card is still near the reader.

Hardware Modification:

In many USB RFID Readers there is a green and red LED inside which shows the actual status of the reader. Green for: Seeing card as long as the card/chip stays in the reader range; Red for: no card. If you open your reader you will hopefully the something like this:

When the red led is on ("the idle state") there are approx. 2.7 V on point A and a few mV on point B. When the green LED is active (a card is near), there are 3.2 V on point B. This is almost exactly the voltage a GPIO of the RPi can bear. At next, you have to attach a 5k Ohm to point B (thanks to the manufacturer for the convenient soldering point in the board) and wire it with a free GPIO pin:

If you are using the PHATBeat from Pimoroni, BCM25 could be a convenient free pin for your setup. Please check this on your own.

Script Modification:

The configuration of this feature is actually not considered during the one-line installation. Please update gpio_control.ini on your own. Over SSH type the following command in the terminal:

sudo nano /home/RPi-Jukebox-RFID/settings/gpio_settings.ini

Append

[RFIDDevice]
enabled: True
type: Button
pin: 21
pull_up_down: pull_up
functionCall: functionCallPlayerStop

Update the Pin depending which GPIO you use.

New PCB Layout FP9291_2V0

On the PCB bareboard of the reader you can find the actual revision of the layout. While above example is for the most common pcb layout FP9291_1V5 there is a second layout called FP9291_2V0. In above example the 3.2V on Point B can be measured if the green LED is on and a card is present. With PCB layout FP9291_2V0 it is exactly opposite behaviour:
If no RFID is detected by the reader 3.2V is on, while there is only minimal output if no RFID tag is present.
To achieve the stop on removal behaviour the gpio_control.ini must be slightly different:

sudo nano /home/RPi-Jukebox-RFID/settings/gpio_settings.ini

Append

[RFIDDevice]
enabled: True
type: Button
pin: 21
edge: rising
pull_up_down: pull_up
functionCall: functionCallPlayerStop

Exit and save the file afterwards.

If you now test a RFID chip (must not be registered, just readable with your reader) you should only get a feedback when you remove your chip.

Of course you have to activate GPIO over the Web-App to use this feature. Pay attention that you donΒ΄t have any double assignment for BCM pins in the gpio_settings.ini.

For further explanation:

"LED voltage GPIO button" is pressed and stays in that state until the card is removed. Then the "released" event is triggered by the gpio-control. In gpio-cntrol the removal is defined to trigger "functionCallPlayerStop" from the playout controls. This means the audio is stopped by removal.

Thanks to: zxa , dertobes, see also https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1049

Home

πŸ”₯ Version 3

Version 3 Pages

Nothing yet

🎢 Version 2

Version 2 Pages

Installation

Specials

RFID Reader

Sound card configurations

Hardware Buttons

Displays (LED, LCD, Matrix, etc.)

Hacks

Bluetooth

AirPlay

MPD tricks

For Developers

Clone this wiki locally