I am using the L293D to run two motors, and am controlling it via an ATmega328.

I am a bit confused about how grounding works. I was following this tutorial, and searched this question a lot, but am not satisfied. Essentially, notice how pins 4, 5, 12, and 13 are all connected to ground? And the two enable pins must be connected to +5V. Well, what if my micrcontroller is being powered by a completely separate power source from the motors, yet I am drawing +5V from the MCU for the pins which require +5V on the L293. Which ground do I use for pins 4, 5, 12, and 13? If I use the MCU's ground, then what would complete the circuit for the motors? And if I use the motor's power supply ground for those four pins, then what what complete the circuit for the enable pins?

Basically, I am confused about how to ground the L293 chip, since I require input from both the MCU's power source, as well as from the motor driver's power source (at 12V), yet the datasheet does not seem to indicate separate grounds.


For most simple applications, you needn't have two separate grounds. For heavier applications or where there is need for greater cleanliness of the power supply, it is generally considered a good practice to keep the grounds separate.

Being able to join two grounds together is usually possible (Though not always).


simulate this circuit – Schematic created using CircuitLab

In the case of batteries, any two batteries are isolated from each other for most practical purposes. Once you connect them (or the circuits they are part of) together, the point at which the connection is made specifies how the voltages are related to each other. For conventional applications, you could just call the connection point the combined circuit's main ground reference point, and connect the negative terminals of the batteries to it.

In the case of something connected to a wall power supply, such as with using a transformer, a similar logic can be applied. The transformers isolate the outputs from the input (wall power), and so the DC voltages derived by rectification are effectively isolated from each other. Again, you can connect the two negative points (the 'grounds') together to make a common reference point. Most commercial power supplies that feed off of wall power will output isolated DC voltage due to regulatory requirements. If the power supply also uses the third pin (Earth) on the wall socket, it may be using that to bias the output (fix it to a certain point relative to the Earth at your house / office / what have you), in which case some care must be taken to connect them together. If the power supplies produce single ended DC output (5V and GND, or 12V and GND), then you can pretty safely assume that if the supply is fixing the output voltage relative to Earth, it most likely will be connecting the output ground (0V) to the Earth. Make sure to make the connection on your circuit as well anyway, because the output may also be isolated.

The problem comes if you are using an unusual power supply combination. If you are using a power supply which produces 5V,5VGND; 12V,12VGND, and the two supplies are for reason not isolated and 5VGND is not connected to 12VGND, then you cannot connect them directly. Which means you will have to most likely treat the two grounds as truly separate.

Treating the two grounds as separate is also necessary if, say, you are driving high power motors which may interfere with your Atmega, or if you are also trying to make sensitive analog measurements, or for a variety of other reasons. If you do have to use separate grounds, though, then your Atmega outputs cannot be directly sent to the L293. The signals have to be referenced against the L293 ground (which we'd usually refer to as the power ground) and not the Atmega ground, and these two are not necessarily at the same voltage (the potential difference between the grounds cannot be guaranteed to be zero unless you actually connect them together). This 'translation' can be done using ICs such as optocouplers and other methods of galvanic isolation, which means that the signal is translated from one 'ground' to another without using any usual conducting connection.


If you just used one ground, you wouldn't complete the circuit for both components, so both ground need to be connected together directly for this to work. You can actually see that in the tutorial you linked to. If you look carefully under step 7, you'll see that the battery ground is directly connected to Arduino ground.

Since you have separate positive pins, you shouldn't get voltage spikes on the + 5 V from the motor.

  • \$\begingroup\$ I noticed that too, but I find that very odd. How can you connect two different grounds together? \$\endgroup\$ – capcom Mar 12 '13 at 0:18
  • 1
    \$\begingroup\$ There's no reason you can't. You can just connect them. When you do, there's no circuit for the current to go from one supply to another, but they both share same reference voltage. \$\endgroup\$ – AndrejaKo Mar 12 '13 at 0:19
  • \$\begingroup\$ Actually there will be a little current if there are any unbalanced signals crossing the division between power domains. In sensitive systems some care can go into planning where and how the grounds connect. \$\endgroup\$ – Chris Stratton Mar 12 '13 at 1:23
  • \$\begingroup\$ @Chris Stratton That's true, but I didn't want to go into that much detail since the system looks relatively simple to me. In the works case, capcom could toss in an optocoupler. \$\endgroup\$ – AndrejaKo Mar 12 '13 at 7:49

How grounding works?

Well You should check the datasheet of L293 for this. In short ground is, in fact a reference point. As you know the Voltage is the potential difference to some reference Level and that reference level is ground (in this case, in most of cases).

To understand this consider a simple example, suppose you are in argue with some one to measure the height of something , so it is necessary for both of you to be at same reference level to measure the height. Same is the case for Electronic circuits. If two circuits are going to connect together to perform some task together then they must share same reference level which is ground in DC and neutral line in AC most of the cases. Even if you want to separate them with opto-coupler then too opto isolator is the reference between both of them to share both sides of grounds

You have to connect All ground pins specified by datasheet to drive the motor. Mostly these grounds are for both supplies( controller and motor voltages) which can applied from same power source or from different power supplies to avoid motor's inductive noise and reverse current.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.