Problem with LCD and Motor

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.

Does the relay control have a ground that goes from arduino to breadboard then to relay control? Just checking.

liudr:
Does the relay control have a ground that goes from arduino to breadboard then to relay control? Just checking.

The 5V relay control is currently powered by the same 5V/GND from the Arduino to the LCD & backlight. Is this correct?

About half an hour ago, the garbage character problem showed up again. It happened when I tried to turn on and off 17 solenoids (one by one in consecutive order with one second in between). But it did not happen again when I repeated the same steps. So the problem is evasive. BTW, I do not have the 10uF cap between Vcc and GND yet as I still need to get the part from the local store.

This is the LAST time I am asking you: what happens if you just switch the relays without solenoids connected to the relays.

liudr:
This is the LAST time I am asking you: what happens if you just switch the relays without solenoids connected to the relays.

I would like to give you a definitive answer, but I can't. It took entire day to reproduce this problem once (with the solenoid connected). A few days ago I did disconnect the solenoid, and the problem did not occur for the entire day. However, it does not mean the problem would not occur without the solenoid connected. Until I find a consistent way of producing the problem, there is just no way to be sure.

daytrader152:

liudr:
This is the LAST time I am asking you: what happens if you just switch the relays without solenoids connected to the relays.

I would like to give you a definitive answer, but I can't. It took entire day to reproduce this problem once (with the solenoid connected). A few days ago I did disconnect the solenoid, and the problem did not occur for the entire day. However, it does not mean the problem would not occur without the solenoid connected. Until I find a consistent way of producing the problem, there is just no way to be sure.

En, understand. Try the capacitor then, just leave your system for a day or so and check back on the LCD. You don't need 10 uF something less than that will also work.

This may seem like a noob point, but I noticed your PCB doesn't have a ground flood? You should try adding one in to aid in heat-sinking!

...apologies if you already know this :stuck_out_tongue:

nanohex:
This may seem like a noob point, but I noticed your PCB doesn't have a ground flood? You should try adding one in to aid in heat-sinking!

...apologies if you already know this :stuck_out_tongue:

@liudr, I added the cap at LCD Vdd and Vss. Unfortunately the problem still exists. :frowning: I will try cleaning up all the wiring and solder joints.

@nanohex, would you mind clarifying the ground flood for me? I am not too familiar with it. Thanks.

I think nanohex was talking about your relay circuit board having no ground plane. But it may have some on the bottom side.

daytrader152:
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.

You haven't yet implemented the suggestion in my reply #59 because the power and ground wires to the LCD do not follow the same route as the signal wires.

Keep the +5v and ground wires to the relay separate from the ones to the LCD as far as possible. You shouldn't need to use the same ground pin for both because you have 3 ground pins on the mega. If the LCD and relay share the +5V connection, keep that shared wire as short as possible.

How are you driving the relay: through a transistor?

dc42:

daytrader152:
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.

You haven't yet implemented the suggestion in my reply #59 because the power and ground wires to the LCD do not follow the same route as the signal wires.

Keep the +5v and ground wires to the relay separate from the ones to the LCD as far as possible. You shouldn't need to use the same ground pin for both because you have 3 ground pins on the mega. If the LCD and relay share the +5V connection, keep that shared wire as short as possible.

How are you driving the relay: through a transistor?

I will keep the LCD signal/power/gnd wires all close together.

Regarding the relay, it is powered by a separate 5V power supply. I am driving the relay through two transistors to provide a matrix configuration as shown in the attached schematic (containing 8 relay modules).

Protel Schematic.pdf (23.8 KB)

@nanohex, would you mind clarifying the ground flood for me? I am not too familiar with it. Thanks./

I couldn't come up with a decent explanation in my own words so this is from Wikipedia:

"A ground plane on a printed circuit board (PCB) is a large area or layer of copper foil connected to the circuit's ground point, usually one terminal of the power supply. It serves as the return path for current from many different components.
A ground plane is often made as large as possible, covering most of the area of the PCB which is not occupied by circuit traces. In multilayer PCBs, it is often a separate layer covering the entire board. This serves to make circuit design easier, allowing the designer to ground any component without having to run additional traces; component wire needing grounding is routed directly through a hole in the board to the ground plane on another layer. The large area of copper also conducts the large return currents from many components without significant voltage drops, ensuring that the ground connection of all the components are at the same reference potential."

Basically any area that's just left empty (copper etched away; no traces) is instead left with its original copper. These are then connected to ground.

nanohex:

@nanohex, would you mind clarifying the ground flood for me? I am not too familiar with it. Thanks./

I couldn't come up with a decent explanation in my own words so this is from Wikipedia:

"A ground plane on a printed circuit board (PCB) is a large area or layer of copper foil connected to the circuit's ground point, usually one terminal of the power supply. It serves as the return path for current from many different components.
A ground plane is often made as large as possible, covering most of the area of the PCB which is not occupied by circuit traces. In multilayer PCBs, it is often a separate layer covering the entire board. This serves to make circuit design easier, allowing the designer to ground any component without having to run additional traces; component wire needing grounding is routed directly through a hole in the board to the ground plane on another layer. The large area of copper also conducts the large return currents from many components without significant voltage drops, ensuring that the ground connection of all the components are at the same reference potential."

Basically any area that's just left empty (copper etched away; no traces) is instead left with its original copper. These are then connected to ground.

Thank you for the explanation. It turned out that there is no ground plane on my relay PCB. Is there anything I can do?

If you're using Eagle CAD, you need to draw a polygon around the perimeter of your board, and rename it to GND. Make sure you change the 'isolation' tab to around 12 mils or so (this changes how much clearance you want between the ground plane and other traces). Do this on both sides, then hit the rat's nest tool to see it work! I'm not sure how to do this on other PCB layout programs though.

Jeremy Blum has a nice tutorial on youtube (for Eagle) - watch part 2 and skip forward to where he adds the ground plane to see!

This must be the universal answer to all LCD problems no matter how old.

Don