0

My setup is like so:

A Raspberry Pi B+ acting as an airplay audio receiver using shairport. The Pi connects to a 100V line Amp which feeds the audio out to several installed ceiling speakers around the home setup as four zones. Before the sound goes to the speakers the common line goes to a relay which is attached to the Pi. In each zone (Kitchen, Bedroom, Bathroom, Hallway) there is a momentary switch wired in to the wall, one side of the switch is wired to the GND pin on the Pi, the other side runs to a GPIO pin set as an input pull up resistor. The idea is to turn on a speaker zone you press the momentary switch in that room which connects the two sides and triggers the pull up resistor which as part of a python script sets another GPIO setup as an output to HIGH which connects to a relay which closes the relay and allows the audio circuit to complete at which point the music starts playing in that particular zone.

This system worked perfectly in extensive testing so I installed it in my home. Now I'm finding a weird thing is happening; the speaker zones are turning themselves on an d occasionally off also! As far as my testing has shown the zones only turn themselves on when music is being played through the Pi as though in response to the music in some way. If I disconnect the momentary switch this issue does not occur at all. If I use the same kind of switch with short cables, a few inches say, like breadboard jumpers this issue does not occur. When I have the installed momentary switches installed the issue occurs, the length of cable to the switches is several metres as it runs through my ceiling.

Any thoughts on why this might be occurring would be appreciated.

If it helps I can supply the Python code I'm using for this system though I don't think it will help as the issue kinda seems to be physical.

1

The internal pull-up (and down) resistors are quite weak, of the order of 50 k ohm.

It sounds like the long wires are acting as aerials and creating spikes large enough to overcome the internal pull-ups.

I guess you have two choices.

  1. debounce the momentary switches.
  2. use stronger external pull-up resistors to 3V3, say 4k7.

Or do both of the above.

  • I already had debounce in the software which works great to prevent accidental triggers from someone holding the button a touch long or bounce presses, went half a second for safety. I wired a 4k7 resistor to 3.3V and a smaller resistor (330R because it's what I had lying around) to the switch with the other side of the switch being connected to GND. With this physical addition to the switch mechanism I have overcome the problem. I think I'll replace the 330R resistors with something like 1K when I get a chance to visit my local electronics store. Thanks for the idea. – Meph88 Sep 7 '15 at 13:32
  • Further to this, I was finding VERY occasional false activations so have moved to a software solution where the physical momentary switch must be held for a full second to activate. It is very unlikely that "noise" will activate it if it requires a full second press. – Meph88 Sep 30 '15 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.