Controlling Servo Motor Using IR Remote in Arduino

In this article, you will learn controlling Servo Motor Using IR Remote in Arduino. The project will let you control a mini servo using an infrared remote control . By pushing a button, you can turn the servo to the right or to the left.

Here are the steps in creating the project.

Watch the video here to see the full demonstration of the Controlling A Servo with Joystick in Arduino with Code and Wiring Diagram

Controlling Servo Motor using IR Remote in Arduino: Steps in Creating the Device

Here are the steps in creating Temperature Monitoring System using Arduino..

  1. Gathering the Components

    The first thing to do is to collect the hardware components for the Arduino device.
    Arduino Uno
    IR Receiver and remote
    Mini Servo

  2. Connecting the Components

    Connect the components to the Arduino Uno. Please refer to the wiring diagram below.

  3. Coding the Arduino

    Third step is about coding the Arduino device to work with the components.

  4. Upload the Sketch

    Lastly, upload the sketch to the Arduino.

Controlling Servo Motor using IR Remote in Arduino: Detailed Explanation

To start this project, you need the following:

QtyComponent
1Arduino UNO
1IR receiver and Remote
1Mini Servo

Arduino UNO

Arduino Uno
Arduino Uno

For this project, we will be using an Arduino Uno microprocessor board. Arduino Uno is suitable for any projects and is the cheapest and widely used microprocessor board in the Arduino family. This is great for all kinds of IoT projects.

IR Receiver

IR Receiver
IR Receiver

This project uses a standalone IR receiver diode. The first pin is connected to the digital pin of the Arduino. The long pin is the ground connection and the last pin is the Vcc.

IR Remote Control

IR Remote Control
IR Remote Control

This is an IR remote control. IR pulses are transmitted by the remote that is converted to a HEX code. Each button has its own HEX code. If the button is pressed continuously, the HEX code will be 0xFFFFFFFF. 

For a complete guide in infrared remote control project, click here.

Mini Servo

Micro Servo For RFID Door Lock Using Arduino Project with Data Logging in Python
Micro Servo

The mini servo you will be using requires 5V of power. You can connect this safely to the Arduino board.

Schematic Diagram

Remote Controlled Servo Motor Wiring Diagram
Remote Controlled Servo Motor Wiring Diagram

Here is the wiring diagram in controlling Servo Motor using IR Remote in Arduino. All components are powered using the 5V pin of the Arduino. The IR receiver is connected to the digital pin 6 and the servo’s data pin is connected to the digital pin 7.

Code

First is to download the library needed for the project. The “IRremote” library is used here and you can download it using the Arduino Library Manager. Open “Tools>Manage Libraries” and search for “IRremote”. Just install and wait for it to finish.

The Servo library is already pre-installed in the IDE.

For the code, objects for IRrecv and decode_results are created. Declare the data pin of the module and the IR . Then for the setup, simply set the pin mode of the declared variable to OUTPUT and enable the IR receiver. In the loop function, if the Arduino receives a signal for button “+”, the servo will turn to the right. It will turn to the left by pressing “-“.

Output

Now try out controlling the servo motor using the IR remote.

Servo moves using an IR Remote Control
Servo moves using an IR Remote Control

Summary

So there you have it – Controlling Servo Motor using IR Remote in Arduino. This device is simple to create and can be used in other projects as well. You can always add more sensors to the device, upgrading it to a much-sophisticated device.

Download

Click the button below to download the source code.

Inquiries

Feel free to write your questions about the project at the comments below.

Leave a Comment