I'm using L293D to control a motor. The motor input pin of L293D is controlled by output pins of HT12D IC. To control the speed of the motor I have a PWM signal from Arduino, but to which pin of L293D should I connect. I think it should be pin 8, right? Here is a link to the pinout: https://www.rs-online.com/designspark/rel-assets/dsauto/temp/uploaded/learn_arduino_L293D.jpg?w=1042
-
1\$\begingroup\$ Welcome to EE.SE. Please upload the pinout image into your question so we don't all have to follow a link (which may die). You should also link to the datasheet. \$\endgroup\$– TransistorCommented Apr 10, 2021 at 14:41
-
2\$\begingroup\$ On SE sites we don't put '[Solved]' in the title. Instead remove that and accept the best answer and upvote others. It will then be marked solved to the system and marked solved on the home page. \$\endgroup\$– TransistorCommented Apr 10, 2021 at 17:12
-
1\$\begingroup\$ You probably want the outputs of HT12D to go into Arduino. Outputs of Arduino go to L293D. Arduino does PWM, directed by HT12D. \$\endgroup\$– StainlessSteelRatCommented Apr 10, 2021 at 17:15
-
1\$\begingroup\$ kzkhan98 - Thank you for trying to indicate that your question has been solved, by adding "[Solved]" to the title. However that isn't what we do on this site. Instead, please upvote answers which helped (although the votes won't be publicly displayed, until you have more points yourself) and, especially, please accept the answer which most led to your problem being solved. Accepting "the best answer for you" is how we indicate that a problem has been solved. Please see here in the help center for more information. Thanks. \$\endgroup\$– SamGibson ♦Commented Apr 10, 2021 at 17:16
2 Answers
I think you have slightly misunderstood the wiring schematic. Typically pin 8 and 16 are the main supplies that will be driving the motors.
The PWM signal from the arduno will often be connected to pin 1 or pin 9, depending on witch H-bridge you are using
TI's driver comes with a wiring schemattic you can use: https://www.ti.com/product/L293D
-
1\$\begingroup\$ Thanks! I will try it tomorrow... \$\endgroup\$– knightCommented Apr 10, 2021 at 17:01
As has been suggested, datasheets often not only explain how to use the chip but also offer example circuits. There are also websites that go into great detail on how to use the L293 such as All You Need to Know About L293D
In any case, the L293D is a set of half-H bridges and there are some general concepts that are true for all half-H bridges. Think of a half-H as a voltage controlled switch: toggling the input pin causes the output pin to be connected either to a high voltage supply or a low voltage supply. Often, the low voltage supply is ground.
The inputs can be either positive or negative polarity. Positive polarity means that when the input pin is driven high, the output pin is connected to the high voltage supply and when driven low the output is connected to ground. Negative polarity works the other way around: a high input connects the output to ground and vice versa. Negative polarity half-H's are useful when you want to put two of them together to make a full-H.
The L293D has four half-H bridges. Pin 16 is the supply for the chip. This should be connected to one of the 5V pins on the Arduino. Pin 8 is the power supply for the motor; the high voltage supply I mentioned above. Don't try to connect pin 8 directly to the Arduino. It needs to be connected to a separate supply just to drive the motor. The ground pins are shared by both the Arduino and the motor supply. Be sure to connect a wire from one of the ground pins to a GND on the Arduino. Also connect the motor power supply GND to L293 GND.
Now, to control the motor in one direction, connect a GPIO pin on the Arduino to one of the inputs on the L293 (pin 2, 7, 10, or 15.) On the output side, connect one of the motor wires to GND and the other to the appropriate output on the L293. There's one more thing you need to do before using the Arduino to control the input pin: pin 1 and 9 are Enables. Pin 1 controls half-H 1 and 2 while pin 9 controls half-H 3 and 4. To make the half-H's work you need to connect the appropriate EN pin to 5V (active high.). You can connect it to a GPIO pin on the Arduino and control it that way, or just wire it directly to 5V.
Now, if you tell the Arduino to drive the input pin high then the motor will run at full speed. If you drive the input pin low then the motor will stop. If you PWM the input pin then you can control the speed of the motor.
Controlling both the speed and direction is left as an exercise for the reader. :)
-
1\$\begingroup\$ Thanks for the detailed answer! \$\endgroup\$– knightCommented Apr 10, 2021 at 17:00