L293D driver on Raspberry Pi

L293D driver on Raspberry Pi

This time I finally got my hands on a L293D Texas Instruments motor driver chip. I purchased it from JayCar electronics for $4.95 (I'm sure on eBay it would be $0.99 or less, but urge to develop surpassed a margin).

I also got a 6V DC motor (not brushless) with pretty decent 9000RPM. Torque for small-medium projects should be definitely enough.

My next question was: how can I control a 6V DC motor from Raspberry Pi? Since Raspberry Pi can provide maximum 5V - we need a separate power supply. I used a rechargeable LiPo 11.1V 25C 2200mAh battery as external supply:

In order not to burn the chip, motor and Pi - main trick is not to use a main 2-contact terminal, but a 4-pinned connector. One of the pins is ground (usually black colour, but mine had red), while other three provide different voltage: my values were 3.96V, 7.92V and 11.87V. 7.92V will be sufficient for us, since L293D driver also manages voltage for motor.

Coming back to L293D: I'm honestly very excited by this driver. It allows to control two DC motors or a single stepper motor.

A brief driver walkthrough:

Pins 4, 5 and 13, 12 are designed for a ground. Pins 3, 6 and 14, 11 are supporting motor connectivity. Pins 1,2,7 and 15, 10 and 9 can be used for Raspberry Pi connectivity where 9 and 1 pins are enable control type. Pin 16 powers driver module itself, while pin 8 is designed for external power supply for motors.

It is super important to know limitations of driver, which can be found on official TI website here. Most important information regarding voltage is below:

As it has been mentioned before, driver uses two power supplies: one (Vcc1) for module itself, while another (Vcc2) one is for motors. For Vcc1 maximum is 7V while for Vcc2 is 36V. Which means we are able to operate motor which has 4.5V-36V voltage.

Keep in mind that using values close to absolute maximum can damage driver, Pi and motor in a long term <!>

My final wiring with looked like this (but with a single motor):

Image from https://business.tutsplus.com/tutorials/controlling-dc-motors-using-python-with-a-raspberry-pi--cms-20051

For the programming part, I used GPIO standard library, and a great example of a simple DC motor usage with speed change is described here:

https://raw.githubusercontent.com/JoBergs/RaspiContent/master/motor_control_l293_pwm.py

Pulse Width Modulation used in example also shows you can control the speed of motor with ChangeDutyCycle(speed) function. Mind that GPIO library should be also installed on Raspberry Pi.

Will continue to play more for better findings!

0 Comments
Loading...