# L293D DC motor affecting LCD display

In the circuit below, I have noticed that when the DC motor (12V) is disconnected, everything works nice. The LCD correctly displays what arduino sends to it. But when I connect the motor as indicated and the arduino sets EN12 to HIGH and 1A to high (2A being LOW) and the motor starts, the display suddenly overwrites some of the fields with weird symbols (see the second picture). This continues even after the motor is stopped and the number of rewritten fields increases everytime the motor starts (arduino no longer manages to overwrite those fields).

I thought that L293D should isolated the circuit with the motor. I even measured the current coming from arduino into the breadboard and there was no obvious change or increased draw due to motor starting (i don't even know why there should be but I was trying to figure that out).

Is there a mistake in the circuit?

• Please add a schematic. – Hearth Mar 16 '19 at 18:20
• 1) The L293, L298, etc are notoriously horrible. 2) Please use a schematic not a rendering, no one wants to look up the pinouts to see if you mixed up the two power supplies to the L293 3) You give no indication where the Arduino or LCD power are coming from 4) Placing a small capacitor across the motor brushes is routine, sometimes even more is done. – Chris Stratton Mar 16 '19 at 18:20
• You're Fritzing wiring drawing (=/= schematic) doesn't contain the power supplies. Do draw them as well and reconsider if the circuits are isolated. – Huisman Mar 16 '19 at 18:28
• power the motor separately. – st2000 Mar 16 '19 at 19:09
• You are getting noise into your display data. Motor should be powered through a common mode choke of 100uH, and a 10uF bypass capacitor at the motor power terminals. Breadboards are terrible at isolating noise. – user105652 Mar 16 '19 at 19:26

You're suffering from really bad ground loops. Basically, you've carefully arranged things so that all of the hash that the motor generates is forced to travel through a ground wire that should be providing a nice 0V reference to all of the digital bits. This means that one thing's ground is not another thing's ground.

Draw a dotted line through the schematic. On one side, put the motor, battery, and driver. On the other side, put all the sensitive digital stuff. Connect the motor-side and digital-side ground at exactly one point on the schematic. Connect the motor-side and digital-side +12V at exactly one point on the schematic (the suggested choke isn't a bad idea, but it may not be necessary -- getting the wiring right is).

Now connect your circuit the same way. One point on ground that is common to both circuits; one point on +12V that is common to both circuits. No possible path for the motor current to flow back to the battery that includes the processor, clock, or display.

See if that helps.

• I am not really sure what you mean, since if I use l293d, I do not see how to avoid the common ground. I am on a breadboard and it is not possible to make a single point to which I would solder all grounds, if this is what you mean. Just the LCD has 4 connection to ground so that is 4 holes on a breadboard. Can you please elaborate on what you mean in your reply? – leosenko Mar 16 '19 at 23:20
• I may understand what you mean (take all grounds to equipment and connect them to - on battery and take all +12V and connect them to +on battery), but I do not think that is realizable. If I power arduino with 12V, I have to use the barrel jack and thus this ground is already "unseparable" and I do not know of a simple way to connect Arduino to 12V without the barrel jack (I am not sure if Vin input will be able to handle that). – leosenko Mar 17 '19 at 2:11
• Then pick your motor ground and +12V off at the barrel jack. Or pick the barrel jack off at the motor connection. – TimWescott Mar 17 '19 at 2:31
• but this is essentially what I have one jack is split into two, I think you can see it in the photo in the question. Could this also be connected to the fact that even when nothing is supplied to VCC2 of l293d, there is non zero voltage accross the driver outputs (1,2Y) and I can actually power an LED without VCC2, the LED is dimmed and so the power has to be supplied somehow by arduino. – leosenko Mar 17 '19 at 2:34
• Not according to your fritzing diagram. You have the battery ground going to the driver chip and to the jack, and then you have the driver chip's ground going to the bread-board ground. – TimWescott Mar 17 '19 at 4:45

I would advise using some capacitors to reduce motor noise.

At the motor
First, place capacitors at the motor terminals as already suggested by @ChrisStratton. One 100nF 50V across the terminals and if possible from each terminal to the housing. The capacitors (partly) short the high frequent noise the motor generates.
Check Dealing with Motor Noise how to solder the capacitors. Apply other tips as well (like twisting motor and supply wires).

At the L293D
Add a 100nF and a 10uF to 100uF elco (rated twice or more your battery voltage) to the Vcc2 input of the L293D as shown in the schematic and a 100nF at the Vcc1.
The capacitors should have leads as short as possible (they are drawn larger for clarity). The order of placing the capacitors matters. The 100nF should be closest to Vcc2 and GND, the elco second closest, the red/black supply wires third closest.
Peak currents drawn by the L293D and motor will now be drawn from these capacitors, reducing noise and keeping your ground signal better at zero volt.

At the LCD and RTC module
I'm not sure whether the LCD and RTC module have their own decoupling capacitors, but it can't do harm adding a 100nF at the power supply of both. (I didn't draw one for the RTC module).