I'm working on this project for opening a lot of solenoids and to turn on/off lights. When I'm testing, everything seems fine, but in production, the Arduino resets or even behave strangely by opening solenoids or starting the buzzer randomly.

I've noticed that It resets when I switch on and off the lights (fluorescent light, 12 of them, so a lot of spikes) Here is the original schematic. enter image description here

I want to add the optocouplers 4n35, that are not currently in the scheme. Mosfet and Arduino project

Can anyone advise, if there is something wrong with the orignal schematics. Are there any improvements that can be made in order to make this work? Is the solution I've proposed going to solve the problems?

Note, that the 24V is actualy 12V but from a different power source just to separate the spikes from solenoids.

Thank you an best Regards, Mircea

  • \$\begingroup\$ I doubt that your problem will be solved by adding the optocouplers. Things like that are often issues with the power supply or reset circuitry. Have you checked whether or not that is stable while switching? \$\endgroup\$
    – J A
    Oct 20, 2015 at 1:20
  • \$\begingroup\$ I have 4 more controllers on the same power source. they just handle various keyboards. They do not seem to have problems with resets and instability.I've changed 3 types of power source. \$\endgroup\$ Oct 20, 2015 at 6:14
  • \$\begingroup\$ What happens if you switch the fluorescent lights manually? Either by manually activating the relay or bridging the relay? \$\endgroup\$
    – J A
    Oct 20, 2015 at 7:10
  • 1
    \$\begingroup\$ Your circuit is yet isolated by means of relays, additional optocouplers won't help. Add EMI filter on PSU or put a good PSU. Post schematics of PSU. Also I see the ground is the same, now how did you wire the grounds? Post a PCB . \$\endgroup\$ Oct 20, 2015 at 8:21
  • \$\begingroup\$ I use as PSU 3 ATX powers source for PC \$\endgroup\$ Oct 20, 2015 at 10:54

2 Answers 2


Maybe to try to add pullup resistor to the reset pin. Or to redesign your board so that power lines are more distant from arduino.

  • \$\begingroup\$ There are wires between main PCB and relays. So power is at relative distance. \$\endgroup\$ Oct 22, 2015 at 12:29
  • \$\begingroup\$ I have put a pullup resistor and the behavior did not change \$\endgroup\$ Oct 26, 2015 at 19:08

Nothing obviously wrong with the schematic, but I've made similar units in the past (RC fan controller), and you really need to pay attention to the mains wiring, especially the loop area of the wires to the relay.

In the end I was only able to stabilize the switching of mixed capacitive/inductive loads by:

  • Twisting the mains wiring to the relay
  • Adding ferrites to that wiring
  • Adding an RC snuffer across the relay contacts.

You might also find that a larger bulk capacitor on the 5V supply near the controller board might help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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