Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

IR remote controlled DC servo motor using Arduino

By Ashutosh Bhatt February 10, 2017

Arduino can easily control the DC servo motor and rotate it at an exact, required angle. The Arduino has analog output through which it generates PWM that is used to rotate servo motor at a specific angle. You can move the servo motor angle position using potentiometer or joystick or push buttons with the help or Arduino.

What if we want to control the servo motor using remote? Especially normal, readily available, hand held IR remote which we can find in all most all the homes for TV, AC, music systems, DVD or even for STB (set top box). Like, we can move the motor to specific angle like 30o, 60o, 90o etc or we can linearly increase or decrease motor angle using IR remote – any IR remote. Doesn’t this sound great?

The given project demonstrates how to move servo motor at specific angle using IR remote (like TV, DVD, AC, STB etc) with the help of Arduino. It also increases or decrease motor angle using remote and rotate motor CW and CCW. The project uses normal set top box (STB) IR remote, TSOP IR sensor and Arduino UNO board. Anyone can use any type of IR remote. Just he has to change the remote codes in the Arduino sketch (program) for the remote. This procedure is also described here while explaining the operation. So let us see how this is done.

First see the circuit diagram followed by its description and operation.

CIRCUIT DESCRIPTION

As shown in figure, the circuit is built using 2 components only an Arduino board and IR sensor.

• The sensor TSOP1738 has 3 terminals (1) Vcc (2) Gnd and (3) output. Its Vcc terminal is given 5 V from board and Gnd terminal is connected to ground of board. Sensor output is connected digital input pin 12 of arduino board

• Analog output pin 5 is connected to servo motor signal input pin to drive the motor

• The servo motor is given external 5 V supply

Here is the snap of circuit arrangement.

Prototype of Arduino and IR Remote based DC Servo Controller

Fig. 1: Prototype of Arduino and IR Remote based DC Servo Controller

CIRCUIT OPERATION

First we have to decide, which are the different buttons of IR remote, that we will use to rotate servo motor. We want to perform following actions – :

1. Rotate the motor to a specific angle like 30o, 60o, 90o,…. Like wise

2. Increase / decrease motor angle from 0o to 180o in steps of 5o

I have used set top box (STB) remote that has many buttons like 0-9 digit buttons, volume control buttons, channel up/down buttons, arrow key buttons etc. From all these buttons I have selected following 7 buttons for different operations.

That means when any digit button between 1 to 5 is pressed, the motor will move to that specific angle. And by pressing volume up/down button the motor angle can be precisely set in ±5o

After deciding the buttons, next is to decode the codes of these buttons. As we know when any button is pressed from remote, it will send one code and based on this code the action is performed. So to decode these codes I have used IRremote library for arduino, readily available on internet.

So download the library and use example to decode the codes of remote buttons. Upload the program into arduino micro controller and connect IR sensor as shown in figure. Now point the remote control towards IR sensor and press the button. Open serial monitor and you can observe the code of pressed button in form of numbers. Note down the codes of required buttons like I have noted the codes as per following table – :

In the arduino sketch above codes are used corresponding to button pressed to perform action as per previous table. Now let us see the actual operation.

• Motor is given supply from external 5 V and arduino board and IR sensor is given supply form USB. When power is applied the motor moves to 0o. The messages displayed on serial monitor as “IR remote controlled servo motor” and “servo motor angle 0 deg”

• Now as button 1 is pressed from remote motor will move to 30o and likewise when button 2, 3, 4 or 5 is pressed motor will move to the desire angle 60o, 90o, 120o or 150o. The serial monitor also displays servo motor angle position as “servo motor angle xx deg”

• When volume up button is pressed, the motor angle increased by 5o – means if it’s on 30o, it will move to 35o and likewise. The new angle position is displayed on serial monitor.

• Similarly when volume down button is pressed, the motor angle decreased by 5o – means if it’s on 90o, it will move to 85o and likewise. The new angle position is displayed on serial monitor.

Thus with the help of arduino, we can control the servo motor angle using IR remote and TSOP IR sensor.

Project Source Code

###

#include <IRremote.h> // add IR remote library

#include <Servo.h> // add servo motor library

Servo servo1; 

int IRpin = 12;   // pin for the IR sensor

int motor_angle=0;

IRrecv irrecv(IRpin);

decode_results results;


void setup()

{

  Serial.begin(9600); // initialize serial communication

  Serial.println("IR Remote controlled servo motor"); // display message

  irrecv.enableIRIn();  // Start the receiver  

  servo1.attach(5); // declare servo motor pin

  servo1.write(motor_angle); // move the motor to 0 deg

  Serial.println("Servo motor angle 0 deg");

  delay(2000);

}


void loop() 

{

 while(!(irrecv.decode(&results))); // wait until no button is pressed

 if (irrecv.decode(&results)) // when button is pressed and code is received

    {

      if(results.value==2210)  // check if digit 1 button is pressed

        {

          Serial.println("servo motor angle 30 deg");

    motor_angle = 30;

          servo1.write(motor_angle); // move the motor to 30 deg

        }

      else if(results.value==6308) // if digit 2 button is pressed

        {

          Serial.println("servo motor angle 60 deg");

   motor_angle = 60;          

   servo1.write(motor_angle); // move the motor to 60 deg

        }  

       else if(results.value==2215) // like wise for all  digit buttons

        {

          Serial.println("servo motor angle 90 deg");

   motor_angle = 90;          

   servo1.write(motor_angle);

        }  

       else if(results.value==6312) 

        {

          Serial.println("servo motor angle 120 deg");

   motor_angle = 120;          

   servo1.write(motor_angle);

        } 

       else if(results.value==2219) 

        {

          Serial.println("servo motor angle 150 deg");

   motor_angle = 150;          

   servo1.write(motor_angle);

        }   

       else if(results.value==6338) // if volume UP button is pressed

         {

            if(motor_angle<150) motor_angle+=5; // increase motor angle

            Serial.print("Motor angle is ");

            Serial.println(motor_angle);

            servo1.write(motor_angle);         // and move the motor to that angle

         }

      else if(results.value==6292)  // if volume down button is pressed

        {

            if(motor_angle>0) motor_angle-=5; // decrease motor angle

            Serial.print("Motor angle is ");

            Serial.println(motor_angle);

            servo1.write(motor_angle);      // and move the motor to that angle

        }

      delay(200);      // wait for 0.2 sec

      irrecv.resume();     // again be ready to receive next code

    }

 }

###

 


Circuit Diagrams

Circuit-Diagram-Arduino-IR-Remote-Based-DC-Servo-Controller

Project Video


Filed Under: Electronic Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • No Output Voltage from Voltage Doubler Circuit in Ansys Nexxim (Harmonic Balance Simulation)
  • Discrete IrDA receiver circuit
  • How do loop recording and G-sensors work on front and rear dash cams?
  • Getting different output for op amp circuit
  • Resistor Selection for Amplifier Layout

RSS Electro-Tech-Online.com Discussions

  • PIC KIT 3 not able to program dsPIC
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz
  • using a RTC in SF basic
  • Relay buzzing after transformer change?
  • Back to the old BASIC days

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe