120 likes | 275 Views
CSC-2700 – (3) Introduction to Robotics. Robotics Research Laboratory Louisiana State University. What we learned in last class. Pulse-width Modulation What for How it works Applications How to make it Servo Motor Control What is servo motor How it works Set position of servo head
E N D
CSC-2700 – (3) Introduction to Robotics Robotics Research Laboratory Louisiana State University
What we learned in last class • Pulse-width Modulation • What for • How it works • Applications • How to make it • Servo Motor Control • What is servo motor • How it works • Set position of servo head • Simple Hexabot • Walking • Turning • Control hexbot
Pulse-width Modulation • How to make it? • Digital Out (PINx) • Special Function I/O Regiser (SFR/SFIOR) • Using a main program • ns_spin( intdelay_time ) ; TOGGLE_PIN(PINxx) • Using interrupts • Timers • PORTB – PINB5 (OCA1), PINB6 (OC1B), PINB7 (OC2) • PORTE – PINE3 (OC3C), PINE4 (OC3B), PINE5 (OC3A)
Servo Motor Control • What is it? • Robotic Arms, RC-Airplane, etc. • Mechanical position change • How does it work? • Position Reader (Potentiometer) • DC-Motor • PWM DC-Motor Controller • Body Frame • Gears • Servo Head
Servo Motor Control • How to set position of a servo head • /home/csc2700/csc2700/10-PWM-Servo-01 intcount = 0; while (1){ switch (count++ % 4){ case(0): OCR3A = 1000; break; // OCR3A is PINE3 , 1000 is 1ms == left (0 degree) case(1): OCR3A = 3000; break; // OCR3A is PINE3 , 3000 is 3ms == middle (90 degree) case(2): OCR3A = 5000; break; // OCR3A is PINE3 , 5000 is 5ms == right (180 degree) case(3): OCR3A = 3000; break; // OCR3A is PINE3 } ms_spin(1000); }
DC Motor Controller (TB6612FNG) MOSFET-based H-bridges
TB6612FNG Specifications • MOSFET-based H-bridges • Recommended motor voltage (VMOT): 4.5 – 13.5 V • Logic voltage (VCC): 2.7 – 5.5 V • Output current maximum: 3 A per channel • Output current continuous: 1 A per channel (can be paralleled to deliver 2 A continuous) • Maximum PWM frequency: 100 kHz • Built-in thermal shutdown circuit • Filtering capacitors on both supply lines • Reverse-power protection on the motor supply
MOSFET-based H-bridges • The metal–oxide–semiconductor field-effect transistor
H- Bridge • An H bridge is anelectronic circuit that enables a voltage to be applied across a load in either direction
Let’s make a simple DC-motor control program int main(void){ InitHardware(); initPWM(); MC_HI(STANBY); MC_LO(LEFT0); MC_LO(LEFT1); MC_LO(RIGHT0); MC_LO(RIGHT1); int speed = 1000; int delay = 100; while (1){ MC_LO(LEFT0);MC_HI(LEFT1); SetPWM( PWM_PINE3, speed); SetPWM( PWM_PINE4, speed); ms_spin(delay); MC_LO(RIGHT0);MC_HI(RIGHT1); SetPWM( PWM_PINE3, speed); SetPWM( PWM_PINE4, speed); ms_spin(delay); speed += 1000; if (speed > 40000){ speed = 1000; } } }
Homework- 6 • Create a DC motor speed control program, which has a clockwise button, an anti-clockwise button, and a stop button • The clockwise button is for increasing speed of Motor controller toward clockwise (speed down for anti-clockwise) • The anti-clockwise button is for increasing speed of Motor controller toward anti-clockwise (speed down for clockwise) • The stop button is for stop DC motor