NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » Garbled LCD screen when using a SSR

January 30, 2012
by kvjohnso
kvjohnso's Avatar

I was wondering if anyone had any thoughts about this....

I have a simple heat sensor driving a relay that controls a low watt fish tank heater. When I don't have any voltage coming through the AC relay (like when the heater isn't connected) the LCD connected to my NerdKit project works nicely. However, when I plug the heater in, the LCD will eventually start filling up with various characters. The project still works nicely wether the LCD output is functioning or not. I have a nice sized diode correctly around the 12V relay contacts with the diode cathode band wired towards the + rail. It seems like this is a reverse EMF event. Maybe I need a bigger diode? I'm using an IN4004 diode.

Thanks for any comments :).


January 31, 2012
by 6ofhalfdozen
6ofhalfdozen's Avatar

Hi Ken,

My first thought is that your problem is noise from the AC side, your wires are acting like antennas and picking up an induced signal. To my novice ears, this doesn't sound like a reverse EMF issue. That would only show up when the SSR goes from being ON to switching OFF (no matter whether AC is going on the other side). Since you describe it is only misbehaving when the AC is plugged in, I am thinking it is an induced noise issue. If that is the problem, the only suggestions I would have is to try to shorten any LCD wires you have (less antenna) and try to move any AC lines (and possibly the SSR) further away from the LCD wires and NK itself.

just a couple of quick thoughts until the pros can chime in, hopefully it helps..

January 31, 2012
by mongo
mongo's Avatar

There are different kinds of inputs for SSR's. Some are optocoupled, which work pretty well. There are some though that are direct coupled, and those can send signal back through the trigger lines. What SSR are you using?

February 01, 2012
by kvjohnso
kvjohnso's Avatar

Thanks for the responses. I just educated myself on various relay types and my relay is NOT a SSR. It's just a new old-school electromechanical relay. After reading about the SSRs they do seem cooler and I'm going to get myself a few to tinker with.

I'm still having some issues with the garbled text. I cut the LCD wires down to a few inches and that seemed to help a lot. Thanks. I now only get the garbling when I have the backlight (pins 15 and 16) connected. I have the backlight grounded with a 1K resister. After a few relay cycles one 'extra' character will appear on the screen and then after a half hour the whole 4x20 screen will be covered with crazy characters. My relays (three of them) are now on a separate board and the nerd kit with LCD is about a foot away from it. I only have the ground and the three MOSFET gate wires between the two boards.

Any ideas will be appreciated and tested :).

Thanks again


February 02, 2012
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi Ken, a few thoughts:

First: It's not bad practice to re-draw the entire 20x4 characters from time to time (or on every update, etc). If "noise" happens, it's better that the system tolerate it a bit.

Second: There's an interesting page about Diode Turn-on/off Time and Relay Snubbing, though in this case I'm not sure that it's super useful here. You can consider a different diode like the 1N5817 which is significantly faster at switching than the 1N400x series, but I honestly doubt that'd have much effect here.

Third: When your relay coil switches from off to on, the voltage at the drain terminal of the MOSFET jumps from +12.0 down to near 0.0 volts (depending on the Rdson of the MOSFET). And when your relay coil switches from on to off, the voltage at the drain terminal jumps from near 0.0 volts to +12.7 (the power supply plus the diode forward voltage), until the inductive current diminishes and it settles back to +12.0. If there's a capacitance between the drain and gate terminals of the MOSFET (which there always is!), that big change in voltage at the drain terminal becomes a big change in voltage at the gate terminal -- and requires current in or out to keep the gate terminal voltage constant. That current is coming from the microcontroller's I/O pin.

So my first suggestion to try is to put a 1K resistor from the MOSFET gate to ground -- physically located near the MOSFETs. That will help the current have somewhere to go other than into the microcontroller pin.

A separate idea, if the first one doesn't work, would be to try putting a 10K resistor in series between the microcontroller pin and the MOSFET gate. This would just "slow things down", and since you're not trying to switch anything particularly fast, it'd likely help.

A photo and/or schematic would probably also be helpful.

Try the 1K resistor from each MOSFET gate to ground and let us know if that makes the random characters go away.

Fourth: this entire problem could be coming via the 7805 voltage regulator and your power supply (as opposed to the gate wires). When the relay coil switches, there's suddenly a lot more load on the power supply, and the voltage may dip momentarily to the point where the 7805 can't maintain +5V output. Adding some capacitors across the +5/GND power rails near the microcontroller, and possibly at the input to the 7805 as well, may help.


Post a Reply

Please log in to post a reply.

Did you know that signed numbers need to be sign-extended when chaging variable sizes? Learn more...