Hi, this may be a similar issue to http://forum.arduino.cc/index.php?topic=381699.0
I'm trying to drive a 6V motor with specs:
.06A no load
.4A max load
2A stall
I've got a 7.2V NiMH RC battery, which starts at 8.5V when fresh, going in to my "power supply" which has a L4940 5V voltage regulator feeding the Arduino (with plenty of capacitors before and after)
I'm using code at the bottom of this post: I'm feeding PWM signals to A1A and B1A for speed, and digitalwrite to A1B and B1B for forward/reverse (inverting PWM value when switching direction)
My plan was to power the motors straight from the 7.2 supply... At 8.5V it is pulling about .09A no load (testing without the 9110 hooked up). The gnd and vcc pings on the 9110 are pretty much straight from the battery, with 1000uF capacitor in there.
POP goes the L9110... hmm maybe I made a mistake soldering my arduino shield... wired directly without a shield POP goes another L9110.
Tried running the motors straight from the arduino 5V pins: that worked fine, but low PWM signal (when i had low speed to 50) wasn't enough to turn motor... squeeked at me... thought to myself "maybe if the PWM signal is too low it's generating extra current which is blowing up the chip when i'm at 8.5V?"... Change my lowest PWM signal to 128 as below. Tried again. Went for longer this time at least! Then POP goes the L9110...
So I'm down to my last L9110 and thought i'd better try find people who know what they're doing (as it would seem I don't ha!)
So my low no load current, at most is 90mA, well below the rated 800mA of the chip... And 8.5V would seem low enough below 12V...That thread I posted at top was talking about the "brake" between PWM signals causing current spikes with each transition?
Can I fix this or should I try to find a more suitable motor driver? I COULD just drive them from 5V i guess... would preferable put another voltage regulator on my power supply to try to keep my motor supply separate from the arduino... But I figured i'd rather go 7.2V straight to motor, over power but reduce through PWM opposed to running at 5V and always under powering the motors...
Thanks for your help, this is my code (modified with thanks to http://www.bajdi.com)
const int AIA = 3; // (pwm)
const int AIB = 7;
const int BIA = 5; // (pwm)
const int BIB = 8;
byte sp1 = 128;
byte sp2 = 196;
byte sp3 = 255;
void setup() {
pinMode(AIA, OUTPUT);
pinMode(AIB, OUTPUT);
pinMode(BIA, OUTPUT);
pinMode(BIB, OUTPUT);
}
void loop() {
forward(sp1);
delay(1000);
forward(sp2);
delay(1000);
forward(sp3);
delay(1000);
backward(sp1);
delay(1000);
backward(sp2);
delay(1000);
backward(sp3);
delay(1000);
left(sp1);
delay(1000);
left(sp2);
delay(1000);
left(sp3);
delay(1000);
right(sp1);
delay(1000);
right(sp2);
delay(1000);
right(sp3);
delay(1000);
}
void backward(byte Speed)
{
stopmotors();
analogWrite(AIA, 255-Speed);
digitalWrite(AIB, HIGH);
analogWrite(BIA, 255-Speed);
digitalWrite(BIB, HIGH);
}
void forward(byte Speed)
{
stopmotors();
analogWrite(AIA, Speed);
digitalWrite(AIB, LOW);
analogWrite(BIA, Speed);
digitalWrite(BIB, LOW);
}
void left(byte Speed)
{
stopmotors();
analogWrite(AIA, 255-Speed);
digitalWrite(AIB, HIGH);
analogWrite(BIA, Speed);
digitalWrite(BIB, LOW);
}
void right(byte Speed)
{
stopmotors();
analogWrite(AIA, Speed);
digitalWrite(AIB, LOW);
analogWrite(BIA, 255-Speed);
digitalWrite(BIB, HIGH);
}
void stopmotors()
{
digitalWrite(AIA, LOW);
digitalWrite(AIB, LOW);
digitalWrite(BIA, LOW);
digitalWrite(BIB, LOW);
delay(1000);
}