-
Notifications
You must be signed in to change notification settings - Fork 0
Stop on removal with USB RFID Reader
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
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.
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.
The configuration of this feature is actually not considered during the one-line installation. So you have to modify gpio-buttons.py on your own. Over SSH type the following command in the terminal:
sudo nano \home\RPi-Jukebox-RFID\gpio-buttons.py
In the actual code the feature is already prepared for personal configuration, but commented out. To activate the feature look for the following 3 lines, delete the # and adapt the btn_rfidoff for your setup:
#btn_rfidoff =
#GPIO.setup(btn_rfidoff , GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
-> The pin has to be pulled down, as the voltage is applied from the reader.
#GPIO.add_event_detect(btn_rfidoff, GPIO.FALLING, callback=rfidoff_action, bouncetime=bouncetime)
Exit and save the file afterwards. To test the function over the terminal start the script manually:
sudo \home\RPi-Jukebox-RFID\gpio-buttons.py
There should be no error just empty line. You will get a feedback if you press any buttons. 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 with the rotary-encoder.py or just deactivate it if you donΒ΄t use it.
"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-buttons.py. In gpio-buttons.py the rfidoff_action is defined to trigger "playerpauseforce" from the playout controls. This means the audio is paused by removal.
Thanks to: zxa , dertobes
If you like Phoniebox, consider: buy me a coffee or PayPal
- Code: https://github.com/MiczFlor/RPi-Jukebox-RFID
- Phoniebox home page: English | Deutsch
Phoniebox is a contactless jukebox for the Raspberry Pi, playing audio files, playlists, podcasts, web streams and spotify triggered by RFID cards. All plug and play via USB, no soldering iron needed. Update: if you must, it now also features a howto for adding GPIO buttons controls.
Visit Phoniebox.de
π₯ Version 3
- β Releases
- π΅ Install Jukebox Version 3
- π Report a bug
- π Propose a feature
- βοΈ Feature Status
- π Documentation
- π©βπ» Development
- βοΈ Contributing
- π¦ Code
πΆ Version 2
- β Releases
- π΅ Install Jukebox Version 2
- π Report a bug
- βοΈ Features
- π Documentation
- βοΈ Contributing
- π¦ Code
Version 2 Pages
-
Setup / Upgrades
- Synchronising Phonieboxes in a local network
- Smart Home remote control with MQTT
- Hardware Pinout Overview
- Systemwide Equalizer
- Phoniebox with read-only Filesystem
- HiFiBerry Soundcard Details
- WM8960 Hi-Fi HAT
- PAM8403 Amplifier Power Off
- TPA3118 Amplifier Power Off and EMI improvement
- External Non USB Audio DAC ES9023, PCM5102, etc.
- On-board LEDs with fibre optics
- Setting GPIOs at boot time
- Stop on removal with USB RFID Reader
- Firmware update improves audio out
- Architecture