Project showcase
Servo Motor Control with Remote

Servo Motor Control with Remote © Apache-2.0

With this simple Arduino project, you can servo motor using a remote control.

  • 2,242 views
  • 1 comment
  • 21 respects

Components and supplies

Apps and online services

About this project

ABOUT THIS PROJECT
With this simple Arduino project you can control servo using a remote control. All you need is an Arduino Uno board (or similar), a servo motor (doesn't have to be very powerful), a TV remote, IR receiver (TS0P1738) and a small piece of cardboard.

Let's get started!

Installing the IR Library:

The very first thing that we need to do associating with arduino is to download the IR library.

Download IR library from below link and install it: https://github.com/z3t0/Arduino-IRremote

If you don't know how to install a library follow below link: https://www.arduino.cc/en/guide/libraries

Decoding IR Signals:

First you need to connect the parts as per the given circuit diagram:

You can checkout Pin out of TSOP1738 below:

Use following code to decode IR remote:

/*The IR sensor's pins are attached to Arduino as so:Pin 1 to Vout (pin 11 on Arduino)Pin 2 to GNDPin 3 to Vcc (+5v from Arduino)*/#include <IRremote.h>int IRpin = 11;IRrecv irrecv(IRpin);decode_results results;void setup(){Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver}void loop() { if (irrecv.decode(&results))    {     Serial.println(results.value, DEC); // Print the Serial 'results.value'     irrecv.resume();   // Receive the next value   }}


  • Open Arduino IDE and Upload code
  • Open Serial Monitor
  • Aim your remote at the sensor and press each button
  • You can see different numbers for each button

Consider any two buttons, and note down decoded values.In my case I have chosen Power button and Mode button.

I got the following values:

  • Power button=33441975
  • Mode button =33446055

We will be using this two values to control rotation of servo motor.you need to add this two values in the program which is given on next step:

Let's set-up the final hardware!

The Final Circuit!

Connect the servo's signal pin to pin#9 on the arduino
connect the servo's VCC and GND pins to 5V VCC and GND on the arduino
The servo will be glued to one end of the plastic bottle, and rotate a piece of cardboard small enough to close the opening of the bottle so that the food is blocked.
If all the hardware set-up is connected properly, you can simply compile and upload the following sketch to the board.

#include <IRremote.h>#include <Servo.h>int IRpin = 11;  // pin for the IR sensorIRrecv irrecv(IRpin);decode_results results;Servo myservo;void setup(){ Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver myservo.attach(9);  // attaches the servo on pin 9 to the servo object}void loop() {
if (irrecv.decode(&results))    {     irrecv.resume();   // Receive the next value   }  if (results.value == 33441975)  // change according to your IR remote button number    {      myservo.write(0);      delay(15);    }    if (results.value == 33446055)  // change according  to your IR remote button number    {      myservo.write(30);    delay(15);    }}

Code

CodeArduino
#include <IRremote.h>
#include <Servo.h>
int IRpin = 11;  // pin for the IR sensor
IRrecv irrecv(IRpin);
decode_results results;
Servo myservo;
void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
 myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
void loop() 
{
 if (irrecv.decode(&results)) 
   {
     irrecv.resume();   // Receive the next value
   }
  if (results.value == 33441975)  // change according to your IR remote button number
    {
      myservo.write(0);
      delay(15);
    }
    if (results.value == 33446055)  // change according  to your IR remote button number
    {
      myservo.write(30);
    delay(15);
    }
    
}     

Schematics

Circuit
Uploads2ftmp2f842d116f 76bf 4af4 a829 f228ccaad4312firremote servo control q4brricqha ywk2mti2hw

Comments

Similar projects you might like

Servo Control with TV Remote Control

Project showcase by eldo85

  • 10,431 views
  • 5 comments
  • 29 respects

Control an LED with the Remote Control

Project showcase by Nicholas_N

  • 9,610 views
  • 3 comments
  • 16 respects

All About Servo Motors and Servo Motor Tester

Project tutorial by RoboCircuits

  • 1,955 views
  • 0 comments
  • 8 respects

Remote Controlled Pet Feeder

Project tutorial by Amal Mathew

  • 6,209 views
  • 1 comment
  • 33 respects

Using Serial Monitor to Control Servo Motor

Project tutorial by Kub_Luk

  • 12,528 views
  • 9 comments
  • 37 respects
Add projectSign up / Login