Sorry if I have miss understood but in re-reading Im not 100% sure what you had/did.
There are two main ways to connect a push button to an GPIO, pull up to Logic Level and pull down to ground on button press… or pull down to ground, then pull up to logic level on the button push.
e.g.
If using an external pull up/down, the internal should be diabled.
You can put a current limiting resistor before the pull up/down, to protect against a short when not configured as an input. The 220 ohm should be OK as the voltage divider with the pi 10K pull up should still give over 3V, that should be enough to trigger.
If the push button was as my previours image, that would mean (at the push button) the LED is using two pins (power to the LED to turn it on, then ground to complete the led path).
Then the other two pins are full indepentend for the push button.
as such ONE should go to the Pi for the GPIO input, and the other should go to Vcc or Ground (e.g. If using pull ups in the Pi, then at the pb it should go to ground).
While this may be what you had, the full diagram above seems to show different.
…could just be me based on what Im looking at and I could be missing something
1 Like
Hi Michael, Mark.
Another look at that schematic you posted earlier.
It looks like you have one side of the push buttons connected to ground which is wired common to all switches.
Then the other side of the button is wired to a GPIO via a 10kΩ resistor.. I think that resistor is in the wrong place. Refer Michael’s sketch on the left side for correct wiring.
Because the ground is common to all switches I assume the active state is LOW.
Sorry I missed this before but I was concentrating on the 24V side of things.
Cheers Bob
1 Like
Bob,
The solenoid PS I was using was a trany in a plug pack. Was a Toro branded unit from an old watering system I had on hand. It had a manufacturers P/N which I tracked down. Assuming this was the core issue I purchased a new 1A unit a few days ago. Made no difference other than the solenoids made less noise.
I’m not sure of the correct terminology (I’m not an electrical engineer) but the snubber fixed the issue so I’m confident to say that the core issue was the solenoid coils causing some kickback through the relay coil.
Michael, yes the way I had the PBs wired was crap in that the GPIO were floating. Realising this I changed this to your pull-up circuit a few days ago. Made no difference.
Anyway, all working now so all’s good.
1 Like
All good, just making sure we didn’t miss something simple by note being clear 
The code tick to clean up the “last bit” is common. Even when not left floating you can still get more then on on/off on a switch. You can deal with it externally via a few ways, or in code as you did.
Some things I learnt overtime, is
- bounce will lead to one or more false triggers but on the same button.
- floating will just end in random stuff on any floating pin; can even works fine on the work bench and not in the field.
- Noise on the power plane can create false triggers.
One of my projects was using a 9-36v (or what ever the real spec was at the time) DC to 5V DC converter. The idea was to take in the 11-14 Volts from a 12 volt battery, and potentially higher when charging and drop down to a clean’ish 5 Volts, were I could then use a 3.3V regs to get the power of the different bits.
But in production the string of 7 Segment digits would have a glitch…
When on the scope you could see some random spikes on the clock line (as well as others). these spikes aligned with spikes on the Power lines.
They where not big and very short. but at the right time would cause a false trigger, or false high on the data line level, if I was really unlucky. It was one of those things that would only show up once or twice in a 10min period when watching it… but on the scope you could really see it all the time. In this case some ferrite was enough to reduce the spikes.
This was one of those things that code alone could not fix and was right on a limit that made it hard to clearly find it. When on the work bench, using the workbench supply it was perfect… but in the real world.
One little bit of advice. While its all working, and you found somethings that fixed the issue, take some notes on those little things. If you need to revisit later you may forget why things are there 
Edit:
But most important, glad to see you got it working in a stable way !
2 Likes
Hi Mark
Yes, “Snubber” is correct.
ALL switches except very special ones WILL have some bounce. The exact bounce time will depend on switch design and on real data sheets is published.
This can be dealt with in software or a low pass filter on the GPIO input
I think you have done both, your software delays and the Snubber you devised going some way towards a filter of sorts. Anyway it all seems to work.
The strange thing as Michael says is that if it were a de bounce problem it would only affect the switch in use, not ALL GPIOs. So as you suggest probably some sort of interference finding its way into the GPIO inputs rom the solenoid operation.
Something and somehow. Two magic words which would probably need a decent oscilloscope to pin down. You have suppressed it in the important places and seems to work. All good so far.
Please do as Michael suggests and document everything. Will be invaluable in future if problems reoccur.
Cheers Bob