Arduino Mega 2560 + Dagu 4 Motor Controller

setup1.jpg (317212Bytes)
setup2.jpg (428338Bytes)

I am currently working on a line following car project.

I am quite new to electronics and it would be no surprise if I miss something basic in the theory side.

I am trying to control 4 motors using my Dagu 4 channel motor controller and Arudino Mega 2560. I am having power problems and after researching and some testing, I am quite clueless about what exaclty is wrong.

I have programmed the arduino mega to set the direction pin to HIGH and the PWM pin to 255. I have 2 setups for testing.

NOTE: I FORGOT to add the motors to the circuit diagram, I am using brushed MM18 (size 260) motors (I am only controlling one motor for this experiment), their nominal voltage is less than 6V but I've ran them at 9.6v (which obviously shortens their lifetime)

 

Setup 1 (the ideal setup), both boards are powered from one battery:

FINDINGS

-powering just the arduino mega 2560 alone (nothing connected to it at all) and the board gets quite hot around the USB port area

-eventually after connecting the dagu motor controller and turning on the arudino and then the dagu motor controller, the arduino's 5V voltage regulator died.

-Leads me to think that my battery is too powerful? (It did say in the manual to use for RC applications only, although I've seen other people use NiMH batteries and I thought that a device would only draw as much current as it needs. Maybe it's to do with the regulator not coping with the battery?).

Anyways....

 

Setup 2 (because the arduino 5v regulator got fried from setup 1) Arduino is powered through USB, and the 9.6v NiMH only powers the dagu motor controller's external power supply connections:

The process is that I would power the arduino and then the dagu motor contorller's logic. Then plug power to the dagu controller's external power supply pins.

FINDINGS:

-I tried running all 4 motors and it took 2 seconds before one of the motors started moving slowly... when it did one of the dagu controller's chips started smoking

-now, I am only trying to ruen one motor: the motor would run for a few seconds, the motor would stop and one of the chips on the board starts smoking. I've repeated this step a few times and the chip smokes everytime.

-When I set the arduino's PWM output to 10 (arduino accepts 0-255), I hear a high pitch noise from hear motor.

-I changed the Dagu controller's external power supply to 6AA alkaline batteries, I ran the motors for quite a while (liek 10 seconds) and no smoke, but that same chip was getting very hot.

 

Here's the code, just incase the program might have errors:

//*********NOTE******** KEEP motor naming in this order for everything

//rear right motor [1]

#define dirMotRR 22

#define pwmMotRR 4

//rear left motor [2]

#define dirMotRL 24

#define pwmMotRL 5

//front right motor [3]

#define dirMotFR 26

#define pwmMotFR 6

//front left motor [4]

#define dirMotFL 28

#define pwmMotFL 7

 

void setup() {

//setup motor pins

pinMode(dirMotRR, OUTPUT);

pinMode(dirMotRL, OUTPUT);

pinMode(dirMotFR, OUTPUT);

pinMode(dirMotFL, OUTPUT);

 

}

 

void loop() {

digitalWrite(dirMotFL, 1);

analogWrite(pwmMotFL, 255);

}

 

I have bought another Dagu 4 motor controller and am hoping I dont fry this one.

Any help would be greatly appreciated!

**Thanks for replies :smiley:

Both**
Thanks for replies :smiley:

Both my arduino mega 2560’s (i have 2) cant be powered from Vin and Gnd at the moment as i believe the 5V regulator fried. Im currently waiting for the replacement regulator to arrive. So i wont be able to show a picture just yet :frowning:

Although (these were my findings before i bought the controller, these findings apply to both arduino megas i have),
-even after plugging battery itself to arduino the board light still goes on and stuff.
-it gets increasingly hot when i added other components like LCD, pot, buttons etc…
-so i used 220ohm resistor between batteries + and the Vin and arduino mega didnt heat up… Which lead me to think the issue was current? Im not too sure…

Also, i did tried plugging the battery to my arduino uno and it was perfectly fine lol, im going to try my tests with the uno and see if theres differences/similarities

But ill send a pic as soon as I can

Thanks!

Is my wiring plan correct?
also, just wanted to check - is my setups correct?
Thanks

I Bought a new dagu 4

I Bought a new dagu 4 channel motor  controller and it arrived today. Did some testing using setup 2 (mentioned on my first post, external power to motor controller and USB to power arduino mega 2560, which powers dagu motor controller’s logic), except I did NOT attach anything to the GND pins for each channel (there are GND pins next to the direction and pwm pins of every motor’s control channel). Also, on my code, I declared the PWM pins as OUTPUT (because before I didnt). With all this, I was able to control 4 motors! woohoo!

