You are on page 1of 3

1.

Controlling multiple servo Instead of using any hard ware PWM or software PWM there is another efficient PWM method through which we can generate better PWM pulses same as a hard ware PWM. This is a timer based PWM. The disadvantages of software PWM you obscures know and the disadvantage of a hardware PWM is our number of PWM channels are limited to the number of PWM channels provided by the controller. And the advantage of the timer based PWM is we can have multiple number of PWM channels irrespective of the PWM channels provided by the controller, we can use any port pin as a PWM channel. Through this method we have already controlled 32 servo motors using an Atmega16 controller. Through this method it is possible to provide more than 32 number of different PWM pulses to 32 numbers of channels. Its logic is explained below

Suppose we are using a 16 bit timer timer-1 a compare match interrupt cmpA for max a compare match interrupt cmpB for compare bottom is 0x00 Suppose we have to control a single servo motor Ton+Toff=20ms Ton should vary from 1 to 2 ms Use two interrupt compare match interrupt A it should trigger on each 20 ms and compare match interrupt B it should trigger before 1 or 2 millisecond of triggering compare match interrupt A. In compare match interrupt B reset the port pin and again in compare match interrupt A set the port pin. This set and reset of the port pin should be done manually in the ISR.

Suppose we have to control 8 servo motors simultaneously

Use two interrupt compare match interrupt A it should trigger on each 2.5 ms and compare match interrupt B it should trigger before 1 or 2 millisecond of triggering compare match interrupt A. In compare match interrupt B reset the port pin of one by one channel. and again in compare match interrupt A set the port pins of all the channels. This set and reset of the port pin should be done manually in the ISR.

Suppose we have to control more than 10 motors simultaneously Use two interrupt compare match interrupt A it should trigger on each 20 ms and compare match interrupt B. st Initially the value of on period of each channel is sorted in ascending order. When the 1 compare match nd occur it should reset the channel 0 and sets the value foe next compare match again when the 2 compare match occurs it should set the channel 0 and reset the channel 1 in this way we can provide PWM to multiple channels.

In the above explanations I have explained the PWM concept which we have planed to use in Robocub kit. I hope you have the ideas about the above concepts if you need more information about it we will send you a complete description, algorithms and sample codes.

You might also like