Arduino Forum

Forum 2005-2010 (read only) => Hardware => Interfacing => Topic started by: NickA on Mar 31, 2010, 12:25 pm

Title: LCD Shield display corrupted when relays used
Post by: NickA on Mar 31, 2010, 12:25 pm
I am using a Mega with an LCD shield to drive 2 relays to turn a variable frequency drive on and off.   If I run the code just driving the relays, the relays work fine, and the LCD displays correctly.   If I connect the CFD to the relays, it starts and stops correctly (relays working fine), but the LCD panel get corrupted in 1 of several ways; e.g. the first line is corrupted with all of the same non alphabetic character, or wht should be displayed on line 2 is overwritten on line 1.   I have tested that there is no direct electrical connection between the input of the relay and the relay switch, so the VFD appears to be electically isolated from the Arduino.

Does anyone have any ideas?
Title: Re: LCD Shield display corrupted when relays used
Post by: pluggy on Mar 31, 2010, 12:50 pm
Decoupling (or extra decoupling) on the Arduino and snubber diodes on the relays wouldn't go amiss. Relays are extremely noisy in microcontroller environment.  I'd suggest you stick a small electrolytic capacitor of say 10 - 47uF and a ceramic capacitor of 100nF (or two, or three ;) ) across the 5V supply(s)  as close to the ATmega Chip as you can for the decoupling and a 1n4001 or similar diode "back to front" (ie Anode to Gnd) across each relay coil contacts.  
Title: Re: LCD Shield display corrupted when relays used
Post by: NickA on Apr 01, 2010, 01:16 pm
Excellent; the snubber diodes worked like a charm; thanks very much.