PROJECT 10 - SERIAL COMMUNICATION CONTROL RC SERVO

PROJECT 10 - SERIAL COMMUNICATION CONTROL RC SERVO

PROJECT 10

SERIAL COMMUNICATION CONTROL RC SERVO

Back to Project 9                                                                                                      Go to Project 11
Wondering how to control the RC servo motor through your PC/laptop? In this project, we are going to explore on how to control two RC servo’s position through the serial monitor of Arduino programmer. By sending the position from 0 to 180 will determine the servo position.

———————————————————————————————————————————————————

COMPONENT NEEDED

———————————————————————————————————————————————————-
RC SERVO MOTOR
JUMPER WIRE

———————————————————————————————————————————————————-

CONNECTION

———————————————————————————————————————————————————-

In this project, there are 2 RC servo motor signal wire (YELLOW) connected to Arduino Duemilanove digital pin-2 and pin-3. RED wire are connected to +5V while BLACK wire connected to ground(GND).

———————————————————————————————————————————————————-

CODE OVERVIEW

———————————————————————————————————————————————————-

int value; Assign the value as integer to store the value of servo position from 0 to 180. unsigned int old_value; Store the last value of the servo position.

servo1.write(90); Initialize and move the servo1 to 90 degree. old_value = 90; Set and store the position of servo to old_value.

If (value > 180) value = 180; Check if the value is larger than 180. if yes then set it to maximum 180. else if (value < 0) value = 0; Check if the value is less than 0. if yes then set it to minimum 0. if(value < old_value) Check if the current value of servo position is less then the old_value or last value. old_value = value; Assign the current value to old_value as the memory for the microcontroller to determine servo position.

Back to Project 9                                                                                                      Go to Project 11
———————————————————————————————————————————————————-

ATTACHMENT

1. P10 User Manual.pdf 2. Project_10_code.zip

BUY