I'm using an arduino leonardo and am wanting to drive a pair of 12v DC motors (RS 550) connected in parallel for a kids power wheels that I have. I am using an 18v battery to drive them. I know... before you ask - it's over driving them but for now I plan to drive them at 50% duty cycle.
So the issue I'm having is that when I hook it all up and set PWM to 100%, it's really weak and not drawing nearly enough power. Eg - the car barely goes up a small hill, and it's only drawing about 4 amp (checked with multimeter).
If I plug the motors directly to the battery, bypassing the driver and arduino, it's super powerful. I can't stop it at all with force. But when it's connected through the driver, it's way too weak. So that indicates it's not a battery or motor issue. I'm using thick cables (12awg) between the motors, battery and driver. I have hooked it up exactly as shown in the document I linked above (minus the pot - for testing I'm just setting PWM to 100%). The arduino is powered by just the standard 9v battery. Voltage is 18v across the driver terminals. I've got four of these drivers as spares and they all do the same thing. I've seen other people use these exact same drivers for their power wheels and I'm pretty sure they wouldn't be as weak as this, so I must be doing something wrong.
and that's it. Pretty simple really. It does make a whinning noise but I'm pretty sure that's to do with the timers and because it's being driven at a lower frequency, but I don't think that's relevant here. I think increasing the frequency will remove the noise but if anything make it even slightly less powerful.
Any ideas? I could have sworn it was working at some stage... when I first did this, I burnt the motors out which indicated it worked fine. Since then though I'm not having much luck. I've changed motors/battery/arduino/drivers - nothing has made a difference. Thanks for any advice.
Try checking the following statements from Arduino Reference.
You do not need to call pinMode() to set the pin as an output before calling analogWrite().
The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs.
Although the second statement should have the opposite effect.
Nope no breadboard at all in between. The exact wiring is:
Positive of two motors => motor positive in on the driver (12awg wire)
Negative of two motors => motor negative in on the driver (12awg wire)
Battery positive => battery positive in on the driver (12awg wire)
Battery negative => battery negative in on the driver (12awg wire)
Arduino ground => ground on driver
Arduino 5v => split in three wires to go to driver VCC/L_EN/R_EN
Arduion pins 5 & 6 => driver LPWM and RPWM
and that's it. The only thing I find strange is that if I disconnect for example the R_EN pin on the driver, then RPWM doesn't work (as expected) but neither does LPWM. I thought that's a bit strange as I would have thought the R_EN would only affect RPWM, but it seems to affect both.
Yes, there it is. The picture is cut off in forum but expanding it in Google it shows up.
The second line is +5 volt, likely needed!
So, back on square one. I'll check again when comung home to the Pc.
You have not declared pwmBackwardsPin as output, in setup.
Also, use the link You supplied! Get down some 5-6 pages! The driver pins are explained and even code examples are given.
Hmmm yes you are right... actually I'm not defining pwmBackwardsPin as output, only because I was just getting a minimal code project happening, so I was only using pwmForwardsPin for now. But I suppose that could cause issues, as I'm setting pwmBackwardsPin to 0 however that's probably having no effect, as pwmBackwardsPin is not defined as OUTPUT.
Hopefully that's all the issue is... I'll test it tomorrow morning when I wake up. Thanks for you replies.
Hi,
Because you have not defined pwmBackwardsPin as anything, it is an open circuit pin, it does not output a 0 or LOW or 1 or HIGH.
You need to define it.