Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Arkboy on September 11, 2012, 03:17:15 PM

Title: $50 Robot PWM
Post by: Arkboy on September 11, 2012, 03:17:15 PM
I have read through the tutorials and I think I understand but just wanted to clarify.  Does the PWM on the $50 robot that controls the differential drive servos use software based PWM that uses the system clock?  Or is there some other way that its using timer0, timer1, or timer2?  Because according to the data-sheet the only PWM on the ATMega8 is on B1, B2, and B3.  Then does it just use that to drive until the sensors interrupt, so you couldn't have them driving in the background?

Title: Re: $50 Robot PWM
Post by: Soeren on September 13, 2012, 04:51:10 PM

Please post software questions in the proper forum (which, cryptically and puzzling, I know, is named "Software" ;))

Besides (and that's not your fault - it's more or less the entire servo "world" bend on mis-labelling the signalling), R/C servos do not use PWM (externally).
A PWM signal is characterized by the pulse width being able to be anywhere from slightly above 0% to slightly below 100% of the period (if 0.0% or 100.0%, it's plain old DC)

The R/C servo protocol calls for a signal wherein the pulse can be of a duration of between 1ms and 2ms, while the period itself are allowed to vary quite a bit from the defined 20ms.
A signal with a pulse of a defined duration range, within a loosely defined period is Pulse Duration Modulation (PDM)
Title: Re: $50 Robot PWM
Post by: Arkboy on September 17, 2012, 09:34:26 AM

Thank you for your response.  My question wasn't really intended to be about software (sorry if it came across that way).  The software part of the question was just to confirm my reading on the hardware capabilities of the atmega8 and its timers.  Because in the data-sheet it says that the atmega8 has 3 PWM channels outputting to 6 pins I think.  But pin 2 and 3 aren't one of them, and they are used on the $50 robot, so my assumption was that the servos were controlled using software to turn the pins on and off using the time duration needed to do PWM.  Is this correct or is there something about the atmega8 hardware that I am not understanding?