SensorsParking Sensor with Sound and Lights
An ultrasonic sensor measures the distance. Three LEDs show how close the obstacle is, and the buzzer beeps faster the closer you get.
RoboticsTurning a potentiometer swings a servo from 0 to 180 degrees. This is how a robot arm, or any other moving part, works.
Translated from “Servo Motor Basics with Arduino” by Arduino. Licence: CC BY-SA 4.0. This translation is shared under the same licence. The parts list and the tips are RoboHub's.
Choose a variation and the parts list updates.
The servo's brown wire goes to ground, red to 5V and yellow (or orange) to pin 9. If it sits far away, use an extension cable.
The outer legs go to 5V and ground, the middle leg to A0.
This is Arduino's well-known Knob example.
#include <Servo.h>
Servo servo;
const int KNOB = A0;
void setup() {
servo.attach(9);
}
void loop() {
int value = analogRead(KNOB); // 0-1023
int angle = map(value, 0, 1023, 0, 180); // 0-180 degrees
servo.write(angle);
delay(15);
}Turn the knob and the servo follows. If the servo jitters, give it its own 5 V supply.

Illustration, made with AI
Illustration, from above: a hand turns the potentiometer, with the servo and the board beside it on a cutting mat.
Step 4: Try it
SensorsAn ultrasonic sensor measures the distance. Three LEDs show how close the obstacle is, and the buzzer beeps faster the closer you get.
Radio controlThe FS-iA6B receiver passes every channel of the transmitter to the Arduino over a single wire (i-BUS). That way the transmitter can drive servos, lights or your own robot.
Lights and displaysAn RGB LED holds three small LEDs: red, green and blue. Mix their brightness and you get any colour, while the lamp slowly changes from one colour to the next.