Problem with LCD and Motor

I am also having similar issue. My LCD connected to the UNO displays strange characters after turning on/off the 5V relay for a 10-15 times. The relay controls a 220v AC solenoid and another relay controls a Contactor (220V AC). Both relay has diode contected (IN4007).
I tryed putting cap 100uF around display but LCD still displays strange characters.
Does anyone have any suggestion for me. Thanks

You tried a 1n4004 diode yet?

Whenever you see the term 'motor' or 'relay' in the same sentence as 'LCD problem' the answer is almost always the same.

Don

Do you have dedicated +5V and ground wires from the Arduino to the LCD? Shared grounds can cause a lot of problems.

dc42:
From the photo, it looks as if those solenoids are held together by 4 screws with hex or Torx heads. It might be worth disassembling one, to see whether there is room to fit a diode inside (although that will probably invalidate the warranty). If space is limited, then depending on the current taken by the solenoid, you may be able to use a smaller diode. You can also get 1N400x diodes in SMD packages.

@DC42, I opened up the solenoid, and inside is one complete unit, so there is no way to place the diode inside. What I did was to place the diode as shown in my previous photo (where the scissors symbol is pointing at) to see if I can completely suppress the EMF. To my surprise, this new setup actually made it worse. Now I see garbage on the LCD all the time. Attached is a drawing of my old and new setup. The diode on the left-hand side is the old setup where I place the diode about half way between the solenoid and the 12V power supply. This setup works sometimes. The diode on the right-hand side is the new setup, which always fails, i.e. garbage on LCD. This is completely opposite to what I expect to happen. Any suggestion? Thanks.

Protel Schematic.pdf (9.41 KB)

Yes, it does seem strange. I suggest you test the diode that you fitted in the new position. Does the garbage appear when the solenoid turns on, or when it turns off? Also see my previous reply about +5v and ground wires to the LCD. A photo of your wiring would help.

dc42:
Yes, it does seem strange. I suggest you test the diode that you fitted in the new position. Does the garbage appear when the solenoid turns on, or when it turns off? Also see my previous reply about +5v and ground wires to the LCD. A photo of your wiring would help.

I will do more testing here, and take a photo after I clean up the wiring. The garbage characters appear always when the solenoid is turned off. I am powering the LCD using the 5V and GND pins directly from the Arduino UNO's power rail. Thanks.

liudr:
You tried a 1n4004 diode yet?

Thanks liudr for your reply, Today i tried to buy 1n4004 diode but all verdors are saying that the replacement/upgrade is 1n4007 and 1n4004 is outdated and not avalable. Do you have any other solution for this problme? Thanks in advance.

Thanks liudr for your reply, Today i tried to buy 1n4004 diode but all verdors are saying that the replacement/upgrade is 1n4007 and 1n4004 is outdated and not avalable. Do you have any other solution for this problme? Thanks in advance.

All of the 1N4000 series devices are essentially the same except for their reverse voltage rating. The higher the number the higher the voltage rating. Therefore a 1N4007 can replace a 1N4004 with no problems.

Don

If you get problem when you disengage the solenoid, then it is the diode's problem or how it is connected. If you have it correctly connected then the diode will bypass the back EMF. Let us see the connection diagram and the actual photo.

liudr:
If you get problem when you disengage the solenoid, then it is the diode's problem or how it is connected. If you have it correctly connected then the diode will bypass the back EMF. Let us see the connection diagram and the actual photo.

Attached is a photo of the relay and solenoid. I was trying out different length of the wires, and it seems that a long wire between NO of the relay to the cathode of the diode yields the best result (even though it still does not completely suppress the back EMF). The power supply is a dedicated 12V with 10A rating, and has no connection to the Arduino UNO. The 12V solenoid draws about 1A when active. Please let me know if you have any suggestion or need more information. Thanks.

Help me here, is this what you want to do?

Turn on a relay that powers a solenoid? The diode needs to be at the relay coil side. The solenoid? separate the 12V supply ground from arduino's. They don't have to and should not share grounds.

I only see the box (you held it in your hand in the other picture). Is the relay inside the box or is it outside your picture?

liudr:
Help me here, is this what you want to do?

Turn on a relay that powers a solenoid? The diode needs to be at the relay coil side. The solenoid? separate the 12V supply ground from arduino's. They don't have to and should not share grounds.

I only see the box (you held it in your hand in the other picture). Is the relay inside the box or is it outside your picture?

Yes, there is also a diode on the relay coil side. Attached are the schematics of the customized 8-unit relay board and a photo of the relay PCB. I am using the Arduino to control the two input pins of each relay (a matrix configuration), so I can control 256 relays with one Arduino. The box in my hand is the solenoid. The relay is shown in this attachment.

Regarding the ground, Arduino is powered by its own 12V power supply, which is separate from the 12V power supply for the solenoid. The relay is 5V and is powered from Arduino. Thanks.

Protel Schematic.pdf (23.8 KB)

OK got it. If you only switch relays without solenoids attached, will you see garbage on LCD? Can you give a large picture of the arduino and LCD included?

liudr:
OK got it. If you only switch relays without solenoids attached, will you see garbage on LCD? Can you give a large picture of the arduino and LCD included?

Sorry for the delay. This past week I have been trying to find a consistent way to reproduce the problem. I cleaned up the wiring, so I can take a better picture to show you guys. After that, I have not been able to reproduce the problems consistently (the problem still exists). Attached are the photos of the Arduino side with two closeup photos. The wiring of the LCD is the same as the Arduino tutorial, except I have added a 150 ohm resistor to the LCD backlight supply voltage as suggested by another post. I will add more labels to the wiring later tonight or tomorrow, so you guys can better understand my setup. Thanks.

What about driving the relays without the solenoids connected? Still junks?

In the photo, I can see a brown wire and a black wire from the LCD, and these wires appear to go under the table. Which connections are they, and where do they go? I also see some wires from the top end of the LCD going to the breadboard, and there appears to be a +5V connection to the breadboard which is shared with other devices. See my previous advice about using dedicated Vcc and ground wires between the Arduino and the LED. Sharing the Vcc and ground to the backlight with other connection should be OK though, provided the backlight cathode connection on the LCD is isolated from the LCD signal ground connection.

Try to keep all the LCD signal, Vcc and ground wires (not counting the backlight wires) close together, with no big loops. I can see 4 wires (red, yellow, orange, green) like this, but the rest are all over the place.

To add on dc42's suggestion, you want a capacitor between 5V and gnd on the breadboard. Try 0.1 uF to 10uF cap.

Hi dc42 and liudr,

Thank you for your advice. Attached is a closeup of the Arduino with labels. It should clear up some confusion regarding the wiring.

@liudr, I will add the cap between Vcc and GND.

@dc42, just to confirm, the Arduino, LCD and backlight should be powered as follows:

Arduino <- dedicated 12V power supply
LCD <- dedicated 5V power supply
backlight <- same power supply as the LCD

Many thanks!

No, the LCD (other than the backlight) must be powered from the Arduino 5V pin. The backlight can also be powered from the 5V pin (but that will increase the dissipation in the regulator), or from a separate 5V supply, or (if it is a standard LED backlight and has no low-voltage caps across it) from the 12V supply if you use a larger series resistor.