Go Down

Topic: How do I use this motor with my Arduino? (Read 3172 times) previous topic - next topic

RobotEsach

Jul 13, 2012, 11:29 pm Last Edit: Jul 13, 2012, 11:49 pm by RobotEsach Reason: 1
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!  :)

Krodal

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.

RobotEsach

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

CrossRoads

#3
Jul 15, 2012, 07:08 am Last Edit: Jul 15, 2012, 03:29 pm by CrossRoads Reason: 1
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

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Krodal


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.

RobotEsach

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: [Select]

void setup()
{
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
}

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

CrossRoads

What do you have connected up?
Power to Vin, Gnd?
D8, D9 to Ain1, Ain2?
Motor to Aout1, Aout2?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

RobotEsach

#7
Jul 16, 2012, 01:32 am Last Edit: Jul 16, 2012, 01:36 am by RobotEsach Reason: 1
"Power to Vin, Gnd?"
What's this used for and why is it necessary?

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Krodal


...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.

Go Up