Sparkfun Beefcake Relay board + MakeyMakey causes MakeyMakey freeze

This question involved a MakeyMakey and a relay board from Sparkfun. I'm posting here since the MakeyMakey is closely related to the Arduino Leonardo and my problem probably involves some general electronics advice rather than MakeyMakey-specific stuff. But here goes:

I'm using a MakeyMakey to trigger two Beefcake relay boards using the D14 and D16 digital outputs of the MakeyMakey. This is going just fine, except after one day, the MakeyMakey can be brought to freeze, ie. nog respond to touch-inputs anymore. After decoupling the relay boards the freezing issue is gone and I can do touch-inputs as long as as frequently as I like.. no freezing. What might be causing the freezing?
I'm quite unclear about what might cause this and I'd love some ideas. Here's some things I can say at this moment, but see if you can take with a grain of salt since I haven't done super extensive testing yet:

  • it seems like the longer I wait to turn on power to the MakeyMakey (and relay boards, they're on the same power strip) the longer it will take to freeze. Power off/on after 5 seconds will see a freeze within 10-15 seconds, power off/on after a minute may take more than a minute before freeze. Again, haven't done enough repeating to really confirm that time is truly a factor.
  • I'm powering the MakeyMakey through a mobile phone charger (5v, 1A). Don't see this being relevant but you never know.

I don't know enough about electronics to do propper hardware debugging. My gut tells me that it could be an add-a-capacitor-here thing, or maybe add a pull-down resistor somewhere or... I don't know.

Thanks for any input or questions you have.

I would suspect either a power brown-out caused by the load of the relay coils (or whatever circuit is completed when the relay operates) or inductive noise escaping the relay board on a power or signal line.

If it is a brownout issue it could be addressed by uprating the power supply for the controller, and/or by enabling brownout detection on the controller (if it supports it).

If it's noise, I suppose some sort of high frequency filtering would be required, perhaps by adding caps across the lines that the noise is appearing on. Noise could also be caused by the flyback impulse when the relay coil is deactivated but I would expect a good relay driver module to provide flyback diodes to absorb that. You might want to check they're provided on the board you're using.

If this is a hardware issue a schematic might be in order.

raschemmel:
If this is a hardware issue a schematic might be in order.

Makes sense, sorry about that. Here's a crappy sketch. There's two pairs of alligator clips. Each pair switches one of the relays. If you were actually referring to the schematic of the relay kit, here it is (link)

PeterH:
I would suspect either a power brown-out caused by the load of the relay coils (or whatever circuit is completed when the relay operates) or inductive noise escaping the relay board on a power or signal line.

Thanks for those options. Brown-out.. I don't know. There really isn't that much going on: the load per relay is a 25W 220V lightbulb directly connected to mains. The MakeyMakey has a 5v 1A mobile phone charger connected to its micro-usb port which should be more than enough, the relays only needs a few mA to trigger.
There is indeed a flyback diode on the relay module. If applying a cap, would you suggest on the load side or the MakeyMakey switching side?

Some more observations:

  • disconnected the relays and tried for a few minutes to piss off the MakeyMakey; didn't get it to freeze just by giving a crapload of short-interval triggers to its inputs (ie. touches). The LEDs on the MakeyMakey gave me feedback of the touches being made.
  • left the whole setup off for about an hour, then reconnected and have tried and tried to achieve another freeze but it hasn't happened anymore. Still I'm not at all reassured, as far as I'm concerned it's bound to happen again. Could built up heat be an issue? The freezing happened in the afternoon and this late afternoon / evening no more freezes.. this could just be coincidence.

If you disconnect the load side of the relays, so the relays aren't actually switching anything on and off, do you still get the problem?

Do you find it easier to provoke the problem if you switch both relays on together? That would be worst case from the point of view of load on the power supply. When you have a relay on, does the voltage on the Arduino 5V line dip?

PeterH:
If you disconnect the load side of the relays, so the relays aren't actually switching anything on and off, do you still get the problem?

Ah interesting, hadn't tried that yet. If the problem arises again today I'll do that. Thanks!

PeterH:
Do you find it easier to provoke the problem if you switch both relays on together? That would be worst case from the point of view of load on the power supply. When you have a relay on, does the voltage on the Arduino 5V line dip?

Two together has no apparent increased chance of freezing. About measuring voltage dip on the 5V line, I'd probably need a scope for that, which I don't have. I've tried a "poor-man's scope" using a separate Arduino in the past.. would that be sufficient?

Hi, it may be a good idea to keep the 5V lead from the charger to the "Makey" away from the mains power wiring that is going to the relays, and your wiring from the "Makey" to the relays as short as possible.
Any low voltage wiring will act as an aerial to switching spikes on the mains wiring.

After decoupling the relay boards the freezing issue is gone

Has it or hasn't it disappeared, you are talking now as if the problem is still there.
What did you do to decouple the relays?

Tom..... :slight_smile:

TomGeorge:
Hi, it may be a good idea to keep the 5V lead from the charger to the "Makey" away from the mains power wiring that is going to the relays, and your wiring from the "Makey" to the relays as short as possible.
Any low voltage wiring will act as an aerial to switching spikes on the mains wiring.

I thought along the same lines yesterday and connected the MakeyMakey to a different power strip but it still froze then.
The wiring to relays are about 50cm and 70cm. I can see that being a factor... would it help to shield those wires?

After decoupling the relay boards the freezing issue is gone

TomGeorge:
Has it or hasn't it disappeared, you are talking now as if the problem is still there.
What did you do to decouple the relays?

It most probably hasn't since I didn't really do anything that might fix it. But.. it hasn't happened again since yesterday. To decouple the relays I removed the header pins leading to the relays from the MakeyMakey (see my drawn schematic in earlier posts). Do you see any issue with that?

An update on my reported problem: having observed another freeze today we were able to do a better trial and error process leading us to believe that it was indeed a matter of too close proximity of the load power cable to the signal cable. These weren't really managed well in the space where all the wires and MakeyMakey resided and after some tie-wrapping and pinning along surfaces the different cables were separated as much as possible (still close sometimes but way less chaotically than before). The freezing has since stopped.

I hope my confidence won't be misplaced and that my problem has indeed been fixed through better cable management. If not, I'll update.

Thanks for all the tips folks! Seems like it was due to wires being too close. Out of curiosity, what would one call that kind of interference? EM fields? Is this kind of disturbance to the signal wires able to be filtered in some way, for instance by placing a capacitor across some lines?