PDA

View Full Version : SERVO O.o



gshubham96
05-11-2011, 10:28 PM
I want to programm a servo for a robot.
any good tut to start with?
thanx in advance :) :D

sudarshan
05-11-2011, 11:34 PM
Look A servo needs 50 hertz signals OK.

The width of the pulse control the angle.

So set up AVR Micros TIMER1 for PWM MODE 14 (Fast PWM with Resolution Governed By ICR1 Register.

Set ICR1 = 1249 (this sets the PWM period = 20ms in 16MHz clock rate and PRESCALER=256)

Now you can generate variable duty cycle by writing to OCR1A and OCR1B registers.

OCR1A=78 will give 0 degree and for each increase in OCR1A will increment servo by 5.76 degrees.

Thats it!



#include <avr/io.h>
#include <util/delay.h>

void main()
{
TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11);
TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10);//PRESCALER=64 MODE 14(FAST PWM)

ICR1=4999; //fPWM=50Hz (Period = 20ms Standard).

DDRD|=(1<<PD4)|(1<<PD5); //PWM Pins as Out

OCR1A=374;
OCR1B=374; //Servos In Neutral Position (90 degree).

//Now you can set OCR1A and OCR1B inbetween 312 and 437 to get
//angles between 0 and 180 degrees

OCR1A=437; //Servo in 180 degree


}

the above is not my own words its a content from this own forum . i think it must be tutorial of avinash_g

kawal24
05-12-2011, 12:51 AM
I want to programm a servo for a robot.
any good tut to start with?
thanx in advance :) :D

If you are using or planning to use arduino platform then heres a tutorial on how to use servos with arduino
http://www.communityofrobots.com/node/169

avinash_g
05-12-2011, 08:27 AM
@sudarshan

Yes, it is my text spoken in carped manner!

Why don't you give the original link which describe the detail in a more decent way ??? Instead of COPYING ???

Also all my contents are strictly copyrighted so don't roam about sprinkling it every where or be prepared for a professional DMCA takedown.

Original text can be found here.
http://extremeelectronics.co.in/avr-tutorials/servo-motor-control-by-using-avr-atmega32-microcontroller/
(Sorry admins I don't want to link to my site, But when I saw the above code copied by sudarshan I coun't resist)

Otherwise I hardly would have replied to this thread.

In case the above post is modified by the author you can refer to the original posts screenshot here
http://extremeelectronics.co.in/images/RIPostServoMotorCodeCopy.png

sudarshan
05-12-2011, 06:08 PM
@sudarshan

Yes, it is my text spoken in carped manner!

Why don't you give the original link which describe the detail in a more decent way ??? Instead of COPYING ???

Also all my contents are strictly copyrighted so don't roam about sprinkling it every where or be prepared for a professional DMCA takedown.

Original text can be found here.
http://extremeelectronics.co.in/avr-tutorials/servo-motor-control-by-using-avr-atmega32-microcontroller/
(Sorry admins I don't want to link to my site, But when I saw the above code copied by sudarshan I coun't resist)

Otherwise I hardly would have replied to this thread.

In case the above post is modified by the author you can refer to the original posts screenshot here
http://extremeelectronics.co.in/images/RIPostServoMotorCodeCopy.png

sorry avinash_g i could not find the link to that post i had a backup of it in my pc so i got it from there.
thats why i have mentioned that its not my "the above is not my own words its a content from this own forum . i think it must be tutorial of avinash_g "

avinash_g
05-12-2011, 07:21 PM
@sudarshan

Ok. No problem.

We should just try to be ethical.

I have seen many of my code, tutorial (exact words lifted off from my site) and images etc, Used in some sites, many workshop and training (I hate them more than anything else ...) and even in some books! I worked hard to create such organised matterial, but now all these have demoralized me to work more in this field. So from now onwards I started make more software fully closed source and secure, password protected ZIP files, bugs put intentinally on source code etc. All this make user experience bitter.

gshubham96
05-12-2011, 10:33 PM
314let me xplain the purpse of my robot
please see the image attached
i want that if sensor 1 receives a signal then the motor turns right and if sensor 2 receives signal then motor turns left
regards
shuham garg

kawal24
05-13-2011, 01:42 AM
object tracking robot ?

gshubham96
05-13-2011, 02:54 PM
noo,
actually a fire fighter,
i will attach the nozzle of a fire estignuisher to the motor

kawal24
05-13-2011, 03:59 PM
Good luck.

btw which sensor are you using for tracking/detecting fire ? I too wanted to build a big firefighter robot but didnt find a good sensor.
Currently am working on it but for Rc mode.

gshubham96
05-13-2011, 10:10 PM
I am using IR sensors

gshubham96
05-14-2011, 04:21 PM
Ir sensors