I even tried the same thing on my previous dagu motor controller (the broken one that kept smoking)… and guess what? the motors were running for a while and no smoke or heat came out! Although, the wrong motors were spinning which isnt surprising as I already broke the board anyways…

When the 5v regulator replacement arrives, I will first try to figure out why the arduino mega heats up when I plug the 9.6v NiMH, I’ll send a picture as well.

I found this image of how someone powered their arduino and motor contorller from one power source:

http://www.dcsc.tudelft.nl/~mforgione/rover5/img/rover5_uno.pdf

I guess the main difference is that… the power source is only connected to the Vin pin of the arduino, not to GND as well (unlike my setup 1) - I don’t know why though.

Your first setup looks OK as
Your first setup looks OK as far as the battery is concerned.

However, I would suggest trying the Arduino board alone and running an LED with the PWM. If it heats up, it’s a very good indicator that something is wrong.

What is the voltage on the batteries when they are fully charged? I believe its over 10 volts. That means for every amp taken through the regulator, another amp is wasted as heat, if the regulator is a linear regulator.

Unfortunately I don’t know anything about the Dagu controller so I can’t help you except in generalities and There are people here that actually know a lot about this particular board. I would make sure that you have read the manual completely.

Hey Guys, Thanks for the

Hey Guys,

 

Thanks for the replies! I’ve replaced the 5V regulator on my arduino mega 2560 (Genuine) with an L1117 S50TR.

I can now power the mega through the Vin (and obviously the GND pin) pin! Woohoo.

 

However, the I am still getting the exact same “problem”. Using setup 1, I power the Arduino Mega 2560 by itself with 2x 4.8v NiMH 2100maH in series = 9.6v (although voltmeter reads 10.5v - it’s a new NiMH battery, only been chagred twice lol)

The arduino mega 2560 would slowly get quite hot/ very warm, around the voltage regulator area (not so hot that I would burn my hand though). I will use a voltmeter and try to figure out any weird connections. However, the same thing happened on my other arduino Mega 2560. Also, I tried powering it with my 12V unregulated wall adapter (max 300ma) and I get the same results. The only way to stop it from heating up was to use a lower voltage.

my plan now:

-check for dodgy connections.

-send the power source through lm317 voltage regulator (at around 6-7v). Ill plug in some stuff to increase current draw and see the effects.

 

I will try to attach the picture. I for some reason the image isn’t uploading to the image/file browser

Also, I forgot to say, on

Also, I forgot to say, on SparkFun I was reading this:

https://learn.sparkfun.com/tutorials/what-is-a-circuit

 

one section says:

These things are called loads, because they “load down” the power supply, just like you’re “loaded down” when you’re carrying something. The same way you could be loaded down with too much weight, it’s possible to load down a power supply too much, which will slow down the current flow. But unlike you, it’s also possible to load down a circuit too little - this may let too much current flow (imagine running too fast if you weren’t carrying any weight), which can burn out your parts or even the power supply.”

 

thoguht it might be relevant

I See, Thanks Duane!

I See, Thanks Duane! :smiley:

UPDATE:

I’ve created a variable voltage LM317 adjustable regulator (this tutorial: http://www.instructables.com/id/Variable-DC-Power-Supply-for-15/step2/The-Variable-Voltage-Regulator/). output voltage is around 8-9v

Currently what it looks like is:     

9.6v NiMh ------positive------------->| lm317 regulator   |-------positive(8-9v)—>|Arduino mega 2560 (5v Regulator)|

        |------------------negative------->|                          |-------negative---------->|                                                 |

by the way, I believe I’ve connected the regulator and arduino in parallel right?

 

 

The heat has been reduced a lot, the board still gets warm but not too much, the regulator gets a little warm too. I’ve added some components e.g. sensor board, motor board (only powered logic part), and board seems ok.

 

Also, I tried powering the arduino mega itself straight from 9.6v battery, except this time - I measured the current and I was getting 0.1Amps… so definitely not “too” much current. This lead me to think that maybe its to do with regulating 9.6v (10.5v actually) -----> 5v?

 

Anyways, I will try to attach my circuits together and see if the regulator is fine. Ill try to post pictures… for some reason whenever I try to upload images on thre image browser, it wont upload. (Note: my initial post only describes part of the whole system, the robot I am making uses 9.6v NiMH to power arduino mega, motor controller external supply and a servo (regulated to 6v))