Problems with Pololu 18v25 CS High Power Motor Driver

Hiya,

I have been having issues running a 12v DC motor with an arduino Mega 2560 and a Pololu 18v25 CS motor.

The motor is connected into the OUTA and OUTB of the Pololu. The V+ and GND on the logic side of the board are connected to the corresponding ports in the arduino. The other pins connected to the arduino are PWMH, PWML, and DIR. According to the pololu page on the motor driver, PWMH should be sent the duty cycle and driven high, PWML should be driven high for forward/reverse motions, and DIR written high or low to switch the current in the motor and thus change directions. The arduino is powered through a seperate variable power supply.

The code seemed relatively simple/straightforward.

Here is an example code I threw together that should provide the general idea. The end goal of my current project involves seven motors driven through pololu 18v25 CS motor drivers (Considering switching to 18v15) and a pneumatics system. I had to take a step back after problems arose in the larger setup.

#include <arduino.h>

const int pwmh=3;
const int pwml=4;
const int dir =5;

void setup()
{
pinMode (pwmh, OUTPUT); //Setting pins
pinMode (pwml, OUTPUT);
pinMode (dir, OUTPUT);

digitalWrite (pwml, HIGH); //Writing pwml high. Shouldnt need to change

delay(5000); //adds 5 seconds before the initial write
}

void loop()
{
analogWrite (pwmh, 255);

digitalWrite (dir, HIGH);
delay(3000);
digitalWrite (dir, LOW);
delay(3000);

}

I have tried using the millis() command in replacement of delay with no success.

In regards to the code, I interpret this as running at full duty cycle in one direction for 3 seconds before switching directions and still sending the motor a 100% duty cycle. Another variation upon this was switching between a 0% and 100% duty cycle with no success.

Instead of doing the above, the motor will generally run for 5-10 seconds in one direction, do a short stop and reverse and then immediately return to the original direction and continue running for a long period. The periods of time and stops/reverses seem completely random.

I have not tried any duty cycles other than 0 and 100% as an attempt to remove any pwm interference from the testing. Also, according to the timer table for the mega, the pwm pins should be on their own timers (timer 0 I believe). If my thinking is correct, this would remove any problems with pwm interfering with the delay.

That completes the first problem. (Unable to control the speed and direction of motor).

The second problem involves uploading to the arduino with the motor driver connected and the motor is running. This is the reason the 5 second delay was added into the setup of the above code. Both the TX and RX light turn on and stay on if I try to upload to the arduino while the motor is running. If I remove the motor driver or upload in the 5 second delay, there is no problem uploading to the motor.

The third problem involves integrating an OLED screen with the motor driver into the setup. I am using the Sparkfun Microview OLED breakout board in SPI. I can include a sample code if necessary, but I am just using the library provided by Microview. I have not had problems with the screen in the past and have used it in several projects before this. Also, I have tried using a new microview breakout with the same problem occuring. I have not trying running the breakout in I2C. The actual problem arising in the setup is the OLED outputting the correct information for a few moments before either turning off or displaying random pixels.

Finally, the last problem, and most annoying problem. I have burned out two Mega 2560s while using the motor driver. If I try and attach a 12v power supply into the GND and V+ on the motor side of the pololu 18v25 CS, the board will immediately burn out upon turning the supply on. The first time this happened, it actually caused a surge in my laptop and caused the battery to expand (Unfortunately, no exploding batteries. How fun would that be?). The second time I was powering the arduino externally rather than through the USB. Same problem arose and again I saw the sad puff of smoke that was the mega.

I have been trying to troubleshoot the problem for the past week with no success, so any help/advice anyone could offer would be awesome! If you need any questions answered to provide help, please let me know.

I will be trying a new 18v25 cs motor driver in the case that the problem is in the driver itself. Also, as mentioned above, I will be trying an 18v15 motor driver as well to see if I am setting up the 18v25CS wrong.

It sounds like you have connected 12V to the Arduino's 5V pin. That will smoke it for sure. It should not affect the computer, so perhaps you have another fault. Check your wiring again.

With that serious of a fault, I suspect that your code is not running at all and the behavious you observed is from other components on the Mega cooking off.

The V+ on the motor side of the board was connected to the external power supply, the V+ on the logic was connected to the arduino.

Should I instead from the arduino, wire to the 5V pin?

Thanks for the reply!

Seems that was the issue. Swapped from the V+ to 5V and everything is working as intended.

I feel my palm slowly approaching my face. Didnt even think to check the wiring there

Slapping foreheads since 1973!

I think I've had a few examples where I was going to post here about a problem and as I'm looking at the photo I made or the schematic, I see the problem that I couldn't see on the actual project.

It appears that you should not connect any 5V from the arduino to the motor driver board at all. Just the ground and the three signal wires.

The motor driver board makes it's own 5V supply, by regulator from the motor power supply.

I bet a lot of people have made that mistake.

The moral is use a multimeter to check voltages before connecting anything
to the Arduino.

Unless everything you are playing with is 5V, you must absolutely double check that
high voltages cannot get to the logic stuff, its a very expensive mistake.

And always use a powered USB hub when playing with external high voltages, otherwise
you place your computer or laptop in the firing line.

A better approach is power down the high voltages to connect USB and program the Arduino,
then disconnect the computer and reconnect the high voltages. That way you cannot
fry your expensive computer hardware...

Another trick is to unplug the laptop from the wall and run on the battery, in case you suspect high voltages between the USB and earth. Not a good method to rely on long-term, but it's OK for testing.