Pages: [1] 2   Go Down
Author Topic: Motor controller h bridge advice  (Read 2225 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have two motors, not brushless, that pull 7.5amps each at stall.
I want to use them for tank style steering and drive.
I have my inputsheild with joystick connected to Uno and can make a circle of LEDs. but i digress..

My reading leads me a few different motor sheilds/pcbs in the $40-$120 range.  I really thought this could be done cheaper as a h-bridge chip like the L298n is only a few bucks at sparkfun.  Unfortunatly the 1 or 2 amp rating wont cut it.  So I found this:
http://www.pololu.com/catalog/product/707/specs
but it seems to use only PWM as input.  I'm not comfortable with that yet so would like to stick with analog input.  I understand 0-1023.
http://www.pololu.com/catalog/product/777
does everything which may be nice for other things in the future but at $100 it stings.
Then there is this:
http://www.pololu.com/catalog/product/1376
it has a USB port to monitor and config wich actually seems like another step of complexity i dont want.  but its cheaper.

I guess I could post links all day but what I'm really asking is what motor controller should I buy  to simply control 2 motors and control speed and direction of each smiley-wink

thanks for any help, im just getting into motors and servos.
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 2280
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I found this:
http://www.pololu.com/catalog/product/707/specs
but it seems to use only PWM as input.  I'm not comfortable with that yet so would like to stick with analog input.  I understand 0-1023.

Any chance we could get your over that fear? We'll be your support group. It'll be like going to an AA meeting smiley



To control the board you have four main pins. Looking at just the first driver:

1EN : Setting it high powers up the driver and low disables the driver. If you were going to implement a kill switch you would do that here.
1INa / 1INb : When INa is high and INb low, the motor will be set to turn in one direction, and when INa is low and INb is high it will be set to turn the other direction. Setting both high locks the motor and makes it resistant to turning, and setting both low allows the motor to freewheel. 
1PWM: when you analogWrite(pwmPin, 0) the motor is stopped, and analogWrite(pwmPin, 255) the motor is full power. Selecting a value between 0 and 255 is a partial power; 64 would be 1/4 power, 128 would be 1/2 power, etc. "pwmPin" is any of the PWM pins on the Arduino: 3, 5, 6, 9, 10 or 11.

Does this seem straightforward?
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

lol well I used prison when I kicked.  Meetings never did it for me.   heh.

Hmm you do make it seem simple.  For some reason I had in my head there were only 2 pwm pins which also shyed me away.

This is one of the cheaper ones as well so maybe ill give it a shot.
thanks for the kick.

So if I have this right:
to go forward full speed you would

killswitch = 1
leftspeed = 3
rightspeed = 5
frontbackleft= 2
frontbackright = 4

killswitch(high)
leftspeed(255)
rightspeed(255)
frontbackleft(low)
frontbackright(low)


to go left slow
killswitch(high)
leftspeed(90)
rightspeed(200)
frontbackleft(low)
frontbackright(low)

to do a spin to the left

killswitch(high)
leftspeed(255)
rightspeed(255)
frontbackleft(high)
frontbackright(low)


my input board uses 4,5,6,7 and analog 4,5 so looks like I have enough pins to do what i need for now.  smiley
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 2280
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I should have explained more clearly that each motor has its own set of 4 pins to control it. 1EN, 1INa/1INb, and 1PWM control one motor, and 2EN, 2INa/2INb, and 2PWM control the second motor.

Ignoring the 1EN and 2EN pins (which always must be high to turn both sides of the thing "on"), for forward it would be
1INa = high
1INb = low
1PWM = 255
2INa = high
2INb = low
2PWM = 255

Right spin:
1INa = high
1INb = low
1PWM = 255
2INa = low
2INb = high
2PWM = 255

etc.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

got it.  thanks.
Before I make my order are there any other parts that need to be between the controller and the arduino? Or controller and motor?  diodes etc?  I keep seeing shotkey (sp?) diodes mentioned in posts about motor controllers.
I hate paying for shipping 3 times because I cant get my orders right smiley-wink
Logged

Greater Boston, MA, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Greetings all,

Taking a quick look at the datasheet for the main chip on the "Dual VNH3SP30 Motor Driver Carrier MD03A" (specifically the block diagram), I don't see on-chip protection diodes.  (Some MOSFETs come with protection diodes; I didn't check their datasheets.)  Each MOSFET needs a diode to protect it from voltage spikes that are caused by abruptly turning off current through an inductive load, like a motor.  I suggest emailing Pololu and asking whether this board has protection diodes on all the outputs.  (I'd hope they included the diodes, especially since the product is intended for motor control, but I didn't see anything about protection in the online info.)

