Arduino servo

A robot needs motors to move. A servo turns to an exact angle: control it with a potentiometer and build a barrier gate or a pointer gauge.

A DC motor draws a lot of current, more than an Arduino pin can supply. Add a transistor switch and a separate battery, set the speed with PWM and learn the common-ground rule.

In this lab

  • servo angle
  • a motor through a transistor
  • speed with PWM
  • barrier gate and fan

What you learn

A robot needs motors to move. A servo turns precisely to a set angle, while a plain motor spins continuously and draws a large current that an Arduino pin cannot supply, so a transistor switch and a separate battery are used. The aim is to make motion safe and controllable.

Tasks

  1. Turn a servo to a set angle and sweep it back and forth
  2. Control a servo with a potentiometer (map)
  3. Switch a motor through a transistor
  4. Change motor speed with PWM
  5. Learn the common-GND and separate-supply rule

What you can build

  • Barrier gate — Press the button and the servo raises the arm, then lowers it.
  • Robot arm joint — The servo follows the turn of the potentiometer.
  • Dial gauge — The servo needle shows a measured value (light, distance).
  • Fan — A fan switched by a button through a transistor.
  • Speed controller — Smooth motor speed control from a potentiometer via PWM.
  • Automatic door — The servo opens the door when someone comes near (with the ultrasonic sensor from lab 4).

Virtual Lab › Robotics

Related labs

  • Robotics basics
  • Arduino
  • Arduino LED
  • Arduino sensors
  • Arduino thermometer
  • Arduino LCD