How to control a 12V Dc motor with Simple-H motor driver?

Hi, i'm looking to build a one wheel autobalanced skateboard,
i'm actually at the point where i need to control my motor :
i have this one Account Suspended
and this driver http://www.robotshop.com/productinfo.aspx?pc=RB-Rop-05&lang=en-US
and a 12V 8 A generator (i'll make it run on a 20A battery later)

So, i've done this with servomotor but not with dc brushed motor before.

What are the commands, how am i doing this ?
I've seen a lot of tutorials but not especially with this driver so i don't really know which to follow and what to do :confused:

You probably know this better than i do so if you good me tips or a great complete tutorial, that would be very cool :smiley:

Thanks for your help already. :slight_smile:

That is not a matching set.

The motor has 50A peak current (I assume that is the stallcurrent).
I don't know if that is at 12V or at 24V.

The motor driver is for 20 or 25A.
Under the tab "Usefull links" are the schematics and so.
They usually have input pins for Enable, PWM, and Direction. One output pin of the Arduino for the direction, and one for the PWM signal for the speed.

But in the manual user from the driver it says it's ok for 45A peak ? So i assume it is fine, isn't it ?

Also, i've seen the schematics but it was more about the arduino code, does the code depend on the driver you're using or is it the same for every dc motor ?

If you already have the equipment, then use it. I can't see a "one wheel auto balanced skateboard" actually spending much time under stall conditions.

does the code depend on the driver you're using or is it the same for every dc motor

Well I suppose one could say that "in principal" the coding would be the same yes, but there will be specifics.

Look at part 3 of the User Manual: if you need direction control I think you'll need to hook it up like the H-bridge in the left hand picture. Looks like that needs 3 controls from Arduino: one line to the Enable (EA) pin and two PWM to PA and PB.

Somewhere you'll need to have a common ground between Arduino and that board.

Your coding would be to set the Arduino pin that goes to the EA pin high with a digitalWrite to enable the motor. Then PWM one of the PA or PB pins with an analogWrite with a value from 0-255 depending on speed required, and (I think...) the other PB or PA pin send low with either a digitalWrite low or an analogWrite with a value of 0. Reverse that thinking for the other direction.

This tutorial shows how to fade an LED using PWM, which is exactly the same as PWM-ing that motor control pin.

E&OE, YMMV.

There is lots or red text in that manual, and a heap of warnings.... best you read it carefully!

I would like to know if the stall current is at 12V or 24V. If you hit a sidewalk, the motor driver could be blown.
The motor driver has a current sensor. You can use the Arduino to log the maximum current. For serious use, the motor driver should be able to supply the stall current.

Thanks for you answers.

JimboZA : I've been reading all this right now, you are right about the fact that i should care :slight_smile:
About the command, i agree with you, it seems to be like that but i have a few questions

-What do you mean by a common ground beetween arduino and that board and why is it needed?
(Maybe i didnt understand something, english not my native langage i've maybe read something wrong :/)

-What are the CN1 + and - inputs for ? i don't really understand since the battery i'll be using will be on B+ and B- ? Is it for the 5V Arduino output and it's ground ?

I'll be reading carefully this tutorial, thanks a lot !!!! :slight_smile:

Erdin : I have no more informations than this Account Suspended . But since the motor peak is to 50A and the driver 45A, is it a real problem ?

About the current sensor, it gives me a voltage that i can read with arduino and so have the A since it is "0.0745V per Amp - 2.98V at 40A" ? And you are telling me that i could tell the driver not to go over 45 A ? Is it what you are saying ?

Thanks :slight_smile:

-What do you mean by a common ground beetween arduino and that board and why is it needed?
(Maybe i didnt understand something, english not my native langage i've maybe read something wrong :/)

You'll be applying 5V from the Arduino to a few pins on the motor driver board. But "5V" only has meaning when it's measured against something. The Arduino "knows" it's 5V because it's measuring it against its own 0V..... but if you just apply the other end of the wire to the motor board, the motor board doesn't "know" since it's got no 0V to measure it against. So you need to join the Arduino ground to a ground on the motor board, then that board will see 5V on that wire since it has the same 0V as Arduino.

-What are the CN1 + and - inputs for ? i don't really understand since the battery i'll be using will be on B+ and B- ? Is it for the 5V Arduino output and it's ground ?

I haven't looked at that, sorry.

Alright so the CN1 + and - are for the 5V And - the is for the ground. I didnt understand you that way, sorry .

But since the motor peak is to 50A and the driver 45A, is it a real problem ?

To me it is. Can you measure the stall current yourself ? To get a real indication ?

since it is "0.0745V per Amp - 2.98V at 40A" ? And you are telling me that i could tell the driver not to go over 45 A ? Is it what you are saying ?

About 3V for 40A. You can read that with an analog input of the Arduino.
Is someone standing one the skateboard ? Switching of the power would lead to serious injury. That is why I wrote to log the current. So you have an indication afterwards.

Hi guys, i have some solar panels which are hooked up to 2 x 12v batteries in series powering (and storing energy for) a servomotor to turn a roller with posters on it at around 190rpm until a photosensor picks up the next poster and it stops. it does this 5 times (for the six posters), then it does the same thing only in reverse. Im going be using a ATmega328 micro. I also am going to monitor the battery voltage and current with a chip to let the user know when the voltage/current is running too high/low. A simple LED or buzzer function will suffice if the voltage/current gets too great or too low. I know its a bit presumptuous but code someone give me code for such an operation I'd be hugely grateful. Any questions you have will be answered asap. I've a deadline coming up too so I'd really like something quick sharp. mixthetricks2010@gmail.com for questions and possible code. Thanks and hope to hear from the all knowing arduino heads very shortly.

You're cross posting in someone else's thread - double fail.

Sorry guys, totally didnt mean to but in. I've read the etiquette rules and that. Wont happen again. Just that i need some code for Monday and thought I'd post it up twice but totally understand its crazy carry on. Sorry anyway. Maybe you MIGHT be still willing to help me with the bones of the code on the other thread ---> if not, no hard feelings. We all have to start somewhere :slight_smile: http://arduino.cc/forum/index.php/topic,163937.0.html