Posts: 24
Threads: 4
Joined: Apr 2020
Reputation:
1
04-17-2020, 04:42 PM
(This post was last modified: 04-18-2020, 03:16 PM by GreyLinux.)
Hi all ,
I have a random issue with my setup where after a while of listening to radio, randomly the playback pauses, even stranger after listening to nothing for a while it randomly will start playing again .
my setup is Raspberry pi 4 , Hifiberry amp2, gpio handler enabled for momentary button control ( which I believe is related ot the problem) and mono output provided by sox resampling option , also I have volume control set to software .
I believe it is related either to the gpio handler configuration or the buttons themselves .
I have configured mpc toggle on gpio6 , vol up on gpio 5 and vol down on gpio26 . The other tails of the buttons are to ground, Deounce is 750ms , not sure if this I helpful but just in case its my handy work causing the issue!
When pressed all buttons work as expected except that when no audio is playing if I press vol up or vol down a few times , audio begins playing (not sure if this is expected behaviour ?)
no physical connection is shorting between the pins as I soldered female gpio connectors to the ends of each button tail and they fit nice and snug .
nothing obvious appears in any of the logs but I'm not entirely sure what I'm looking for .
any ideas or advice would be great .
Posts: 13,474
Threads: 305
Joined: Mar 2018
Reputation:
545
You could try running the button handler from the cmd line after adding some debug print.
1. Turn off the handler in System config.
2. sudo nano /var/www/command/gpio-buttons.py
Uncomment the existing #print statements and optionally add your own
3. Run it from cmd line
Code: sudo /var/www/command/gpio-buttons.py
Posts: 24
Threads: 4
Joined: Apr 2020
Reputation:
1
04-17-2020, 06:15 PM
(This post was last modified: 04-17-2020, 06:22 PM by GreyLinux.)
(04-17-2020, 05:33 PM)Tim Curtis Wrote: You could try running the button handler from the cmd line after adding some debug print.
1. Turn off the handler in System config.
2. sudo nano /var/www/command/gpio-buttons.py
Uncomment the existing #print statements and optionally add your own
3. Run it from cmd line
Code: sudo /var/www/command/gpio-buttons.py
what sort of debug print statement would you suggest could help ?
when I run it as is and press the volume buttons a few times I get
Code: 2020-04-17 19:09:08 bounce_time=750
2020-04-17 19:09:08 row id=1, enabled=1, command=mpc toggle
2020-04-17 19:09:08 sw_1: pin=6, enabled=1, bounce_time=750, cmd=mpc toggle
2020-04-17 19:09:08 row id=2, enabled=1, command=/var/www/vol.sh up 1
2020-04-17 19:09:08 sw_2: pin=5, enabled=1, bounce_time=750, cmd=/var/www/vol.sh up 1
2020-04-17 19:09:08 row id=3, enabled=1, command=/var/www/vol.sh dn 1
2020-04-17 19:09:08 sw_3: pin=26, enabled=1, bounce_time=750, cmd=/var/www/vol.sh dn 1
2020-04-17 19:09:08 row id=4, enabled=0, command=
2020-04-17 19:09:08 row id=5, enabled=0, command=
2020-04-17 19:09:08 row id=6, enabled=0, command=
2020-04-17 19:09:08 row id=7, enabled=0, command=
2020-04-17 19:09:08 row id=8, enabled=0, command=
2020-04-17 19:09:08 row id=99, enabled=, command=
LoungeFM: LISA BAJRAK - Обіймати Тебе
[playing] #1/1 0:50/0:00 (0%)
volume: 25% repeat: off random: off single: off consume: off
LoungeFM: LISA BAJRAK - Обіймати Тебе
[paused] #1/1 1:10/0:00 (0%)
volume: 18% repeat: off random: off single: off consume: off
LoungeFM: LISA BAJRAK - Обіймати Тебе
[playing] #1/1 1:11/0:00 (0%)
volume: 14% repeat: off random: off single: off consume: off
LoungeFM: LISA BAJRAK - Обіймати Тебе
[paused] #1/1 1:14/0:00 (0%)
volume: 15% repeat: off random: off single: off consume: off
I havent pressed play at al this is just with vol buttons
Posts: 13,474
Threads: 305
Joined: Mar 2018
Reputation:
545
04-17-2020, 06:26 PM
(This post was last modified: 04-17-2020, 06:27 PM by Tim Curtis.)
Prolly add a print statement in the callback function for the particular buttons you have defined. This would show when the event occurs. It should only occur when button is pressed.
Something like below.
Code: def sw_1_event(channel):
subprocess.call(sw_1_cmd)
print('sw_1_event')
Posts: 24
Threads: 4
Joined: Apr 2020
Reputation:
1
Code: Apr 17 18:58:53 moode-lounge kernel: [16174.011128] pcm512x 1-004d: No SCLK, using BCLK: -2
Apr 17 19:01:41 moode-lounge nmbd[563]: [2020/04/17 19:01:41.425225, 0] ../source3/nmbd/nmbd_namequery.c:109(query_name_response)
Apr 17 19:01:41 moode-lounge nmbd[563]: query_name_response: Multiple (2) responses received for a query on subnet 192.168.1.231 for name WORKGROUP<1d>.
Apr 17 19:01:41 moode-lounge nmbd[563]: This response was from IP 192.168.1.1, reporting an IP address of 192.168.1.1.
these are the only repeated logs in syslog but I believe they are unrelated .
Posts: 24
Threads: 4
Joined: Apr 2020
Reputation:
1
(04-17-2020, 06:26 PM)Tim Curtis Wrote: Prolly add a print statement in the callback function for the particular buttons you have defined. This would show when the event occurs. It should only occur when button is pressed.
Something like below.
Code: def sw_1_event(channel):
subprocess.call(sw_1_cmd)
print('sw_1_event')
after adding this
Code: sw_2_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_2_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_3_event
LoungeFM: LISA BAJRAK - Обіймати Тебе
[playing] #1/1 1:14/0:00 (0%)
volume: 14% repeat: off random: off single: off consume: off
sw_1_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_2_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_2_event
LoungeFM: LISA BAJRAK - Обіймати Тебе
[paused] #1/1 1:34/0:00 (0%)
volume: 16% repeat: off random: off single: off consume: off
sw_1_event
sw_2_event
the play button was not pressed once but as you can see it randomly started playback .
Posts: 13,474
Threads: 305
Joined: Mar 2018
Reputation:
545
Something, most likely hardware, is changing the PUD state of the gpio which causes the event to be triggered.
https://sourceforge.net/p/raspberry-gpio...ki/Inputs/
You could try disconnecting one of the buttons to confirm that no event occurs.
Posts: 24
Threads: 4
Joined: Apr 2020
Reputation:
1
04-17-2020, 06:58 PM
(This post was last modified: 04-18-2020, 05:45 AM by GreyLinux.)
(04-17-2020, 06:44 PM)Tim Curtis Wrote: Something, most likely hardware, is changing the PUD state of the gpio which causes the event to be triggered.
https://sourceforge.net/p/raspberry-gpio...ki/Inputs/
You could try disconnecting one of the buttons to confirm that no event occurs.
interesting !! , I did begin to think that it might be hardware related just before you posted .
Its possible that my switch is faulty so I'll try disconnecting the play button tomorrow and let you know my findings
Posts: 24
Threads: 4
Joined: Apr 2020
Reputation:
1
(04-17-2020, 06:44 PM)Tim Curtis Wrote: Something, most likely hardware, is changing the PUD state of the gpio which causes the event to be triggered.
https://sourceforge.net/p/raspberry-gpio...ki/Inputs/
You could try disconnecting one of the buttons to confirm that no event occurs.
I have carried out some testing this morning and discovered that it is entirely hardware related . I removed the play button from the gpio and tried the same test as above , I found that pressing one of the volume button occasionally caused the other to detect an event . this ruled out the buttons.
I did notice that when I touched the wires with no button press this caused an event to be detected suggesting either a poor connection betwen the wires and the gpio's is causing events or some noise is being caused because of proximaty to the speaker magnet or the general length of the wire , or possibly all 3 could be causing it . I have read that putting a o.1UF capacitor between terminals on the button can filter out the noise .
Thanks Tim for you help and advice in leading me to this conclusion .
I'll add to this thread when I find a solution so as to help anyone else with a similar problem
Posts: 24
Threads: 4
Joined: Apr 2020
Reputation:
1
To mark this thread as solved ,
I discovered that it was the dupont connectors on the end of the button tails did not having a good connection with the pins on the HifiBerry amp2 as they are smaller than standard 2.54mm pins this caused the playback to randomly stop and play and cause other buttons to glitch and trigger other button events .
I'm aware that soldering to the amp2 pins voids the warranty but I decided to solder the connections and create a permanent connection .
|