Help with PWM for controlling servos and speed con

I am just finishing off a variation of my servo timer library to run up to 32 servos on the mega board: http://arduino.cc/en/Main/ArduinoBoardMega

The mega board has 54 i/o pins and four 16 bit timers so it can easily run 32 servos. The Arduino mega is cheaper than the cost of an SSC-32 and a regular Arduino board.

I will post the new library when I have completed testing.

Yes, the new Mega board is really a exciting board. And very glad to hear that you also finish a servo timer library for it.
Maybe later I will get one mega board, but currently I still want to use a Atmega168 Arduino board with 74HC595 to control servos for Synchronized, or "Group" moves just like the SSC-32.
I tried your ServoTimer2 library, but I feel the servos are not Synchronized, are they?

I tried your ServoTimer2 library, but I feel the servos are not Synchronized, are they?

I implement my servo code to pulse each servo sequentially. I am surprised that you could detect any difference in performance between this and implementations that pulse all the servos at the same time. Is the difference something you have seen yourself or have you read about this somewhere?

Yes, you are right. It seems only microseconds from servo Channel 1 to 8, even 32 channels should also not be detected.

I am not very familar with how to use ISR, have read your code again and again. try to replace digitalWrite() with shiftOut() of your ISR code to pluse the 74HC595 outputs to control muti-chanel servos, not sure is it a right method?

A new library called MegaServo has been added to the plaground. This has many advantages over ServoTimer2, it allows an Arduino board to control one to twelve RC (hobby) servo motors on any digital pin on a standard Arduino board or up to 48 servos on an Arduino Mega. The library is a superset of the Arduino servo library. It can be used just like that library and has the following additional features:

  • Controls up to 48 servos (Arduino Mega only, other boards support up to 12 servos)
  • Any digital pin can be used with any servo
  • Pulse widths can be written and read in degrees or microseconds.

MegaServo does use timer1 on a standard Arduino board so you may still need to use ServoTimer2 if you need timer1 for other functions (such as the servo decode library)

Would it be possible to .. send the data to generated from MegaServo or that to be sent to one of the servo controller boards from Polulu, to an RF module or maybe an Xbee module. Then to decode this data at the other end to control the Servos?

Like this

Arduino -> (signal for polulu board) -> xbee -----------
--------------- xbee -> arduino -> polulu board -> servos

Easier R/C ?

junkiedogg, your question probably deserves a new thread. What you want to do is possible but how best to do it depends on your application.

This thread is here to help people that are confused by terms like PWM, and are not sure how this relates to servos and analogWrite.

Why not start a new thread with a title that communicates what kind of help you are looking for.
Perhaps something like: help wanted controlling polulu board wirelessly through xbee

Or of the pololu is not an essential part of your application: help wanted controlling servos wirelessly through xbee.

In the thread you can say more about what you want to build.

Hello guys,

I have two motors and I bought two speed controller boards:( http://secure.oatleyelectronics.com/files/K243notes.pdf ). How can I make my arduino control the speed and direction of my DC motor using this controller I bought? What libraries do you suggest?
Your reply would be greatly appreciated

Regards

Hi Erac,
The Servo library that comes with Arduino should drive that controller. The document linked in your post doesn't explicitly say, but values written to the servo library should increase or decrease motor speed as the values deviate from 90.

You can test it with the knob example sketch for the servo library. Connect the motor as per the information in the doc you linked. Connect the SIG line to Arduino pin 9 and the Ground line to arduino Gnd. If you connect a variable resistor (There is an online tutorial for this if you need help) you should be able to adjust the speed by adjusting the resistor.

If you add a serial.print statement in the sketch to display the value being written to the servo you can confirm the association between the values and motor speed.

Have fun!

Thanks mem!

I will do it and updated you. Why is have to be on pin 9 of the arduino?

Regards

The example sketch uses pin 9 but you can change it to any unused digital pin if you want. The current Servo library can work with any digital pin.

Thanks, mem

You said that: " If you connect a variable resistor (There is an online tutorial for this if you need help) you should be able to adjust the speed by adjusting the resistor."

So I still need a potentiometer to adjust the speed? What if I want it all done by my arduino through PPM.. What do you suggest..

I should NOT use analalog.write correct?

My application: K243 motor controller attached to arduino so that arduino with 1-2ms pulses control the motor through the K243. In a way mimmcing RC servo signals.

Regards

(a) No - it's an example, duh!
(b) Yes - the pulses are digital.
(c) Yes - But I should say "generate" not "mimic"

Thanks deSILVA,

Do MOSFETS need pulsing voltage to be opened? I tried to connect the power and the motor to my K243 motor driver and it didn't work, maybe I need to send 1-2ms signals.. with it.

No, but they need a certain voltage!
You did take a logic level MOSFET, didn't you?

But a servo will need PPM pulses of course. On the other hand you don't need a transistor - let alone a MOSFET - to control a servo..

I am confusee what you are doing...

deSILVA,

This is my motor controller: http://secure.oatleyelectronics.com/files/K243notes.pdf and it uses 4 pcs SDB85N03L N channel MOSFET'S.

I wired the power supply and the motor to the K243 without the 1-2ms input, and the motors didn't work... maybe I need to try it with the 1-2ms with my arduino?

Thanks

I wired the power supply and the motor to the K243 without the 1-2ms input, and the motors didn't work... maybe I need to try it with the 1-2ms with my arduino?

That might make it work. :wink:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235160022/16

What yoi have is a complex device. You have nothing at all to do with MOSFETS or such.. this is hidden by an interface... PLease read what's inside the documentation - it is important.

The 1-2mS input is designed
for standard R/C equipment, It
simply converts the 1-2mS
1-2mS (Radio Control) INPUT
Input to an analogue voltage.

It allows you to vari the speed
of your motor throu the
movement of your R/C transmitter's
joystick. The 1-2mS
input should be connected to
the terminals marked "GND"
and "SIG". The analogue output
is available at the terminal
marked "A" and needs to be
linked to the terminal marked
"C" if the R/C input is used.
Note: The external pot must not
be connected if you are using
the R/C input. VR1 & VR2 are
only to adjustment the 1-2mS
(Radio Control) input if used.

CONNECTION
NOTE:

For use with the R/C input, link
terminal A with terminal C

the discussion on Erac's speed controller has moved to here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1283440647/0