Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: JakeP on June 03, 2008, 09:01:48 PM

Title: Using a 556 to control servos
Post by: JakeP on June 03, 2008, 09:01:48 PM
The project I'm working on has an ATMega8 doing many tasks at once. It has two drive two servos, read data from an accelerometer, do some math, read from some other sensors (e.g. thermistors) write the data to memory and do some logic stuff. I was thinking of exporting the control of the servos to a 556 timer (double 555 timer) per servo. The output from the atmega8 would have to either vary resistance or capacitance... so I was thinking of using a digital potentiometer.. would that work alright?
I was mostly thinking of doing this just for the sexy factor, but now that I think about it, it might be a silly thing to do. I'm not quite clear on how long the low part of the pulse can be... I'm doing a bunch of other stuff on the chip, but not *ALOT*... maybe it would be ok?

Does manually doing the pulse on the main IC for multiple servos along with doing other stuff still work?

Don't know how well this is worded... it is late...
Title: Re: Using a 556 to control servos
Post by: JesseWelling on June 04, 2008, 12:58:22 AM
I don't think you will get as good of signal using an analog system as a digital PWM system. We've found this out at work and we use digital much more than analog because timers on micros are much more accurate than the a2d's or any d2a we come up with ( R/2R (http://www.allaboutcircuits.com/vol_4/chpt_13/3.html) resistor networks and what not...)

I'm working on an interrupt driven servo package that would allow about 10 servos per output compare register on a 16 bit timer. It's fairly specialized but I am basing it off of the avrlib (http://hubbard.engr.scu.edu/avr/avrlib/docs/html/index.html) servo code (http://hubbard.engr.scu.edu/avr/avrlib/docs/html/group__servo.html). But right now I'm having trouble getting my init to set up all the I/O registers correctly (my code not the library code  :-\ ). YMMV.
Title: Re: Using a 556 to control servos
Post by: ALZ on June 04, 2008, 01:51:14 AM
It's not hard to answer your own question. You only have to update the servos every 20 ms. Can you do everything (bunch of other stuff ) you want to do on the atmega8 in 20 ms. ?

For the money you would spend on  a 556 timer and a digital potentiometer you could buy a PIC which could do alot more than run 2 servos. 
Title: Re: Using a 556 to control servos
Post by: bens on June 04, 2008, 02:11:15 AM
You can use timer1's two PWM outputs to generate the servo pulses entirely in hardware, thereby freeing up your CPU to execute the rest of your program.  What speed is your mega8 running at?

- Ben