dimanche 10 février 2013

First step: Controling the steering servo

It is very simple to control a servo motor using an Arduino.
The servo position can vary from an angle of 0 to 180 degrees. It is interesting for me to know the maximum angle to turn on the right and on the left.

For this, I will use:
- An arduino
- A potentiometer
- Some simple wires
- A USB cable, to power the Arduino, and to get the value sends by the Arduino to the computer (with the serial port).

I will make an assembly, to change the angle of the servo, depending on the value of the potentiometer.

Here is the page that I used and which perfectly matched my case:

http://arduino.cc/en/Tutorial/Knob

And here's a picture of the assembly:


We will use:
- An analog input of the Arduino (to measure the value of the potentiometer)
- An output of the Arduino (to communicate to the servo the value of the angle to reach)
- The ground and the 5V output, to apply a voltage across the potentiometer, and also to power the servo.

Good to know:
Values which are ​​read from the analog input of the Arduino are always between 0 and 1023 (10 bits resolution).
Therefore, it is important, when making the code, to adapt this value to match the value expected by a servo, so between 0 and 179 (180 degrees).

To know this value, this one is then sent via the serial port (here USB) to the computer.

Aucun commentaire:

Enregistrer un commentaire