Relay Controller - Crashing?

I'm using a duemilanove to control 4 relays. I've a typical relay board.. All 5v relays 2n3904 transistors

I basically used the design on this page except I'm using smaller resistors, like 200ohm I think. My relays require less current as well and are NC.

I've also got it connected to a ethernet shield on my home network. The problem is that it seems like after I switch 2 or more relays the whole thing crashes. By that I mean the arduino completely resets, I gotta wait for the ethernet shield to reinitialize before it'll accept communication, etc.

I'm powering the unit with a 12vdc 1a source. It doesn't just crash on my code either. I ran standard firmata and after the 2nd relay was triggered it became unstable.... Sometimes it never crashes, sometimes immediate, sometimes a few minutes. Always after I've triggered at least 2 relays though. It's indiscriminate of which relay I'm triggering.

Any ideas what might be causing this? I can post more details on circuit if needed and/or the schematic.

  1. Does the problem occur only when you have loads connected to the relays (in which case, what are the loads?), or does it also occur if you disconnect the loads from the relays?

  2. Are you using the exact same code as on the page you linked to? If not, please post your code.

  3. How much current do your 5V relays take?

  4. Is the 5V regulator on the Arduino getting too hot to touch when you have several relays activated?

Datasheet or details for the relay and power supply?

Using an 1N4004 as flyback diode isn't ideal, its a slow diode, something like a fast rectifier or schottky diode would be better.

Without an oscilloscope its hard to debug something like this, but I'd first suspect switching transients on the mains going straight through your 12V supply (is it cheap PSU?)

I'd also add decoupling across the relay drive circuit (between 5V and GND at the coil terminal and transistor emitter, perhaps 220uF).

Yea only occurs when there's load.

I've factored out the code already - using standard firmata to trigger the outputs has same effect.

I'm using G5LA-1-DC5 for my relays$file/G5LA_E_0911.pdf

  • 5vdc coil voltage
  • 5a coil rating
  • 69.4ohm Resistance
  • 72mA current

I'm using 2n3904 transistors, 200ohm resistors (I think), and more likely 1n4001 diodes.

I'm hoping to have time this weekend to debug it. I am using a cheap walwart power source too. I'll try swapping out the psu tonight. If it's still fail I'll probably salvage the relays and redo the whole circuit.

The 5V regulator on your Arduino is probably overheating and going into thermal shutdown. You're trying to drive 4 x 72mA relays (288mA), plus 4 x 20mA base current for the transistors (80mA), plus about 55mA for the Arduino itself. That's around 420mA, Multiply that by 7V drop across the regulator, and you are asking the regulator to dissipate about 3W, which is too much for it. You need to reduce the input voltage to about 7 or 8V, or use an external 5V regulator or 5V power supply that can supply that amount of current.

I also have a relay controlled by a arduino and Ethernet shield

But when I switch on the fan, the html page hangs

What can I do?