Relay, AC Fan, LCD Garbled

Equipment
Arduino Uno R3
DS18B20 1 wire temperature sensor
2 channel opti isolated relay
basic 8x2 char LCD
3 momentary buttons (menu, up, down)
9VDC 650mA wall wart
110v fan (it is running through a transformer to step down the voltage and make fan run slower, fan was existing)

I am making a digital aquastat for a wood boiler. This is an existing wood boiler, I am replacing the mechanical aquastat with this one, The aquastat will control a draft fan and overheat zone.

The LCD display is multi function, during normal run it tells current temp, and fan on or off state.

The buttons control a menu for setting fan on temp, fan off temp, overheat temp, F or C and saving options.

Also while not in the menu one button allows for viewing max temp, min temp, and overheat count, the other button allows you to reset the counters.

Relay 1 of controls the fan, Relay 2 controls the overheat (basically turns on a blow off zone)

This was bench tested extensively with no problems with EMI affects from turning on and off the relays.

As I am sure you have guessed ounce installed I started to have problems with EMI when relay 1 fan would turn off, this would cause the display to become garbled. Although the arduino would continue to work cycling the fan on and off.

To track where this interference is coming from, I removed the wall wart and powered the arduino from a 9v battery and ran dozens of cycles with no problem, when I reinstalled wall wart and problem immediately returned.

I understand this is from an inductive load but I am confused by how this is affecting the arduino and or display and how to correct this..

The wall wart is powered from an outlet separate from the power supplying the fan

I am using this wall wart Wall Adapter Power Supply - 9VDC, 650mA (Barrel Jack) - TOL-15314 - SparkFun Electronics

I do not have enough experience with snubbers to know what I am doing but, I did cut the ends off the wall wart and added a home made snubber (47uf & 180r) This did not work and I think it might have made it worse.

Thank you for any assistance you can provide.

Hi,
Quick question: What/Where is Ground?? The Arduino ground should go to building ground, preferably at some point on the boiler power input. All power stuff should be on the same breaker.

Are the relays running really isolated??

See: http://arduino-info.wikispaces.com/ArduinoPower#OI

and

http://arduino-info.wikispaces.com/RelayIsolation

Let us know!

Yes the relays are isolated. Also there were no problems switching the relays prior to apply in power so this is not a relay coil colapsing thing. I think it has more to do with the inductive load of the fan

The power supply is a 2 prong double insulated type no ground

I can run a ground wire from the arduino to ground and try it again if you think that would help

when I reinstalled wall wart and problem immediately returned.

Low quality and noisy supply? Perhaps you could try an electrolytic capacitor (100-1000uF) from Vin to ground.

Better yet, I recommend trying another supply, preferably 7.5VDC as this would allow Arduino's regulator to run cooler and provide more current.

Yes the relays are isolated.

Is the opto isolation feature being used? Here's how to make connections to get full opto isolation.

This was bench tested extensively with no problems with EMI affects from turning on and off the relays.

After installed, how close is the relays and AC wiring to the Arduino, DC components and wiring.

I agree that it is probably caused by a cheap wall wart, Can you recommend a good quality 7.5v one?

I learned something about the isolation relays... No the jumper was still on the board so I guess full isolation is not happening.

The arduino, relay pack and display are in a medium project box.

Curious why there is no problem when running the arduino off the battery pack, and only when running on the brick

Could be a combination of issues (poor isolation, poor power supply). The battery pack might provide more stable power ... it will provide an addition degree of isolation.

I would start with enabling opto isolation and adding an MOV across the contacts of any relays that switch an AC load. If the AC voltage is 120, make sure the MOVs are rated for at least 150VAC.

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Show your power connections please.

Can you post a picture of your project so we can see your layout.

Make sure you do not have low voltage wires running close to mains power wires.

Tom... :slight_smile:

Just so I fully understand what I am doing,... To fully use the opti isolated relays,... I know I have to have a separate power source for the relay, Does this mean an entirely different wall wart or can I use a single power supply and splice off 5v (lm7805) for the relay and 7.5v for the arduino?

After reading http://arduino-info.wikispaces.com/RelayIsolation

I have learned I have made many errors in the way that I approached this, so to fix it, I am going to do these things....

1st I am ordering and add MOVs
2nd I am adding a relay box to house the relays away from the arduino and display
3rd Attempt to make the relay pack truly opti isolated.
4th I am going to clean up my wire routing.

Thanks for the advise

TomGeorge

Here are two photos of existing and a quick diagram

So when the 9V wall device is plugged in, it gets messy, and when powered from 9V battery it is ok ?

The classic would be to make a "line filter" for the dc supplied and to locate that near to the barrel jack just before it enters your microcontroller. That is supposed to block emi going through the mains wires and also block emi picked up by the loop aerial of your dc supply wires.

Google "line filter", have a look at some vga computer monitor leads and how all wires in common are often wrapped around or threaded through a ferrite toroid. Also consider what you can make near to your microcontroller on a limited budget, such as a C-L-C filter.

Also to try would be use of a mains lead containing a ferrite (a cylindrical lump) as found near to any ATX power supply. Would fitting that to your noisey AC load fix the strange things in your work area?

A last extra thing to check:
What pullup resistors do you have on SCL and SDA ?

Hi,
Thanks for the pics, no worries, yes getting your mains power switching out of the box may help.
I notice you have your buttons switching to earth, in your sketch do you have their pull_up resistors turned ON.

