LCD Character scrambled randomly when using solenoid

Thread Starter

nitindo

Joined Nov 3, 2021
2
Hi,

I am trying to control a water outlet and show simple text on an LCD. However, I see that the LCD text gets scrambled whenever the solenoid is turned on and off. I read a few posts on AC solenoids requiring snubber circuit, just wanted to know whether this will solve the LCD problem because I thought it is to save the contacts of relay against high voltage caused due to inductance. Below is the schema, relay is actually a HL-52 V1.0 module. I have tried to put in values for things that I know about the module, but alas I dont know values for most of the things in that module. AC supply for the solenoid is 230V at 50hz. Solenoid's power consumption is 8W. Thanks in advance.
Untitled.png
 
Last edited:

ElectricSpidey

Joined Dec 2, 2017
2,149
Yes you should try putting a snubber across the solenoid, but there could also be other reasons for the errors.

Not related to that, I'm just curious why you are showing a PNP transistor to drive the relay, shouldn't that be an NPN?

Anyway, there are many reasons why you could be getting those errors, but the snubber is as good a place to start as any.
 
Last edited:

mtedaldi

Joined May 10, 2021
3
Hi,

I am trying to control a water outlet and show simple text on an LCD. However, I see that the LCD text gets scrambled whenever the solenoid is turned on and off. I read a few posts on AC solenoids requiring snubber circuit, just wanted to know whether this will solve the LCD problem because I thought it is to save the contacts of relay against high voltage caused due to inductance. Below is the schema, relay is actually a HL-52 V1.0 module. I have tried to put in values for things that I know about the module, but alas I dont know values for most of the things in that module. AC supply for the solenoid is 230V at 50hz. Solenoid's power consumption is 8W. Thanks in advance.
View attachment 251913
There could be many reasons for the issue.
  1. Putting in some kind ob snubber could help
  2. the output transistor transistor should be an npn and installed the right way around
  3. als already mentioned don't connect AC neutral and GND like that
  4. Check your layout
    1. There should be one decoupling cap (ceramic 100n cap is ok in most cases) really close to every IC. Plan for seperate caps for AVCC and VCC
    2. Make sure that you are either using power planes or take care of the routing of your power (gnd and +5V) traces. They should be as close together as possible to reduce EMI
    3. Make sure that the trace that goes to the relais is as far away as possible from other data line (close to +5V and GND if possible). Cross the other lines in a 90° angle and try to avoid running them in parallel over more distance than absolutely necesary
    4. Put a small cap (1n should be enough) on your reset pin (parallel to the 10k resistor)

Additionally:
  1. Check the datasheet of the WC1602A.
    1. The Backlight should not be driven with more than 3.1V
    2. V0 should be connected to a potentiometer but should never be more than 4.7V lower than VDD (that's for setting the contrast)
 

Thread Starter

nitindo

Joined Nov 3, 2021
2
Thanks my problem got solved by installing the LCD backlight correctly. However, I haven't yet installed the snubber circuit which I think is necessary. I contacted the solenoid vendor to provide inductance values to calculate the values for capacitor and resistor but they haven't replied. Is there a default/safe value of capacitor and resistor combination that I can use for any solenoid which operates at 230V AC 50Hz and consumes 8W?
 

Ian0

Joined Aug 7, 2020
5,480
Is it the LCD that gets scrambled, or the interface? Try avoiding writing to the LCD for at least 50ms after changing the state of the transistor.
In addition to what @mtedaldi says:
If the LCD gets scrambled even when you are not writing to it, place a snubber across the solenoid with R equal to the DC resistance of the solenoid and C = L/(R^2). The power rating of the resistor should be >(2πfVC)^2.R
Try switching the solenoid with a triac*, that will remove the main source of interference which will be contact bounce.

*Use MOC3062 or FODM3062 opto triac driving Z0107 triac, with 100Ω 1W resistor in the gate of the triac. You will generally need a 1W resistor to get enough voltage rating, even though it doesn't dissipate 1W.
 
Top