Controlling a DC motor with arduino UNO + driver

Hi everyone, I'm using arduino UNO, an H-bridge driver and a 24V DC motor. At the moment my arduino is sending a PWM signal with a 19Khz frequency more or less.

1 - My first question is, can I send the arduino output signal directly to 1 of the 2 pwm pins of the driver? I can't find the driver datasheet, but through this link: http://www.arduinothaishop.com/productdetail.html?id=6063 it seems the driver has 6 pins that communicate with the microcontroller (arduino UNO). The PWM pins are PL and PR ( CW and CCW ); I think EN it's a pin that is used to "activate" the driver (I just have to declare it in my code); and I believe US and IS are just to observe the signals on a scope..

2 - My second question is, since I'm using a powerful motor do I need something to protect my driver (diode?) every time I want to change the speed of the motor? http://www.batteryspace.com/dc-motor-heavy-duty-24v-dc-motor-750w-2600rpm-28a-rate.aspx To begin I want to start with something simple, so I'm not even thinking about changing the direction.

3 - Even though I'm going to use the motor with no-load (at least for now..), if I use 2x12V batteries in series, will they give enough voltage and current to the driver in order to the motor move in one direction? The specifications say that in no load condition, the output current = 1.5A.

Thanks in advanced!

  1. Yes. You need to drive one of the PL and PR pins low, apply PWM to the other, and set the EN pin high. The US and IS outputs provide a means for the Arduino to monitor the motor supply voltage and motor current.

  2. No, the driver uses a mosfet H-bridge and the mosfet body diodes provide protection against back emf. In normal use, the body diodes probably won't even be called upon to conduct, unless you remove the EN signal while the motor is running.

  3. That depends on what sort of 12V batteries they are.

Thanks dc42!

  1. No, the driver uses a mosfet H-bridge and the mosfet body diodes provide protection against back emf. In normal use, the body diodes probably won't even be called upon to conduct, unless you remove the EN signal while the motor is running.

That's good news! I didn't want to burn the driver, by accidentally changing the direction.

  1. That depends on what sort of 12V batteries they are.

I have lead-acid batteries. Are they good for this application and supply enough current (at least 1.5A)? The link says the driver has an operating voltage= 15 ~ 24V.

Lead-acid batteries are generally good for high currents, so they should be suitable. Two in series gives you 24V, which is just within the rating of your driver. Don't charge them while they are connected to your driver, because the voltage of a 12V lead acid battery is around 13.5V when on charge.

The motor moved, but with almost no speed..

First I tried the motor only with 1 battery, and the multimeter showed almost 1A. After that, I tried with 2 batteries in series, and the current the motor was using was 1.6A more or less. It was a good surprise, because I wasn't expecting such speed and strength.

However, when I assembled the arduino Uno (sending the 19Khz pwm signal), the driver, 2x12V batteries and the motor; nothing happened.. But even more strange, when I used only 1 battery (12V) the motor moved with duty cycles higher than 50%, but with less speed than before (btw the current was 0.3A).

  • Do you think the problem is related with the driver?
  • If the driver has an operating voltage=15~24V, how is it possible that the motor moved with 12V, but not with 24V?

I suspect a problem with the wiring. Can you post a photo of the setup with the Arduino, driver, motor and 2 batteries?

Sure! I hope you’ll understand.

1 - The first photo it’s just arduino UNO. The analog inputs I’m using are connected to a controller in order to adjust the duty cycle.

2 - The second photo shows the driver. The 2 pins I’m not using are US and IS.
EN → pin8; PR → pin9 (High); PL → pin10 (Low); Vcc → 5V; GND → GND

3 - The third photo shows the 2 batteries in series and the motor.

Previously I said that the pwm signal that is coming out from pin9 has almost 19Khz, but how about the current value? Arduino Uno DC Current per I/O Pin = 40mA, is that important or related for proper functioning of the driver?

Unfortunately I can't tell anything from the wiring photos, other than that the negative connection to the large battery doesn't look solid. I suggest you get another large alligator clip for it.

The 40mA Arduino output pin rating is the maximum that it is safe to draw from the pin. Your driver board will draw much less than that, so it is safe.

The problem was related with the driver. The operating voltage is 12V, and not 15~24V like the seller mentioned…

Fortunately I had another driver, and now the motor is moving at the right speed and direction :slight_smile:
Now I have to think what I will do next.
Thanks for your help dc42!