Arduino staxexchange Make Servo Move by Clapping and Then Move Again by Clapping

Arduino can hands control the DC servo motor and rotate it at an exact, required angle. The Arduino has analog output through which information technology generates PWM that is used to rotate servo motor at a specific angle. You tin can motion 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 bachelor, hand held IR remote which we tin can find in all nigh all the homes for Tv, Ac, music systems, DVD or fifty-fifty for STB (set up peak box). Similar, we can movement the motor to specific angle like 30o, 60o, 90o etc or we can linearly increment or subtract motor bending using IR remote – whatever IR remote. Doesn't this sound great?

The given project demonstrates how to move servo motor at specific angle using IR remote (like Telly, 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 tiptop box (STB) IR remote, TSOP IR sensor and Arduino UNO board. Anyone tin use any type of IR remote. Just he has to change the remote codes in the Arduino sketch (program) for the remote. This process is also described hither while explaining the performance. So allow us see how this is washed.

First run into the circuit diagram followed past its clarification and operation.

CIRCUIT DESCRIPTION

As shown in figure, the circuit is built using 2 components merely 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 Five from board and Gnd concluding 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 indicate input pin to drive the motor

• The servo motor is given external v Five supply

Hither is the snap of circuit arrangement.

Fig. one: Paradigm of Arduino and IR Remote based DC Servo Controller

Excursion OPERATION

Showtime we take to decide, which are the different buttons of IR remote, that we will use to rotate servo motor. Nosotros desire to perform following deportment – :

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

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

I have used set height 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 post-obit vii buttons for different operations.

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

Subsequently deciding the buttons, adjacent is to decode the codes of these buttons. As nosotros know when any push button is pressed from remote, information technology volition send one code and based on this code the action is performed. And so to decode these codes I accept used IRremote library for arduino, readily available on cyberspace.

And so download the library and use instance to decode the codes of remote buttons. Upload the program into arduino micro controller and connect IR sensor as shown in figure. At present point the remote control towards IR sensor and printing the push. Open serial monitor and y'all tin can detect the code of pressed button in form of numbers. Notation down the codes of required buttons like I have noted the codes as per following tabular array – :

In the arduino sketch above codes are used corresponding to button pressed to perform action equally per previous table. Now let u.s. run across the actual performance.

• Motor is given supply from external five V and arduino board and IR sensor is given supply form USB. When ability is applied the motor moves to 0o. The letters displayed on serial monitor as "IR remote controlled servo motor" and "servo motor bending 0 deg"

• Now equally button 1 is pressed from remote motor will move to 30o and too when button 2, 3, 4 or 5 is pressed motor will move to the desire angle 60o, 90o, 120o or 150o. The series monitor likewise displays servo motor angle position as "servo motor angle 20 deg"

• When book upwards push is pressed, the motor angle increased by 5o – means if information technology'south on 30o, it volition motility to 35o and likewise. The new angle position is displayed on serial monitor.

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

Thus with the help of arduino, nosotros tin 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 together 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()                        {                                      Series.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");                                      filibuster(2000);                        }                        void loop()                        {                                      while(!(irrecv.decode(&results))); // await until no push button is pressed                                      if (irrecv.decode(&results)) // when button is pressed and code is received                                      {                                      if(results.value==2210)  // check if digit 1 push is pressed                                      {                                      Serial.println("servo motor angle thirty deg");                                      motor_angle = 30;                                      servo1.write(motor_angle); // movement the motor to thirty deg                                      }                                      else if(results.value==6308) // if digit 2 button is pressed                                      {                                      Series.println("servo motor bending 60 deg");                                      motor_angle = 60;                                      servo1.write(motor_angle); // motion the motor to 60 deg                                      }                                      else if(results.value==2215) // like wise for all  digit buttons                                      {                                      Serial.println("servo motor bending 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 bending 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+=v; // increase motor angle                                      Serial.print("Motor angle is ");                                      Series.println(motor_angle);                                      servo1.write(motor_angle);         // and movement the motor to that bending                                      }                                      else if(results.value==6292)  // if volume down button is pressed                                      {                                      if(motor_angle>0) motor_angle-=5; // subtract motor angle                                      Serial.print("Motor angle is ");                                      Serial.println(motor_angle);                                      servo1.write(motor_angle);      // and move the motor to that bending                                      }                                      delay(200);      // wait for 0.ii sec                                      irrecv.resume();     // again be ready to receive side by side code                                      }                                      }                        ###                              

Circuit Diagrams

Circuit diagram arduino ir remote based dc servo controller

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

Project Video

floresdonlyn.blogspot.com

Source: https://create.arduino.cc/projecthub/ambhatt/ir-remote-controlled-dc-servo-motor-using-arduino-e41aff

0 Response to "Arduino staxexchange Make Servo Move by Clapping and Then Move Again by Clapping"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel