Errattic Uno

I built up a datalogger as a first Arduino project that records fridge every 10 min and checks compressor state ea min. It uses an RTC, waterproof ds1820, lcd, and records on an sd. The compressor has an outlet wired in parallel with a 5v charger which powers an LED and is attached to a port to read on/off.

I'm getting the following random errors: sometimes the Ard reboots, sometimes it locks up, often the LCD starts showing jibberish, sometimes the SD stops recording.

I was giving shocks when I touched it so I though the AC was bleeding through the compressor charger. I went to a relay to isolate the circuits. The shocks seem to have stopped but the random errors continue.

Any ideas?

Probably the electric motor in the compressor is causing noise/spikes on the power lines and/or RF.

Draw a picture of how you have it wired up as getting shocks does not sound right/safe.

The part that connected to the compressor now goes through a relay and that seems to have resolved the shocks. When it shocked I figured some AC was leaking into the circuit and expected the random errors to end when the shocks ended.

Could the interference / spikes make it through the power supply that feeds the Arduino?

I don't believe the problem is in the code as it runs fine for awhile - some times 2 hours sometimes 6 or 8. There are no extra subroutines or interrupts. All code is run every 10 minutes so a code problem would happen within 10 min or every 10 min.

Here's the before after wiring. The only thing worse than my handwriting is my drawing.

bwaii:
Could the interference / spikes make it through the power supply that feeds the Arduino?

Yes, and you might also be getting RF interference. Especially if you using unshielded wires in close proximity to the compressor motor and/or you Arduino is also to close.

That's what I thot, which is why I put in a relay. that totally isolates that side. Unless the interference is coming through the 9v supply for the board.

Now the input pin stopped reading. Great!

A couple of thoughts, however without a schematic and some indication of the physical wiring its hard to be specific.

  1. The AC leakage should not happen! Perhaps you have a bad, or poorly made adapter.

  2. All circuits in the "real" world need protection from picking up RF, ESD and power supply dips etc. There does not need to be a ohmic path although there could be one as well.

John