
Line Follower Using Camera
This project will show you how to make a line follower robot using a Smartphone.
A servo motor is a rotary actuator that rotates with angular precision.There are different types of servos available namely: positional rotation, continuous rotation, and linear. Here you will be using positional rotation servo. It is used to achieve proper angular positions for objects connected to it. Servo motors are used widely in projects related to robotics.
If pull apart a servo motor, you find the following inside it:
evive has two dedicated servo motor outputs pins, as shown below:
A positional servo mainly consists of three pins: Gnd,Vcc and Signal pin. Its shaft rotates from 0 to 180 degree, 0° being its neutral position.The signal pin on servo should be given a pulse in every 20ms (milliseconds) to move it to specific angular degree from its neutral position. The width of pulse applied decides the amount of angular rotation servo performs. This pulse is given from PWM pins of the controller.
Signal pin of servo 1 is connected to digital pin 44 and servo 2 is connected to digital pin 45 in evive. Slots S1 and S2 shown in above images are for servo 1 and servo 2 respectively.
For interfacing the servo motor with Arduino IDE, you must first connect the motor to one of evive’s servo channels as shown in the figure below:
There is a servo library which can be used to control the servo motor. The available functions are given in the table below:
Function | Return data type | Comment |
---|---|---|
attach(int pin); | unit8_t | Attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure |
attach(int pin, int min, int max); | unit8_t | As above but also sets min and max values for writes |
detach(); | void | |
write(int value); | void | If value is |
writeMicroseconds(int value); | void | Write pulse width in microseconds |
read(); | Integer | Returns current pulse width as an angle between 0 and 180 degrees |
readMicroseconds(); | Integer | Returns current pulse width in microseconds for this servo (was read_us() in first release) |
attached(); | bool | Return true if this servo is attached, otherwise false |
Example 1: Servo is rotated from 0° to 180° and from 180° to 0°.
Example 2: You will control the servo motor using evive’s potentiometer.
0 items in the cart ($0.00)