I used the L293DNE a while back in a prototype robot and thought it might be worthwhile documenting it. I've since replaced the L293DNE with a Pololu TB6612FNG board and am now using 6V motors instead of the 3V Tamiya models.
Here is a picture of the prototype with a MSP430F5529 on top running things:
Here is the test code and a description of the circuit for those that are interested:
/*
This is a motor control circuit using a TI L293DNE motor
controller used with a MSP432-F5529LP to drive
a toy Tamiya tank with two motors.
Note that the Tamiya motors operate at 3V and the feed is
routed through LD1117AV33's to get the voltage down.
Note: Do not use PWM below about 50% or motors can stall -
suggest using PWM to balance motor speed only.
L293DNE
-------
1 MCU 39 (P2.4) - Enable pin
2 MCU 2 (P6.5) - Left Motor Logic pin 1
3 Left Motor Terminal 1
4 Heat sink / ground
5 Heat sink / ground
6 Left Motor Terminal 2
7 MCU 3 (P3.4) - Left Motor Logic pin 2
8 Motor Power Supply - 5.0V reduced to 3.3V for Tamiya
9 MCU 40 (P2.5) - Enable pin
10 MCU 4 (P3.3) - Right Motor Logic pin 1
11 Right Motor Terminal 1
12 Heat sink / ground
13 Heat sink / ground
14 Right Motor Terminal 2
15 MCU 5 (P1.6) - Right Motor Logic pin 2
16 IC Power Supply - 5.0V (used separate supply than LP)
LD1117AV33 - connect all motor terminal through these (4)
----------
1 5.0 V
2 GND
3 3.3 V
Tamiya Motors
-------------
Connect terminals to 3.3 V output from LD1117AV33 above
Capacitors
----------
See LD1117AV33 datasheet
suggests 10uF on output and 100nF on input
Frank Milburn 22 Feb 2015
*/
const int leftMotor1Pin = 2;
const int leftMotor2Pin = 3;
const int leftEnablePin = 39;
const int rightMotor1Pin = 4;
const int rightMotor2Pin = 5;
const int rightEnablePin = 40;
void setup()
{
pinMode(leftMotor1Pin, OUTPUT);
pinMode(leftMotor2Pin, OUTPUT);
pinMode(leftEnablePin, OUTPUT);
pinMode(rightMotor1Pin, OUTPUT);
pinMode(rightMotor2Pin, OUTPUT);
pinMode(rightEnablePin, OUTPUT);
Serial.begin(9600);
Serial.println("Starting motor test");
}
void loop()
{
Serial.println("Forward"); // start with left side
digitalWrite(leftMotor1Pin, LOW); // set leg 1 of H-bridge low
digitalWrite(leftMotor2Pin, HIGH); // set leg 2 of the H-bridge high
digitalWrite(rightMotor1Pin, LOW); // now right side
digitalWrite(rightMotor2Pin, HIGH);
digitalWrite(leftEnablePin, HIGH); // enable motors on
digitalWrite(rightEnablePin, HIGH);
delay(2000);
Serial.println("Stop");
digitalWrite(leftEnablePin, LOW); // disable the motors
digitalWrite(rightEnablePin, LOW);
delay(1000);
Serial.println("Backwards");
digitalWrite(leftMotor1Pin, HIGH); // Reverse the motors
digitalWrite(leftMotor2Pin, LOW);
digitalWrite(rightMotor1Pin, HIGH);
digitalWrite(rightMotor2Pin, LOW);
digitalWrite(leftEnablePin, HIGH); // enable motors on
digitalWrite(rightEnablePin, HIGH);
delay(2000);
Serial.println("Stop");
digitalWrite(leftEnablePin, LOW); // disable the motors
digitalWrite(rightEnablePin, LOW);
delay(1000);
Serial.println("Forward 3/4 speed");
digitalWrite(leftMotor1Pin, LOW); // Set both sides forward
digitalWrite(leftMotor2Pin, HIGH);
digitalWrite(rightMotor1Pin, LOW);
digitalWrite(rightMotor2Pin, HIGH);
analogWrite(leftEnablePin, 192); // enable motors on at reduced speed with PWM
analogWrite(rightEnablePin, 192);
delay(2000);
Serial.println("Stop");
digitalWrite(leftEnablePin, LOW); // disable the motors
digitalWrite(rightEnablePin, LOW);
delay(1000);
}
Learning to use microcontrollers with an emphasis on the Texas Instruments Launchpads / Energia
Showing posts with label Pololu. Show all posts
Showing posts with label Pololu. Show all posts
Thursday, April 2, 2015
Wednesday, March 11, 2015
Sites I Frequent
These are sites I frequently visit and can recommend. Here they are, in the order I more or less discovered them:
Arduino: The educational / hobbyist / maker movement has benefited greatly from Arduino. There is a lot of good stuff on their site and the internet is full of good (and not so good) support. This is a very good place to start if you are new to microcontrollers (but this is a blog about the TI LaunchPad series so let's move on)
SparkFun: I got started in microcontrollers with a "SparkFun Inventor's Kit" and SparkFun RedBoard (an Arduino Uno compatible). They have a large selection of hobbyist material and documentation for their products.
Adafruit: Great products. Great documentation. Great service. This is a really good place to go for Arduino, Raspberry Pi, and Beaglebone Black. Many of their products can also be used with the Texas Instrument Launchpads.
Texas Instruments: The Texas Instrument LaunchPad lineup offers incredible value and capability. Read more about them here.
Energia: Energia is a fork of Wiring and Arduino for various Texas Instruments LaunchPads - if you have some experience with the Arduino, this site is going to look familiar. And the great thing is that moving to Code Composer Studio, TI's full featured development environment, is available if you need the additional capability.
Mouser: I love these guys. If you need one 10 cent resistor they will ship it to you. And they carry an amazing array of products, all with datasheets - including the TI LaunchPad series.
Pololu: I recently started using Pololu for robot components and have been pleased. They have some interesting products with good range - especially in motors and motor controllers.
Addicore: They don't have as large a selection as the companies above but what they do have is great value (free shipping on orders larger than $25 too!). They are very quick and responsive - the best service I have received. You will also find some of their items on Amazon (at a slightly higher price).
Arduino: The educational / hobbyist / maker movement has benefited greatly from Arduino. There is a lot of good stuff on their site and the internet is full of good (and not so good) support. This is a very good place to start if you are new to microcontrollers (but this is a blog about the TI LaunchPad series so let's move on)
SparkFun: I got started in microcontrollers with a "SparkFun Inventor's Kit" and SparkFun RedBoard (an Arduino Uno compatible). They have a large selection of hobbyist material and documentation for their products.
Adafruit: Great products. Great documentation. Great service. This is a really good place to go for Arduino, Raspberry Pi, and Beaglebone Black. Many of their products can also be used with the Texas Instrument Launchpads.
Texas Instruments: The Texas Instrument LaunchPad lineup offers incredible value and capability. Read more about them here.
Energia: Energia is a fork of Wiring and Arduino for various Texas Instruments LaunchPads - if you have some experience with the Arduino, this site is going to look familiar. And the great thing is that moving to Code Composer Studio, TI's full featured development environment, is available if you need the additional capability.
Mouser: I love these guys. If you need one 10 cent resistor they will ship it to you. And they carry an amazing array of products, all with datasheets - including the TI LaunchPad series.
Pololu: I recently started using Pololu for robot components and have been pleased. They have some interesting products with good range - especially in motors and motor controllers.
Addicore: They don't have as large a selection as the companies above but what they do have is great value (free shipping on orders larger than $25 too!). They are very quick and responsive - the best service I have received. You will also find some of their items on Amazon (at a slightly higher price).
Subscribe to:
Comments (Atom)