Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

IR remote controlled DC motor using Arduino

By Ashutosh Bhatt

You can easily control the speed of DC motor using Arduino. We know that the Arduino has analog output through which it generates PWM that is used to vary the speed of DC motor. You may have seen speed control of DC motor using potentiometer or joystick or push buttons with the help or Arduino.

What if we want to control the speed of DC motor using remote? Especially normal, readily available, handheld 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 run or stop the motor as well as we can vary its speed using such IR remote – any IR remote. Doesn’t this sound great?

Prototype of Arduino and IR Remote based DC Motor Controller

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

The given project demonstrates how to control DC motor speed using any IR remote (like TV, DVD, AC, STB etc) with the help of Arduino. It also runs or stops the motor using a remote. The project uses the 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.

As shown in the figure, the circuit is built using 4 components only an Arduino board, IR sensor, RED LED and motor driver transistor MJE3055.

• 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 the ground of board. The sensor output is connected digital input pin 12 of the board.

• The RED LED is connected to digital pin 11 through the current limiting register of 470E.

• The analog output pin 3 of board drives 12V DC gear motor through MJE3055 transistor. This pin is connected to the base input of transistor through a 2.2K resistor, its collector output drives motor and emitter is connected to the ground of board.

• Motor is given external 12 V supply

Here is the snap of circuit arrangement.

Image of Arduino and IR Remote based DC Motor Controller

Fig. 2: Image of Arduino and IR Remote based DC Motor Controller

CIRCUIT OPERATION

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

1. Run or stop DC motor

2. Increase/decrease speed of motor

So we require 3 buttons. 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 3 buttons for above operations.

Table listing IR Remote buttons and their respective functions in DC Motor Control

Fig. 3: Table listing IR Remote buttons and their respective functions in DC Motor Control

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 the internet.

So download the library and use an example to decode the codes of remote buttons. Upload the program into arduino microcontroller and connect IR sensor as shown in the 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 the following table -:

Table listing IR Remote buttons and respective IR Codes

Fig. 4: Table listing IR Remote buttons and respective IR Codes

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

• Give the power to board and circuit through USB and to motor through external supply. Initially, the motor is stopped and LED is off. The message is displayed on serial monitor as “IR remote controlled DC Motor”

• Now when the power button is pressed from remote the PWM is applied to motor through pin 3 so motor starts running. The LED is turned ON to indicate motor is running. The message is displayed on the serial monitor as “Motor is running: LED ON”. When the same button is pressed again the PWM applied to the motor is stopped so the motor is also stopped and LED is OFF. The new message displayed on serial monitor as “Motor is stopped : LED OFF”

• Now when volume up button is pressed, the width of the pulse applied to the motor is increased so motor speed increased. The message displayed on the serial monitor as “motor speed increased”. It also displays PWM value from 0 to 255.

Image showing working of Arduino and IR Remote based DC Motor Controller

Fig. 5: Image showing working of Arduino and IR Remote based DC Motor Controller

• Now when volume down button is pressed, the width of the pulse applied to the motor is decreased so motor speed decreased. The message displayed on the serial monitor as “motor speed decreased”. It also displays PWM value from 0 to 255.

Thus we can run or stop the DC motor as well as increase or decrease speed of it using any IR remote like of TV, STB, DVD etc with the help of arduino.

Project Source Code

###

#include <IRremote.h>


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

int LED = 11;

int motor = 3;

int PWM_value=205; // initial pulse width


IRrecv irrecv(IRpin);

decode_results results;


void setup()

{

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

  Serial.println("IR Remote controlled DC Motor");

  irrecv.enableIRIn();  // Start the receiver

  pinMode(LED, OUTPUT);

  digitalWrite(LED,LOW);   

}


void loop() 

{

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

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

    {

      if(results.value==6296) // if code is 6296

        {

          digitalWrite(LED, HIGH);  // LED ON and

          analogWrite(motor,PWM_value); // motor start

          Serial.println("Motor is running : LED ON"); // display message                

        }

      else if(results.value==2200)  // if code is 2200

        {

          digitalWrite(LED, LOW);         // LED OFF and

          analogWrite(motor,0); // motor stop

          Serial.println("Motor is stop : LED OFF");

        }

      else if(results.value==6338)) // if code is 6338 for volume up button 

        {

          if(PWM_value<255) PWM_value+=10;  // increase pulse width

          Serial.print("motor speed increased : PWM= ");

          Serial.println(PWM_value);  // display message

          analogWrite(motor,PWM_value); // and increase motor speed  

        }

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

        {

          if(PWM_value>25) PWM_value-=10;  // decrease pulse width

          Serial.print("motor speed decreased : PWM= ");

          Serial.println(PWM_value);   // display message

          analogWrite(motor,PWM_value);   // and decrease motor speed

        }    

      delay(200);   // wait for 0.2 sec    

      irrecv.resume();    // Receive the next value

  }  

}

###

 


Project Video


Filed Under: Electronic Projects

 

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



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

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!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • Introduction to Brain Waves & its Types (Part 1/13)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Advice for my disabled son please
  • Very low voltage/power Schmitt trigger?
  • 3D IC Design: Is it possible to stack CPU and FPGA?
  • dc to dc converter sparks when inserting fuse
  • 7 segment display connections

RSS Electro-Tech-Online.com Discussions

  • Pet Microchip scan
  • Disabled son needs advice please
  • Modify a digital clamp ammeter ?
  • Confirming whether this circuit will work
  • How does a blinky/flashing ball work?
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 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 | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering