Embedded systems

A Quick Guide to Servo Motors

Servo motors use feedback to determine it’s position, therefore they can be used to control the position of objects, rotate objects,various parts of a robot with high precision. The size of a servo motor is considerably small and with their built in circuitry, they can be connected directly to a micro-controller.           Servo motors were first used in the Remote Control (RC) world, usually to control the steering of RC cars or the flaps on a RC plane. With time, they found their uses in robotics, automation, and of course, the Arduino world In this article, we’ll look at how to interface a servo motor with an Arduino UNO micro-controller.

SG-90 servo motor
SG-90 servo motor
Servo pwm
Servo pwm

Most servos you’ll see around have three connections

  • Black/Brown – ground wire
  • Red – +Ve wire
  • Orange/Yellow/White – signal wire

Servo motors run on 5V, so it can be powered directly from your Arduino 5V port.

You’ll need the following to carry out this project

Hardware

  • 1 x SG-90 servo motor here
  • 1 x Arduino UNO, buy here

Software

  • Arduino IDE, download here

Step 1: Circuitry

arduino-servo circuit

Step 2: Upload the code

Fire up your Arduino IDE and follow the instructions below

  • Click on File
  • Go to Examples
  • Select servo, Sweep
  • Or you can copy the code below
  • Click on upload

Results

If you did everything right, your servo motor should rotate 180 degrees in a clockwise motion and vice versa

Arduino servo result
Arduino servo result

Wanna do more????

You could build a Bluetooth mobile phone controlled R.C car

Extra part needed

  • 2WD motor kit, buy it here

Refer to this article on interfacing a HC-05/HC-06 Bluetooth module with your mobile phone.

Leave a Reply

Your email address will not be published. Required fields are marked *