Let's Make Robots!

Arduino + Servo + 2 motor driviers = error !

Hello guys ,
so iam new here hope its the right place and im sorry my 1st post is a question  as its my 1st project :D  

ok im doing a project of a robot driven by man with grippers

so basments needs 2 big motors i use for them those drivers


and one servo motor to hold thins (as a gripper )

and a ps controller using billporter library
im using software servo library

so if i dont power the motor drivers i can control the Servo normally

but once i power the drivers it doesnot respond to me 

and maybe makes sound as if it needs to move ! ! 

i power servo using a powerregulator comes from 12v battery which also powers the Arduino 

this battery in series with another 12v battery powers the motor drivers 

all grounds are connected together  

so what do you think ?? 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I do not know why you linked to the old software servo library, all versions of Arduino since 0018 have the servo library built in. If you read here: http://www.arduino.cc/en/Reference/Servo you will see that using the servo library disables PWM on pins D9 & D10. This is because they use the same internal timer.

The PWM outputs on pins 5 and 6 share a timer with timing functions such as millis() and delay() run at about 976Hz while PWM outputs on pins 3,9,10 and 11 run at about 488Hz.

are you runing PMW to the motor driver or are you using the internial PMW of the motor driver?

i not shour of the Arduino's PWM frequency but your driver is rated to a max of 10khz also the min PMW voltage that it will respond to is 1V or analogwrite 51 and max is 3.25V or analogwright 166 if i understand the Electrical Characteristics correctly and how they relate to PMW

ok so i goggled it

the base frequency for pins 5 and 6 is 62500 Hz

3, 9, 10, and 11 is 31250HZ

this is way to fast for your driver fix it with this command (    setPwmFrequency(6, 1);  ) 6 is the pin and 1 is the division of base frequency. link = more info on setting frequency   



Those are the base frequencies before being divided Chuck. I have measured the PWM frewquencies before with a digital oscilloscope. They are about 1KHz on pins 5&6 and 500Hz on the rest.

Do not change the PWM frequencies as they will affect a lot of your timing functions and then the rest of your code will not work properly including the servo command.

for the correction :D

did this help ?

I think Chuck brought up a very important point in the shoutbox with regard to using a servo and pwm on the arduino. Can you try a digital write to the motor driver instead of pwm and see if your servo still works and you have supply at your motor outputs.

Also are you feeding Vcc on motor driver with 5-12v?

It might help if you posted a clear picture of your setup(one in which we can see where all wires start and finish) and the code you are using

JUST powered 

The servo stops working when the drive motors are powered or running?