Delivery throughout Europe

Ordered before 16:00 = Shipped today

Fast delivery with DHL

XNUMX days return *


Country

In this project you will learn how to connect an IR controller to a Arduino Uno and how to define the buttons.

  • Level - Beginner 25% 25%
  • Duration - 20 / 30Min 35% 35%
  • Costs - € 34,35 euros complete 30% 30%

Step 1: Requirements IR Remote control project

  • Arduino Uno rev3

    Arduino Uno Rev3 – ATMEGA328

    23,95 /19,79 excl. VAT
  • Premium Jumper Wires 40pcs 20cm F / M

    3,45 /2,85 excl. VAT
  • Arduino ir remote controller

    IR remote control kit

    5,95 /4,92 excl. VAT

Step 2: Build and Wire Arduino IR Remote

Now we are going to connect the IR Receiver.

The receiver has 3 Pins, one GND, one VCC and one Signal. The GND goes to GND, the VCC to 5V and the signal to Digital pin nmr 8.

Step 3: Read buttons

 

Each button on the remote control has its own code. We need to know what these codes are so that we can indicate later what each code should do.

To read the buttons, the code below must be uploaded to the Arduino.

 

#include

const int RECV_PIN = 8;
IRrecv irrecv (RECV_PIN);
decode_results results;

void setup () {

Serial.begin (9600);
irrecv.enableIRIn ();
irrecv.blink13 (true); }
void loop () {

if (irrecv.decode (& results))
{Serial.println (results.value, HEX);
irrecv.resume (); }}

If the code has been successfully uploaded, you can read the codes via the serial monitor that you open with the button at the top right of the IDE.

Every time you press a button, the corresponding code appears. If you hold down a button, it will read FFFFFFFF.

 

Step 4: Giving value to codes

In the previous step we learned to read the codes. Since it is difficult to remember which code belongs to which button, we are now going to give each code its own value. Button 1 becomes 1, button 2 becomes 2, etc.

 

  #include

const int RECV_PIN = 8;

IRrecv irrecv (RECV_PIN);

decode_results results;

unsigned long key_value = 0;

void setup () {

Serial.begin (9600);
irrecv.enableIRIn ();
irrecv.blink13 (true); }

void loop () {

if (irrecv.decode (& results)) {
if (results.value == 0XFFFFFFFF)
Serial.println (results.value, HEX);

irrecv.resume ();
switch (results.value) {
case 0xFFA25D:
Serial.println (“1”);

break; case 0xFF629D: Serial.println (“2”);
break; case 0xFFE21D: Serial.println (“3”);
break; case 0xFF22DD: Serial.println (“4”);
break; case 0xFF02FD: Serial.println (“5”);
break; case 0xFFC23D: Serial.println (“6”);
break; case 0xFFE01F: Serial.println (“7”);
break; case 0xFFA857: Serial.println (“8”);
break; case 0xFF906F: Serial.println (“9”);
break; case 0xFF6897: Serial.println (“*”);
break; case 0xFF9867: Serial.println (“0”);
break; case 0xFFB04F: Serial.println (“#”);
break; case 0xFF18E7: Serial.println (“UP”);
break; case 0xFF7A85: Serial.println (“OK”);
break; case 0xFF10EF: Serial.println (“LEFT”);
break; case 0xFF38C7: Serial.println (“OK”);
break; case 0xFF5AA5: Serial.println (“RIGHT”);
break; case 0xFF4AB5: Serial.println (“DOWN”);
break; } key_value = results.value; irrecv.resume (); }}

Just like in the previous step, we open the serial monitor in the IDE. If you press the buttons on the remote control again you should get the same as in the image below.

Of course this is only the basis of what you can do with this infrared remote control. Adjust the code to light different LEDs or create a remote controlled robot.

The rating of www.elektronicavoorjou.nl at WebwinkelKeur Reviews is 9.3/10 based on 4971 reviews.