I am controlling the compressor of a compact refrigerator using an Arduino Mega and an opto-isolated relay block. The Arduino is connected to the PC using a serial over USB (Atmel version). Since the beginning it has been a struggle to reduce the serial line errors. Here is what I have done and it helped but I still have problems:

  1. Replaced the stock USB cable with higher quality - helped the USB not reconnecting;
  2. Powered the Arduino board with an external switch supply - helped the USB not reconnecting, no more reconnections;

I still have problems with data incoming to the Arduino and it happens only when the Arduino switches the compressor on/off. I have a number of questions:

  1. Do you think this is an EMF problem or power supply problem or ground problem or some interface (for example Arduino to relay board)? Notice that the relay board is powered separately from a lab power-supply.
  2. What do you think is the best possible step to improve the situation. I have been thinking of the following:
    1. Replacing the mechanical opto-isolated relay board with solid-state relays;
    2. Adding ferrites to the power lines? The USB cable already has ferrites on both sides;
    3. Enclosing the relay board in a metal casing;
    4. Enclosing the Arduino board in a metal casing;
    5. Adding a low-pass filter to the compressor?
  • \$\begingroup\$ You need to find yourself an oscilloscope to figure out what the issue is. \$\endgroup\$ Mar 6, 2015 at 19:54
  • \$\begingroup\$ Thanks, finding an oscilloscope is easy, do you think I should try to measure first the serial line, then the wire between the Arduino and the relay board? Also what frequencies am I looking for? \$\endgroup\$
    – major4x
    Mar 6, 2015 at 20:00
  • \$\begingroup\$ I would probe the serial lines, the MCU supply, and the compressor supply at the same time. Look for brownouts and surges. Or post the graphs here and we can tell you what you're seeing. \$\endgroup\$ Mar 6, 2015 at 20:08
  • 1
    \$\begingroup\$ In the meantime a layout or schematic could help. Location of the components relative to each other is important. \$\endgroup\$
    – Sean Boddy
    Mar 6, 2015 at 20:16

1 Answer 1


Try any ideas that you mention. If you try one and it doesn't appear to work leave the idea implemented and try the next idea. Eventually you will arrive at a solution but it won't be ideal. To make it more ideal try removing one idea randomly to see if you still have the same fix. Repeat until you have removed as many potential fixes as possible but still have a good solution.

That's the approach I generally take.


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.