How to power a DC motor with a Dagu Motor Controller using Arduino Mega 2560

Hi Guys,

Here are the items i have:

  • Arduino Mega 2560
  • Dagu Motor Controller 4
  • DC Motor (< 4A)
  • Battery for Arduino (9V)
  • Motor Supply for the motor controller
  • Jumper Wires

I’m in need of some help on how to write a simple code for getting a DC motor to rotate.
It will be connected to the motor controller where the arduino will be sending the signal to the motor controller.

Can i get some advice and help please?

Thanks :slight_smile:

Welcome....

It's quite straightforward actually, once you look at the driver board doc here. (You have looked, haven't you? :slight_smile: )

All you need to do to get the motor running is provide a "high" to one of the board's PWM pins, and a "high" or a "low" to the direction pin depending on which way you want to turn. You can vary the motor speed by using what's known as PWM on that pin, where 0 will be stopped, 255 will be full speed and 1-254 some other speed.

If you've worked through the tutorials here, you'll know how to do the above. If you haven't, I'd urge you to do so. This one blinks an LED: that shows how to switch pins high or low. This one fades an LED with PWM, which is what you will want to do to to vary your motor speed.

Hi JimboZA,

Thanks for the advice and help :slight_smile: