Arduino with L293D weird problem

So I have my arduino Uno R3 and a L293D IC I bought,

I wired them both correctly and the L293D input pins are connect as follows:

L293D → Arduino
Input1 → Pin 3
Input2 → Pin 2
Input3 → Pin 4
Input4 → Pin 5

(I am only controlling 1 motor so I’ll only be using pins 2 and 3 on the arduino, and that will be controlling the motor on the side where the Enable1 pin is located)

And the Vs and Vss are connected to arduino’s 5v pin

If you all really need a picture of my circuit then please do tell me, I didn’t provide it cause my circuit is very messy and I doubt you all can see the connections even if I attach a pic of it. Or if you all can provide me a website that I can draw the schematics with, that would be great cause I don’t know any

Btw I am not using any capacitors or diodes at the moment cause all I want is to get the motor and the IC to work before making things more complicated

Here’s my code

#define MOTOR_PIN1 2
#define MOTOR_PIN2 3
#define MOTOR2_PIN1 4
#define MOTOR2_PIN2 5

void setup()
{
  pinMode(MOTOR_PIN1, OUTPUT);
  pinMode(MOTOR_PIN2, OUTPUT);
  pinMode(MOTOR2_PIN1, OUTPUT);
  pinMode(MOTOR2_PIN2, OUTPUT);

  
  digitalWrite(MOTOR_PIN1, LOW);
  digitalWrite(MOTOR_PIN2, LOW);

  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead(A0));
  
  digitalWrite(MOTOR_PIN1, HIGH);
  digitalWrite(MOTOR_PIN2, LOW);

  delay(1000);
  
  Serial.println(analogRead(A0));
  
  digitalWrite(MOTOR_PIN1, LOW);
  digitalWrite(MOTOR_PIN2, LOW);

  delay(1000);
}

And I’m using this DC motor: http://www.aliexpress.com/item/Micro-130-DC-Motor-For-DIY-Four-wheel-Motor-Scientific-Experiments-Free-Shipping-Russia/32383738291.html

So the problem is, my motor isn’t running when I connect both outputs to the motor but when I replace the wire which is connected to the Input1 pin on the L293D(or pin3 on the Arduino. I.e. the one which I’m sending the low digital voltage on) with a wire connected to ground, it works!

And the weird thing is when I connect both wires to A0 to measure the voltage, the serial monitor gives me the values of around 35-50 for both wires

Lastly, just for your information, I’m just a beginner in all these electronic stuffs

How are you powering the L293?

A quick drawing would be nice - even a sketch on the back of a napkin is fine.

// Per.

