Introduction
In this article, I am going to explain about the Controlling Servo motor, using IR Remote. If the motor can be used to run, they can be controlled by IR Remote in the use of OFF/ON.
Parts Of List
- Arduino Uno
- IR Remote
- IR Remote Sensor
- Bread Board
- Hook Up Wires
- Servo Motor
Servo Motor
- Connect the VCC of the Servo Motor to the 5v of the Arduino Uno.
- Connect the GND of the bluetooth to the Gnd of the Arduino Uno.
- Connect the VIN of the bluetooth to the 09 of the Arduino Uno.
IR Sensor
- Connect the IR Sensor to the Arduino board VIN -3pin.
- Connect the IR Sensor to the Arduino board GND - Gnd.
- Connect the IR Sensor to the Arduino board VCC - 5v.
Programming
- #include < IRremote.h > //must copy IRremote library to arduino libraries
- #include < Servo.h > #define plus 0xA3C8EDDB //clockwise rotation button
- # define minus 0xF076C13B //counter clockwise rotation button
- int RECV_PIN = 2;
- Servo servo;
- int val;
- bool cwRotation, ccwRotation;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- void setup() {
- Serial.begin(9600);
- irrecv.enableIRIn();
- servo.attach(9);
- }
- void loop() {
- if (irrecv.decode( & results)) {
- Serial.println(results.value, HEX);
- irrecv.resume();
- if (results.value == plus) {
- cwRotation = !cwRotation;
- ccwRotation = false;
- }
- if (results.value == minus) {
- ccwRotation = !ccwRotation;
- cwRotation = false;
- }
- }
- if (cwRotation && (val != 175)) {
- val++;
- }
- if (ccwRotation && (val != 0)) {
- val--;
- }
- servo.write(val);
- delay(20);
- }
Explanation
In this blog, I told about controlling the Servo Motor, using the IR Remote Sensor and the IR Remote control. It is used for the farmer also in real time projects. IR Remote will be fixed in the Servor Motor. Thus, we can easily control the Motor.