Thanks.. Tom... :slight_smile:

Just so I fully understand what I am doing,... To fully use the opti isolated relays,... I know I have to have a separate power source for the relay, Does this mean an entirely different wall wart or can I use a single power supply and splice off 5v (lm7805) for the relay and 7.5v for the arduino?

Yes, an entirely different supply is needed for the relay board (that way you'll have 2 separate isolated grounds).

Note that there is no GND connection from the relay board to the Arduino and the relay board's jumper needs to be removed.

I have ordered the MOVs so right not I am waiting ....

ad2049q & TomGeorge

I am using the arduino to do pull up like this

pinMode(setUpPin, INPUT);
digitalWrite(setUpPin, HIGH);

dlloyd Regarding isolation of the relays... Does isolation only protect against the relay coil collapsing? or also against the switched load? The reason I ask is because a relay by nature should isolate the main contacts from coil contacts. Or is this more an EMI only thing?

Thanks for the responses,...

Yes the relay by design isolates the contacts from the relay coil. Usually this is enough when controlling low voltage / low power circuits. Howerver, the greater the voltage, current and power of a switched load, the greater the chances of problems due to EMI/RFI and relay contact arcing.

On the relay module, each relay coil is already protected with a diode. This works well for clamping the spike from the collapsing coil and protecting the relay driver circuit. A small side effect is longer turn-off time (greater contact bounce and arcing when relay contacts open). Also, some low level switching noise gets applied to the power rails. The power rails can also pick-up transmitted interference energy from the contact arcing.

Optical isolation will provide an extra layer of isolation. It effectively eliminates any interference through the power rails because of using the separate supply that remains totally isolated from the Arduino.

Its still a great idea to use an MOV to reduce the contact arcing and EMI/RFI. This also prolongs the life of the relay.

You may find that only one method of interference suppression will work, but you'll get extra benefit by doing both.

Sometimes even more needs to be done ... extending the distance from relay and AC circuitry to the DC circuit, EMI/RFI shielding, snubber circuit, or even using suitable SSRs instead.

Well here is an update,...

The MOVs came in and I decided to do some testing with just the MOVs installed and adding a relay.

I installed a relay with a 24vac coil (common for boiler stuff) to turn the fan on and off and I have the arduino 1st channel on the relay board turning the fans new relay on and off.

There was already a 24vac relay for the Overheat that is turned on and off by the 2nd channel on the relay board.

This get the 110vac switching much farther away (3 feet+) from the arduino, display, power supply etc..

But in testing the 24vac coil occasionally still caused interference so,... I installed 3 MOVs total, one across each 24vac relay coil and one across the contact for the fan.

I did extensive testing before switching it to live yesterday AM and ran it all day and last night, So far all is working good.

If anything changes on this I will post an update

Thank you everyone for the help.

Didn't realize you were switching 24VAC loads also ... this MOV rated at 30VAC would be a good fit for this (lower clamping voltage, less interference). However, don't get them mixed up.

originally I was switching 110v, After getting advice here I was doing testing and I had the original 24vac relay for the fan so I figured I would try switch the relay instead of the fan directly...

It is kind of a hodge podge of wiring with the MOVs held with wire nuts in open air... But now that it is working I will let it run this winter instead of changing my project box around and moving the 2 channel relay board of the box.

Again thanks for all the help

Update 2

It made it 4 or 5 days 100s upon 100s of cycles it finally glitched last night and Scrambled the display.

I am curious is there way to recover the display after it is scrambled like a reset?

I will be rewiring the thing, just hoping to wait till spring.

I feel your pain.

I struggled for a long time with LCD problems in an application simply reading a contact closure on an unused half of a DPDT relay in a mechanical room filled with motors and relays. I only had two wires running back to the Arduino--one to an interrupt pin with inputpullup and the other to a ground. I put an RC low pass filter on the the interrupt pin, and wrapped both wires around ferrite chokes.

First, I would suggest you try and I2C lcd to see if it is more robust to interference than the parallel set up.

If you are sure of the condition which scrambles the display and the rest of the program continues to work as designed, I would not be against using lcd.begin() and refreshed display code in the loop. Depending on how often you need reset the display, you would call lcd.begin() from a millis() timer at some interval.

We both know this solution is wrong, and you are likely to be haunted for the rest of your days. :slight_smile:
I'm sure you will continue to search for a hardware solution to the root cause.

1st I am ordering and add MOVs
2nd I am adding a relay box to house the relays away from the arduino and display
3rd Attempt to make the relay pack truly opti isolated.
4th I am going to clean up my wire routing.

Just wondering ... what improvements have you made? (especially if the relay is configured for optical isolation)

Further improvements:

(see Reply#1) Test voltage from Arduino GND to earth (mains ground) and also relay board GND to earth. These are just safety checks to make sure the DC supplies are isolated (they should be, the measured voltage should be very low, near 0). If so, then connect the relay supply GND to mains ground and see if that resolves problem.

Is your 9VDC 650mA wall wart regulated? If not, it could be providing 12V-17V when lightly loaded. It also might not be filtered wery well. I reccomend using a 9V or 7.5V (better) regulated DC supply. This will allow Arduino's 5V regulator to run cooler and provide more current, which is beneficial when using a LCD.

Using the 30VAC rated MOVs for the 24VAC load instead of the 150VAC MOVs will provide a little bit of additional noise suppression.