Skip to main content

Servo Motor Interfacing with Arduino

In this tutorial, we will learn how to interface a servo motor using Arduino UNO.
The motor inside the setup of a servo is attached by gears to the control wheel. When the motor rotates, the potentiometer’s resistance changes hence the control circuit can precisely regulate how much movement there is and in which direction.

The motor’s speed is proportional to the difference between its actual position and desired position. When the shaft is near the desired position it turns slowly else fast. This is called proportional control.

They are controlled by sending PWM (pulse width modulated) signals through the control wire.
They are available in many sizes and are of three types
  • Positional rotation 
  • Continuous rotation 
  • Linear
The most common type is the positional rotational one.
So now we are familiar with the motor let us interface it

Components Required:

  • Servo motor 1No
  • Arduino UNO 1No
  • Few connecting wires
  • Breadboard
Follow the video below for circuit connection reference
After making the circuit dump the code given below.

#include <Servo.h>
Servo myservo;
int pos = 0;
void setup()
{
myservo.attach(9);
}
void loop() 
{
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) 
{
myservo.write(pos);
delay(15);
}
}

This was the normal interfacing; you can also control the movement with the help of a potentiometer as shown below.
Servo motors can be used for several applications few of them are:
Servo motors are used in making joints of robots.

  • Surveillance cameras. 
  • Door opening mechanisms. 
  • Solar tracking systems. 
And much more…..

So try something out and let us know what you made in the comment section.

Two variants of servos are available one which rotates 180 degrees and other which rotates 360 degrees.
You can modify your servo motor to increase the rotation range just follow the link below.
http://www.instructables.com/id/How-to-modify-a-servo-motor-for-continuous-rotatio/


Thinking ?

Join our hands-on training courses.
To know more visit us at http://www.sudolearn.com/

Comments

Popular posts from this blog

Soil Moisture Monitoring using ESP8266 and Soil Moisture Sensor

Hey folks In this tutorial, we will learn how to interface LM393 module(Soil Moisture Sensor)with NodeMcu(ESP8266). LM393 is a simple water sensor can be used to detect soil moisture when the soil moisture deficit module plant waterer device, so that the plants in our garden without people to manage; Adjustable sensitivity adjust the digital potentiometer (shown in blue) Operating Voltage 3.3V-5V; Module Dual Output mode, a simple. LM393 Soli Moisture Sensor Module(over view)  Components Required: LM393 Soil Sensor  NodeMcu(ESP8266)  Connecting wires(male to male)  Breadboard  Follow the Image below for circuit connection reference:- (Interfacing all components)  Here Pin A0 of the moisture sensor module connects to pin A0 on the ESP8266 The GND pin on the moisture sensor module connects to a GND pin on the ESP8266 The VCC pin on the moisture sensor module connects to a 3v3 pin on the ESP8266 D0 pin remain disconnected After making th...

Servo Motor Control using ESP8266 and Blynk App

Hey folks,  In this tutorial we will learn how to interface Servo motor with NodeMcu(ESP8266)module and operate it with the Blynk app.  Servos  are controlled by sending an electrical pulse of variable width, or pulse width modulation (PWM), through the control wire. There is a minimum pulse, a maximum pulse, and a repetition rate. A  servo motor  can usually only turn 90° in either direction for a total of 180° movement. servo Motor (Back view)  Servo Motor (front view) Blynk  is a Platform with iOS and Android  apps  to control Arduino, Raspberry Pi and the likes over the Internet. It's a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. (Blynk App) Components Required: Servo motor NodeMcu(ESP8266) Connecting wires(male to male) Breadboard    Follow the image below for circuit connection reference. (Servo Motor connecting wi...

Webcam Interfacing with Raspberry Pi

This tutorial is about the clicking photos and recording videos using "Logitech Webcam C110 with Raspberry Pi 3 Model B" Component Required: Rasberry Pi 3 Model B  Logitech Webcam C110  Adapter Charger micro USB-b Type 5v,2Amp  Connection Diagram: Step 1: Create a new folder First, we create a new folder just to store your photo and videos separately. Open the terminal. Command for creating new folder is "mkdir folder name" Step 2: Check everything is up-to-date To update your Raspberry Pi command is " sudo apt-get update ". And to upgrade your Raspberry Pi command is " sudo apt-get upgrade". Step 3: Check SSH and Camera enabled To make sure SSH and Camera enabled. Follow these two-steps. By this command, you can configure your SSH and Camera " sudo raspi-config ". Enable SSH. Enable Camera. Step 4: Check connection of Camera Make sure the camera is connected. Then run this command to make sure...