Shottkey diodes are not IMHO required to protect MOSFETs from motors, but you do need diodes that can handle at least the peak current involved and at least 400 PIV. 1000 (peak inverse) volts would be better.  I think 1N4007s would be fine, or you could get diodes with even higher current ratings.  FYI digikey.com part# 1N4007DICT-ND, $0.013 single quantity, less if you buy 10 or more.  These are very handy.  Adding them won't hurt, but no protection diodes would probably mean a dead motor controller sooner rather than later.
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 2280
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...the datasheet for the main chip on the "Dual VNH3SP30 Motor Driver Carrier MD03A" (specifically the block diagram), I don't see on-chip protection diodes.

This is represented by "Clamp A" and "Clamp B" in the block diagram, isn't it?
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i emailed polulu for clarification.  we'll see what they say.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

quick reply from pololu

Thank you for your interest in our motor driver carrier. Additional protection diodes are not necessary, so our carrier board does not add any to the VNH3SP30's outputs. The driver's H-bridge uses MOSFETs, which have body diodes that provide the flyback protection.  These diodes are shown in the schematic diagram on page 7 of the datasheet.  The datasheet can be found on the product page under the resources tab:

http://www.pololu.com/catalog/product/707/resources

If you have any additional questions about our products, please let me know.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The driver's H-bridge uses MOSFETs, which have body diodes that provide the flyback protection.

Just to clarify:

A single mosfet driving a motor or other highly inductive load DOES need a flyback diode, because the mosfet body diode is not in the right place. However, when a motor is driven from a mosfet H-bridge, then when one mosfet turns off, the body diode of the other mosfet in the same half H-bridge is in the correct position to act as a flyback diode. So additional flyback diodes are not needed when using mosfet H-bridges to drive inductive loads. HOWEVER, the back emf from the motor gets dumped to the H-bridge supply through the body diodes. So you need a large capacitor across the motor supply input to the H-bridge to absorb this. Commercial H-bridge boards normally have a capacitor on-board, but you may need to add a larger one.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Online Online
Shannon Member
****
Karma: 162
Posts: 10523
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Greetings all,

Taking a quick look at the datasheet for the main chip on the "Dual VNH3SP30 Motor Driver Carrier MD03A" (specifically the block diagram), I don't see on-chip protection diodes.  (Some MOSFETs come with protection diodes; I didn't check their datasheets.)

All _power_ MOSFETs have integral body diodes, its physically part of the structure of the FET, so they never need external diodes (in an H-bridge or half-H-bridge) - you can add schottky diodes to reduce the amount of heat generated though as the forward voltage is 0.4V instead of 1.2V or so.
« Last Edit: July 12, 2012, 05:10:35 am by MarkT » Logged

[ I won't respond to messages, use the forum please ]

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I finally got around to soldering the board together.  Before I blow it up just want to verify that this guys picture is correct.  Ill test without a motor first.


http://forum.pololu.com/viewtopic.php?t=2116
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 2280
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes the scheme is correct.

The thread you have linked has a Pololu employee replying, so you can be pretty certain it is.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried with and without the EN1.  Does nothing.  no leds light up on the controller.   Going to tinker some more this evening.  I suppose it could be  my crappy solders, which will be the theme of another post.
Code:
int InA1 = 8;
int InB1 = 9;
int EN1 = 10;
int PWM1 = 3;  //PWM1 connects to pin 3
int PWM1_val = 127; //(25% = 64; 50% = 127; 75% = 191; 100% = 255)

void setup() {
  Serial.begin(9600);
  pinMode(InA1, OUTPUT);
  pinMode(InB1, OUTPUT);
  pinMode(EN1, OUTPUT);
  pinMode(PWM1, OUTPUT);
}

void loop() {
    digitalWrite(InA1, HIGH);
    digitalWrite(InB1, LOW);
     digitalWrite(EN1, HIGH);
    analogWrite(PWM1, PWM1_val);
   
}
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

got it.  the motor side has to have a separate input.  I was trying to cheat and use the arduinos 5v to power both sides of the board since im just testing with a tiny motor.  Plugged a wall wart into the motor side and its all working now.
Thanks!!!
Logged

Pages: [1] 2   Go Up
Jump to: