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