-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardware hack: Play only if RFID is near the reader #62
Comments
Hi @zxa |
Nice one. I've the same reader so I'll give it a try. |
@MiczFlor of course, that is definitely the better place to put. |
Hi, I am on my way to build a Kids Jukebox based on your How-to. I really like the idea of "Stop on RFID removal"! I will definitely try to implement this. Maybe it is possible to make a classification of the audio tracks in the playlist? |
the restart on the last position is implemented yet in the "pr80-mpd-as-audio-player" branch of this repo. As it will be standard in the near future and all new features go into that branch, it's a good idea to switch to it especially if you are in the process of building a new box. Install instructions here: #79 Regarding the classification thing: The restart on the last position feature is implemented in that way, that you can toggle the feature for every audio directory. It's maybe not the most sophisticated "mooing and meowing"-feature as it is coupled with resume play, but it's maybe enough for your use case. |
Hey @Franzformator , at the same time it must be possible to realize that without iron soldering. Let's do it |
@zxa |
Thanks for this neat instruction. I've tested this on my own and can confirm the function (also with 5kOhm resistance). Nice job. |
Hey, erstmal cooles Projekt! Danke dafür! Also, ich benutze den mfrc522-Reader. Dieser übermittelt ob eine RFID erkennt worden ist oder eben nicht. Dies kann also schon frühzeitig genutzt werden für das "nur Abspielen bei RFID-Kontakt". Interessant sind rfid_trigger_play.sh & rfid_trigger_play.sh Für diejenigen die es interssiert: Gruss Buffi |
Gibt es außer der Änderung in der gpio-buttons.py weitere? Hat jemand einen Rat? Besides the change in gpio-buttons.py, are there any other needed? Does anyone have any advice? |
Hi all, I think I just got the feature "Play only if RFID is near the reader" working almost properly.
This worked fine for me apart from a minor issue, which I am sure can be fixed rather easily as well. I will try to figure out a solution for this as well, which should not be too hard I hope. Cheers, |
You may solve your problem if you define your action in gpio-buttons.py like that:
So the player does not pause, but stop the playlist. I'm using it like that and doesn't configurated anything for second swipe. |
..weird: If i change when_released to when_pressed it works for me |
So it’s working for me as well - but not completely satisfying. The issue is still, that at the end of a Album or Playlist it would restart after removal. |
Adapted the RFID-Off function to the new gpio-buttons code structure. Works fine with the hardware hack for the USB-rfid reader described here: MiczFlor#62 The rfidoff event is triggered when the used gpio is pulled down.
* Update Detect rfidoff function in gpio-buttons.py Adapted the RFID-Off function to the new gpio-buttons code structure. Works fine with the hardware hack for the USB-rfid reader described here: #62 The rfidoff event is triggered when the used gpio is pulled down. * Added Missing "Channel" to rfidoff Action
* save used git commit hash to version file (see #828) * added first idea * Get rid of debconf: falling back to frontend: Readline messages while installing * Adapt for stretch dockerfile * Added functions for logging * Enable Logging during the installation * Added config file information into logging * Updated comments * fixed flake8 warnings * read current commit from Github * Consolidate install scripts (#871) * Remove duplicate chown/chmod * Align stretch install scripts * Remove stretch-install-spotify.sh script * Add info about pkg installation (#879) * Add info about pkg installation Fix for #818 * Update README.md * added missing sudo * Update Detect rfidoff function in gpio-buttons.py (#869) * Update Detect rfidoff function in gpio-buttons.py Adapted the RFID-Off function to the new gpio-buttons code structure. Works fine with the hardware hack for the USB-rfid reader described here: #62 The rfidoff event is triggered when the used gpio is pulled down. * Added Missing "Channel" to rfidoff Action * add empty header context to spotify requests, fixes title and cover download (#884) Co-authored-by: fhaertig <felix.haertig@ecube.de> * Add info how to post logging info (#882) * fixed flake8 warnings Co-authored-by: Kiri <kiri@sockiri01.bbn.verigy.net> Co-authored-by: Groovylein <kiriakos.antoniadis.kiri@gmail.com> Co-authored-by: Micz Flor <micz.flor@web.de> Co-authored-by: Fred G <fredg02@hotmail.com> Co-authored-by: MalteHST <40899451+MalteHST@users.noreply.github.com> Co-authored-by: lovethisshit <2253904+lovethisshit@users.noreply.github.com> Co-authored-by: fhaertig <felix.haertig@ecube.de>
Needed for Hardwarehack MiczFlor#62
This delay is need for bugfree working hardwarehack MiczFlor#62
Modify "playerpauseforce" command for Hardwarehack #62
Add a "second swipe" option for Hardwarehack #62
is there a solution yet? I would love to have this feature as well but cannot find a way to make it work |
For me, the feature does not work. In some other tickets people report to get the base functionality working, but for me the behaviour does not change. |
The function is working almost perfect to be honest - but we do need some more information of your set up to try to help. |
And have a look at #869 |
Hey @UndIch, thx for your quick help! I use the master branch and did not try the LED inbetween, but I think it is working because wiringpi :) (sidenote: I copied over the gpio-buttons.py from the gpio-buttons.sample git repo and modified only the three lines which were discribed on the wiki page.) Should I try the develop branch? |
I am using the develop branch - and with the #869 it is working for me. If the normal branch is yet on python as well (Is it?) - this “hack” here probably would not work any longer due to complete different structure of the “new” python version. I’m a little bit preoccupied right now - I try to look into my modification if the numbering is the right one. If you hadn’t installed wiring pi until now - have you tested if it is working now - could be because wiring pi was required? |
Hey @UndIch, I changed the branch to develop and then it worked! Thank you very much for the hint. Now I have to find the correct configuration for me. |
Hey @Buffi79 your link seems to not work anymore. I also have a RC522 reader and would like this feature. Could you share your solution again? |
Repo should be public... |
Not an "issue" at all, but i want to leave it anywhere as documentation if somebody else is interested (like in #43):
I wanted to have a feature that the player stops if you remove the RFID card from the reader. The problem, discussed here before, 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.
When i got my reader (it's a Neuftech 125 kHz (Amazon link) i found an interesting behaviour: if the reader "sees" the card, a light turns from red to green and stays green, as long as the card is near. So i opened it up and found following:
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. So i attached a 5k Ohm ( found by trial and error: i started with higher values and ended up with that, where it was working reliable) to point B (thanks to the manufacturer for the convenient soldering point in the board) and wired that with a GPIO pin:
Then i defined the stop key in the gpio-buttons.py as following:
stop = Button(6, pull_up=False)
(the Pin has to be pulled down, as i apply the voltage from the reader)stop.when_released = def_stop
So, when a card comes near the reader, the rfid_trigger_play.sh starts the audio. My "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.
I'm planing to enhance this function in that way, that the audio is paused on removal, but this is not as easy as the solution above. Maybe the code from #47 may help.
I don't know if this works with other readers as well, but if your device shows the same behaviour as i described above, chances are high.
The text was updated successfully, but these errors were encountered: