Pages: [1]   Go Down
Author Topic: How do I use this motor with my Arduino?  (Read 2877 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have tried searching, and I cannot find anything understandable to an Arduino beginner on how to use the Pololu Dual DC Motor Driver (http://www.pololu.com/catalog/product/2130) with a Tamiya 70097 Twin-Motor Gearbox (http://www.pololu.com/catalog/product/61). Okay, so I have the following things that I understood should be used to make this work:
-Arduino Uno
-DRV8833 Dual Motor Driver Carrier (http://www.pololu.com/catalog/product/2130)
-Tamiya 70097 Twin-Motor Gearbox Kit, which I already put together (http://www.pololu.com/catalog/product/61)
-170-Point Breadboard
-0.1" (2.54mm) Crimp Connector Housing: 1x1-Pin 25-Pack (http://www.pololu.com/catalog/product/1900)
-Wires with Pre-crimped Terminals 10-Pack M-F 6" (http://www.pololu.com/catalog/product/1820)
-Break Away Headers - Long and Straight 10 pack (http://www.robotshop.com/productinfo.aspx?pc=RB-Cyt-55&lang=en-US)

Please help me with this. Thanks in advance!  smiley
« Last Edit: July 13, 2012, 04:49:26 pm by RobotEsach » Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your Arduino Uno, DRV8833 Motor Driver, Gearbox Kit will work together.
But I can't find example code of someone who has used it with the Arduino.
Not even in the forum of Pololu. So you have to find your own way how to do this.
Read the datasheet of the DVR8833, try to understand figure 1 and table 2.
Start for example only with fast decay, you can always add slow decay later on.

Pololu recommends to use the 'stall-detector'. This is a current limiter, which is disabled by default on the DRV8833 board.
But that's for later.

Connect one motor to the output A1 and A2 of the DRV8833 board. For example the '+' of the motor to A1 and '-' of motor to A2.
Connect the other motor to output B1 and B2. Use the same as for the other motor, so the '+' of the motor to B1 and the '-' of the motor to B2.
The inputs are inputs for the full H-bridge.
http://en.wikipedia.org/wiki/H_bridge
Connect the input signals of the DRV8833 board to the Arduino.
Digital pin 0 and 1 are used for serial communication, so you could use 2,3,4,5 or other digital pins.
Also connect the ground and motor power, as shown in the picture at the Pololu page.

Set the pins of the Arduino to output: http://arduino.cc/en/Reference/pinMode
If a pin needs to be zero, use: http://arduino.cc/en/Reference/digitalWrite
If a pin needs to be a PWM signal, use: http://arduino.cc/en/Reference/analogWrite

If you are a beginner, you should use those functions first to blink a led (pin 13 of the Arduino Uno is a led), and to dim a led with the analogWrite function. So you know how to use them, and what thay do.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry but what does "Connect the input signals" mean?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like you have 2 tables in the Driver Chip spec that tell you how the motor will be controlled.
Assume you are driving Motor A and Motor B and that both motors are wired the same.

Driving Ain1 and Bin1 both High while Ain2 and Bin2 stay Low, then both motors will go forward.
If Ain1 and Bin1 are driven from PWM pins, then the forward speed can be controlled, and not just On/Off.

Similarly, to go in Reverse, Ain2 will be High and Ain1 will be held Low.
If moving and you want to slow down, you have choices to slow down slowly or quickly.
The control signals are all in the tables on page 8.

http://www.pololu.com/file/0J534/drv8833.pdf

« Last Edit: July 15, 2012, 08:29:57 am by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry but what does "Connect the input signals" mean?

The DRV8833 board has 'input' and 'output' pins. I ment that the 'input' pins should be connected to the Arduino.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, here's what I did that didn't work. Can you tell me exactly which connections I need to make? (ie digital 8 to ain1, etc.)  Here's the code I tried to use. Should this work?
Code:
void setup()
{
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
}

void loop()
{
  digitalWrite(8, LOW);
  digitalWrite(9, HIGH);
}
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you have connected up?
Power to Vin, Gnd?
D8, D9 to Ain1, Ain2?
Motor to Aout1, Aout2?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"Power to Vin, Gnd?"
What's this used for and why is it necessary?
« Last Edit: July 15, 2012, 06:36:22 pm by RobotEsach » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

They are needed for the H-Bridge to control the power to the motors based on the Ain1/Ain2 and Bin1/Bin2 inputs.

I am thinking this project may be beyond your capability at the moment.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...I am thinking this project may be beyond your capability at the moment.

But if you upload a photo (so we can see how it is connected) and if you can get someone to help you, you should be able to make the motor run in both directions.
Logged

Pages: [1]   Go Up
Jump to: