Download Print this page

Servo Control - NEX ROBOTICS Fire Bird V ATMEGA2560 HEXAPOD User Manual

Robotic research platform
Hide thumbs Also See for Fire Bird V ATMEGA2560 HEXAPOD:

Advertisement

6. Application Example Code.
All codes for the robot and remote control are written in AVR Studio version 4.17. In this
chapter various functions used in the hexapod are covered.
Important:
1. While programming the robot keep it on the CD box.
2. Always call
then start your motion.
3. Test your motion on the CD box first before starting execution.

6.1 Servo control

Fire Bird V Hexapod uses High torque NRS-995 metal gear servo motors. This servo motor
gives 0 to 180 degree rotation for the 0.5ms to 2.2ms pulse width. This control pulse train can be
given to the motor at 40 to 60 Hz.
6.2 Servo port initialization
Required pins of the microcontroller for servo control application are configured in this function.
For pin connection refer to table 5.1.
void servo_pin_config (void)
{
DDRB = 0x60;
//PB 5,6 as output
PORTB = 0x00;
DDRD = 0xF1; //PD 1,4,5,6,7 as output
PORTD = 0x00;
DDRG = 0x03; //PG 0,1 as output
PORTG = 0x00;
DDRH = 0x70; //PH 4,5,6 as output
PORTH = 0x00;
DDRJ = 0xFE; //PJ 1,2,3,4,5,6,7 as output
PORTJ = 0x00;
DDRL = 0xC7; //PL 1,2,3,6,7 as output
PORTL = 0x00;
}
6.3 Servo control signal generation
We need to control 18 servo motors simultaneously. Each servo motor needs control
signal at 40 to 50Hz repetition rate with 0.5ms to 2.2ms pulse width depending upon the desired
position. In the conventional way of generating such signal, each timer can only generate three
such outputs. Each output will only have resolution of about 1.5 degrees (10 bit). We do not have
sufficient number of timers to control 18 servo motors. Hence Timer1 is used in a bit different
way which enables us to control up to 24 servos at the same time. Only disadvantage is that this
algorithm generates about 1600 interrupts per second. In the Fire Bird V clock is running at
14.7456MHz. ATMEGA2560 process almost all the instruction in single clock cycle. This
© NEX Robotics Pvt. Ltd. and ERTS Lab IIT Bombay, INDIA
"robot_stand_position ()"
Fire Bird V ATMEGA2560 Hexapod Robot User Guide
function first, wait for at least 3 seconds and
26

Advertisement

loading
Need help?

Need help?

Do you have a question about the Fire Bird V ATMEGA2560 HEXAPOD and is the answer not in the manual?

Related Products for NEX ROBOTICS Fire Bird V ATMEGA2560 HEXAPOD