Uhm I connected all the Vss, Vs, Enables etc to 5V(Hopefully connecting Vs and Vss to 5V isn't the problem)

Maybe I can just tell you the connections

Enable1 -> 5V Input1 -> Arduino pin 3 Output1 -> Motor1 GND -> Ground GND -> Ground Output2 -> Motor1 Input2 ->Arduino pin 2 Vs -> 5V

Vss -> 5V Input4 -> Arduino pin 5 Output4 -> Nothing GND -> Ground GND -> Ground Output3 -> Nothing Input3 -> Arduino pin 4 Enable2 -> 5V

I have a feeling that the problem is because the low digital voltage on the pins are not low enough to act as a ground so that's why when I connect the wire which is supposed to act as a ground to the ground pin, it works

Maybe I can just tell you the connections

You can but you expect us to construct a schematic from that list. I think that is being unreasonable. You are asking for help and so I would expect you to be as helpful as possible. This sort of comment is not helpful.

And the weird thing is when I connect both wires to A0 to measure the voltage, the serial monitor gives me the values of around 35-50 for both wires

There seems to be a universal rule that when ever anyone says something is weird it is perfectly normal.

The data sheet says that a logic zero on an output can be up to voltage of 0.9V when powered by 5V. So there is nothing weird in seeing a reading of 50 as that would correspond to a voltage of 0.244V, well within the specification for both the Arduino and the L293D.

SlonCHL: I have a feeling that the problem is because the low digital voltage on the pins are not low enough to act as a ground so that's why when I connect the wire which is supposed to act as a ground to the ground pin, it works

I don't know what you mean by this.

Is the 3.6V (5V - (0.7*2) enough to run that motor properly?

// Per.

Grumpy_Mike: You can but you expect us to construct a schematic from that list. I think that is being unreasonable. You are asking for help and so I would expect you to be as helpful as possible. This sort of comment is not helpful. There seems to be a universal rule that when ever anyone says something is weird it is perfectly normal.

The data sheet says that a logic zero on an output can be up to voltage of 0.9V when powered by 5V. So there is nothing weird in seeing a reading of 50 as that would correspond to a voltage of 0.244V, well within the specification for both the Arduino and the L293D.

Here's the circuit:

|500x334

Well, I'm a beginner anyway and the weird thing I'm talking about is, I suspect that the wire with the low digital voltage has too much voltage to act as a ground wire but after the check, they both gives me the same reading and that is weird to my assumption but doubtless that my assumption can be very wrong

Zapro: I don't know what you mean by this.

Is the 3.6V (5V - (0.7*2) enough to run that motor properly?

// Per.

I tested the motor with Arduino's 3.3v and it works fine so I don't think that's the problem. Btw how did you get that 0.7 * 2? I tried reading the datasheet but it is very confusing with all the electronic terms which I do not understand

Here's the circuit:

:( >:( No that is an abortion, it is a physical layout diagram it is NOT a circuit.

It is more than likely that you have a bad connection somewhere. Solderless bread board is very bad and I never recommend that anyone uses it.

Btw how did you get that 0.7 * 2?

0.7V is the saturation voltage of a transistor, you have two of them inside that chip so that is where you get 1.4V from. However it is worse than that. The VCEsatH Source Output Saturation Voltage can be up to 1.8V so can your motor run off 5 - (1.8*2) =1.4V?

These chips are not designed to run off such a low voltage as 5V. Yes the logic power input is but not the motor power input.

Grumpy_Mike:

:( >:( No that is an abortion, it is a physical layout diagram it is NOT a circuit.

It is more than likely that you have a bad connection somewhere. Solderless bread board is very bad and I never recommend that anyone uses it. 0.7V is the saturation voltage of a transistor, you have two of them inside that chip so that is where you get 1.4V from. However it is worse than that. The VCEsatH Source Output Saturation Voltage can be up to 1.8V so can your motor run off 5 - (1.8*2) =1.4V?

These chips are not designed to run off such a low voltage as 5V. Yes the logic power input is but not the motor power input.

Lol sorry man, I'm new as hell to this. I am just using it for testing. And it works fine when I connect one of the motor wires to ground instead of connecting it to the L293D

I don't understand why it causes that when I connect the low digital voltage wire to ground, it works, only the low digital voltage wire, the other one is still connected to the L293D

I don't understand why it causes that when I connect the low digital voltage wire to ground, it works, only the low digital voltage wire, the other one is still connected to the L293D

My guess is a poor connection with the Arduino pin.

Grumpy_Mike: My guess is a poor connection with the Arduino pin.

I checked, nothing is wrong with the connections, all connected firmly too. Btw my L293D heats up very fast when I connect a motor to it(Like it become so hot after a few minutes that you can't even put your hand there) if that helps

Sorry man but the fact that you are a beginner does not excuse you from needing to read a datasheet.. You should NEVER have even applied power to your circuit until having read the L293' datasheet ( starting with the POWER PINs ( like which one is the Logic power (+5V) and which one is the MOTOR POWER (which , FYI, is NOT the same as the Logic Power pin)) It sounds very much like you don't have ANY of the power pins connected correctly on the L293. ( good thing you're not working with explosives).

raschemmel: Sorry man but the fact that you are a beginner does not excuse you from needing to read a datasheet.. You should NEVER have even applied power to your circuit until having read the L293' datasheet ( starting with the POWER PINs ( like which one is the Logic power (+5V) and which one is the MOTOR POWER (which , FYI, is NOT the same as the Logic Power pin)) It sounds very much like you don't have ANY of the power pins connected correctly on the L293. ( good thing you're not working with explosives).

I know which one is the motor powe pin and logic power, but I heard someone said that I only need to supply the voltage which my motor needs to run on so I supplied 5V to it

Try adding a separate power supply for the motor Vcc-2, L293-pin-8. By isolating the motor power and Logic Power you can troubleshoot the problem better. What are using as a 5V power supply ?

I checked, nothing is wrong with the connections, all connected firmly too.

Mechanical firmness in no guarantee of an electrical connection, you must check the voltage at both ends of the circuit. That means measuring the voltage on the pin of the Arduino chip and checking it is the same voltage on the pin of the L293 chip.

You have made an error but you have not supplied the relevant information for us to find it. Try posting a good quality photo showing all your wiring.

You have made an error but you have not supplied the relevant information for us to find it. Try posting a good quality photo showing all your wiring.

That means DIRECTLY ABOVE and CLOSE UP...

I have powered much larger motors without any overheating of the chip. It gets slightly warm but never hot. You must have a miswire or your motor is drawing too much current. Do you know how to use a DMM to measure the motor current ?

Do you have a 1 ohm resistor and a DMM to measure voltage ?

raschemmel: Try adding a separate power supply for the motor Vcc-2, L293-pin-8. By isolating the motor power and Logic Power you can troubleshoot the problem better. What are using as a 5V power supply ?

After much thinking and research, I'm starting to feel that it's the motor power that's giving me problems, I'll try it with an external power supply tomorrow and get back to you with the result if that's alright. I'm using the USB to power the arduino and the arduino 5V to power the motor like in the layout diagram above

Grumpy_Mike: Mechanical firmness in no guarantee of an electrical connection, you must check the voltage at both ends of the circuit. That means measuring the voltage on the pin of the Arduino chip and checking it is the same voltage on the pin of the L293 chip.

You have made an error but you have not supplied the relevant information for us to find it. Try posting a good quality photo showing all your wiring.

raschemmel: That means DIRECTLY ABOVE and CLOSE UP...

I have powered much larger motors without any overheating of the chip. It gets slightly warm but never hot. You must have a miswire or your motor is drawing too much current. Do you know how to use a DMM to measure the motor current ?

Do you have a 1 ohm resistor and a DMM to measure voltage ?

I don't have a 1 ohm resistor, the lowest I have is a 150 ohm resistor. And I do have a multimeter that I just bought a few days ago, I'm still trying to learn it though

|281x500

|500x281

|500x281

|281x500

|281x500

|500x281

|500x281

|500x281

I'm sorry if the picture doesn't show the whole circuit

150 ohms is too high to use in series with yhe motor. Do you have a meter ? The USB can only source 500 mA . The arfuino draws 50 mA. If the 5V drops too much the arduino will reset. If the motor draws too much it wlll not turn.

raschemmel: 150 ohms is too high to use in series with yhe motor. Do you have a meter ? The USB can only source 500 mA . The arfuino draws 50 mA. If the 5V drops too much the arduino will reset. If the motor draws too much it wlll not turn.

Yes I do. Yeah I've experience Arduino resetting by itself before

Here's my multimeter |281x500

do you know how to measure current ?

Hey guys, while many h-bridges require two separate power supplies for the logic and the motor, the L293D just needs the motor supply to be equal or greater than the logic voltage. The motor voltage does not have to be higher than the logic voltage.

The chip should work when powered with 5V.

My main concern about his setup is the motor is being powered of the computer’s USB.

When you add an external supply, make sure to remember to connect the grounds from the two lines together.

One thing I often suggest when people are using a new h-bridge is to test the h-bridge without a microcontroller to make sure you understand the signal logic.

Here’s my “L298N” video. The L298N and the L293D use the same control logic.

One reason the L293D chip could be getting hot is because you’re using use PWM to reduce the power. You’re running the motors full on. These chips can get hot from normal use so if you have the motor running full blast, it’s not too surprising the chip is getting hot.

When you’re ready to use PWM you’ll likely have a cooler chip if you pulse the enable pin rather than a direction pin. If you use PWM on a direction pin the motor alternates between being powered (during the high part of the pulse) and braking (low part of the pulse). If you pulse the enable pin, rather than pulse/brake you get pulse/coast. Pulse/coast has all sorts of advantages over pulse/brake.

The one advantage pulse/brake offers is the it’s a bit easier to control the speed of a motor with pulse/brake than when using pulse/coast.

I’m not sure if you’re aware of it of not, but that motor won’t be very useful. It really needs a gearbox in order to produce any sort of useful torque. My guess is the motor is just there for learning purposes (which is fine).