Society of Robots - Robot Forum

Software => Software => Topic started by: benji on January 21, 2008, 09:11:42 AM

Title: A HEX IN THE MIX
Post by: benji on January 21, 2008, 09:11:42 AM
hey you guys, i think i should win the best title for this topic,, 8) blufff,,gus giggelin..
yea ,, its a hexapod im makiing.. i did write almost all the complex movments of this 12 servos kid and i need to turn it into a feasible algorithm,
i need to drive 12 servos using my atmega23 ,goinf for a timer's pwm modes this processor provides 4 , so not enough for my 12 kids(motors),
anyone done a hexapod before ? i need an approach to do this ,all i could think of now is just puzzling delays bu this sounds like a weak algorithm
,,thnks 4 any post
Title: Re: A HEX IN THE MIX
Post by: hazzer123 on January 21, 2008, 10:52:19 AM
I don't understand your post to well, try to use the spell check.

But if you looking for code to send PWM to lots of servos, then i posted a bit of pseudocode in this topic - http://www.societyofrobots.com/robotforum/index.php?topic=2842.0 (http://www.societyofrobots.com/robotforum/index.php?topic=2842.0)

HTH
Title: Re: A HEX IN THE MIX
Post by: paulstreats on January 21, 2008, 11:01:13 AM
you would be better off not using the pwm's at all for servo's, since servo pwm is slightly different to the normal pwm standard that runs off mcu timers.

It is better to just attatch them to the digital ports and get these to control the servos.

Because the mcu will be tied up with controlling all of those servo's, i would look at making it a dedicated actuator controller and have a seperate mcu to run the programs on which can send basic commands like move forwards to the actuator controller mcu
Title: Re: A HEX IN THE MIX
Post by: benji on January 21, 2008, 05:10:22 PM
yea using a different mcu for commands,,but im talking here about the walking mcu, are ou using pwm? or just put high ,delay, put low ?
Title: Re: A HEX IN THE MIX
Post by: hazzer123 on January 21, 2008, 05:22:16 PM
The PWM pins on an MCU are not for controlling servos. They are sort-of analogue outputs.
A high frequency (in the kHz range) square wave is outputted from a PWM pin, which is then smoothed out with a capacitor to create a DC voltage.
This DC voltage can be altered by changing the duty cycle of the square wave output. Higher duty cycle --> more of the square wave is at high voltage --> higher voltage after capacitor smoothing.

The PWM used in servos is only about 30Hz. The duty cycle isn't important, it is the time that the square wave is high that is important.

These are very different so your servo PWM output will have to be done in software.

High, delay, low - This will work for a couple of servos, but you can only do 1 servo at once. With 12 Servos you might find the servos will 'shiver' because the pulse frequency can't be very high.

Using timers you can do all servos simulatneosly. I advise you to look at this post - http://www.societyofrobots.com/robotforum/index.php?topic=2842.msg20126#msg20126 (http://www.societyofrobots.com/robotforum/index.php?topic=2842.msg20126#msg20126)
Title: Re: A HEX IN THE MIX
Post by: benji on January 22, 2008, 12:15:07 PM
thanks hazzer thats a nice algorithm to drive a big number of servos using one mcu
,, have you done a hexapod before?