5-min Tutorials: Arduino IR Remote & Receiver

Поделиться
HTML-код
  • Опубликовано: 22 июл 2024
  • I recommend this Arduino and sensors kit to get started with Arduino:
    bit.ly/2CAcWtR
    This is a reliable IR sensor Remote:
    bit.ly/2WDfH4w
    Recommended soldering iron: TS100:
    bit.ly/3e81eUD
    Learn how to Setup, Code, and Test your IR Sensor-Receiver kit. This is a tutorial for Arduino IR (Infrared) remote controlled transmitter and receiver.
    This simple and easy to follow tutorial shows how to connect an Arduino to your household appliances (Lights, fans, etc. ) and control them with a $1 Infrared transmitter and receiver setup!
    The expertise level required for this is beginner. Infrared communication is a common way to control home appliances, like TVs. It is also possible to hack a TV remote to do the same job as the remote shown. If you liked this Arduino tutorial, do check out other easy arduino tutorials on my channel, and DIY Arduino projects.
  • НаукаНаука

Комментарии • 175

  • @Fungineers
    @Fungineers  6 лет назад +47

    Here's the code/ sketch guys. Happy Fungineering!
    (make sure to change your HEX numbers as per your remote)
    //code start//
    #include //include the library
    #define Button_1 0xFF6897
    #define Button_2 0xFF9867
    int receiver = 13; //initialize pin 13 as recevier pin.
    uint32_t Previous;
    IRrecv irrecv(receiver); //create a new instance of receiver
    decode_results results;
    void setup() {
    Serial.begin(9600);
    irrecv.enableIRIn(); //start the receiver
    pinMode(12, OUTPUT);
    }
    void loop() {
    if (irrecv.decode(&results)) { //if we have received an IR signal
    if (results.value==0xFFFFFFFF) {
    results.value=Previous;
    }
    switch(results.value) {
    case Button_1 : digitalWrite(12, HIGH); break;
    case Button_2 : digitalWrite(12, LOW); break;
    }
    Serial.println (results.value, HEX); //display HEX results
    irrecv.resume(); //next value
    }
    Previous=results.value;
    }
    //code end//

    • @rennellliwanag
      @rennellliwanag 6 лет назад

      Fungineers thank you sir it help me .

    • @ariesclark3272
      @ariesclark3272 2 года назад

      i guess I am kinda randomly asking but do anybody know of a good site to watch new series online?

    • @ansonzakai2062
      @ansonzakai2062 2 года назад

      @Aries Clark flixportal :D

    • @ariesclark3272
      @ariesclark3272 2 года назад

      @Anson Zakai thank you, I went there and it seems like a nice service :D I appreciate it!

    • @ansonzakai2062
      @ansonzakai2062 2 года назад

      @Aries Clark no problem =)

  • @alejandroperez5368
    @alejandroperez5368 6 лет назад +92

    Dude, you're going to destroy my speakers, change your microphone!!!

    • @Fungineers
      @Fungineers  6 лет назад +15

      Alejandro Pérez lol sorry this one was a little too bad. Working on getting a nicer micro :D

    • @lauromrcruz
      @lauromrcruz 2 года назад +2

      Lolololololol

  • @BL-yj2wp
    @BL-yj2wp 2 года назад

    Thank you, this is the first one of these readout programs that actually works.

  • @goldparty4731
    @goldparty4731 2 года назад

    Thank you so much, I have been trying to do this for 2 months and I finally got it working!!!

  • @rosebuddesign635
    @rosebuddesign635 3 года назад

    Hello, very interesting video. If I have an already set up Arduino do I need a second one to control it remotely or I can put this controller directly on the original one?

  • @RedScythe29
    @RedScythe29 3 года назад

    hello which library location should i put it in i didnt see how you did it in the vid

  • @ropo7852
    @ropo7852 4 года назад +3

    tks bro, i love this video that help me to practice my project

  • @arduinoprojects4404
    @arduinoprojects4404 4 года назад +3

    awesome.... sir could you please tell us the range of the receiver

  • @ink_sack2753
    @ink_sack2753 4 года назад

    im trying to use this library without using switch... case and im trying to put it into an if statement, but it wont work. what do i have to do in order to make it work?

  • @AndreSantos-ip9ij
    @AndreSantos-ip9ij 3 года назад

    Hi, i ve just done everything as u said but i dont get constant values, the hexa values keep changing whenever i press "1".
    Is there a way to fix this? Thanks

  • @jrl4907
    @jrl4907 4 года назад

    Hey thanks! I got it working!

  • @etzgustanalias1066
    @etzgustanalias1066 4 года назад +5

    Is it possible to copy and paste the code you have pinned into the i.d.e.?
    I'm programming from mobile and it's a pain to switch screens back and forth 😅

    • @Fungineers
      @Fungineers  4 года назад +4

      Use a pc man. It will save you pain haha

  • @soma97
    @soma97 3 года назад +1

    Thanks for that camera trick!

  • @MrIVORK
    @MrIVORK 3 года назад +18

    Pro tip for beginners: If you can smell your IR receiver, you got the wiring wrong 😞

  • @agusprayogo7932
    @agusprayogo7932 3 года назад +1

    Hey, my phone has built in infrared transmitter in it. Yes, i can controll anything with infrared receiver in it, such as TV, AC etc. My question is, can i use my phone as the remote replacement for the arduino? That would be perfect, so i dont need to carry the remote anywhere since i've already have my phone. Thanks

    • @Lastered
      @Lastered 3 года назад +1

      I think this would work

  • @Cinnamon404
    @Cinnamon404 10 месяцев назад

    Thank you so much, you helped me saving many hours reseaching about the ir recievers.

  • @johnberry5339
    @johnberry5339 4 года назад +1

    Hello I have just seen your channel for the first time and this tutorial is great.
    I have liked and subscribed, and I am going to watch some more of your tutorials. Thanks John :)

  • @developedmobile4692
    @developedmobile4692 3 месяца назад

    it can apply with esp32 ?

  • @williamkong4256
    @williamkong4256 4 года назад +3

    everything working well until no data showed on serial monitor. looks like the remote works tho based on your phone trick. Any ideas?

  • @JuanDavidAranda34
    @JuanDavidAranda34 Год назад

    Hi, I have a problem, hope u can help me. When I press, for example the first button, many codes appear on the screen not just one, I mean, it has to be one code for one button, and I dont know why is this happening. I hope u see this I really need help

  • @Lamoboos223
    @Lamoboos223 Год назад

    hi sir, one question .. when to use relay? like what does it do? i'm rookie still learning stuff

  • @bluessioa.l.3901
    @bluessioa.l.3901 4 года назад

    Hello! What about if I would like to press the button 1 and start a loop where I can exit whenever I press button 2 let’s say... thank you! I hope you’re reading this!

    • @isothepiano
      @isothepiano 3 месяца назад

      Hello! I know it's been 3 years but if you still need help, make a boolean variable and set it to true and false when the buttons are pressed. Add an if statement in the voidLoop method that checks for that variable.

  • @upontop4526
    @upontop4526 3 года назад +1

    it says no such file or derictory when i upload help please

  • @pnkswet2811
    @pnkswet2811 2 года назад

    my sierial monitor just keeps saying the distance is less than 5 and 60 and stuff how do i fix this

  • @vincentelizondo2118
    @vincentelizondo2118 4 года назад

    Is it possible to use an arduino nano because im trying to fit this into a pretty small space

    • @Fungineers
      @Fungineers  4 года назад

      Yea its the same thing. Just select the correct board from the Boards Manager

  • @harshrana2004
    @harshrana2004 2 года назад

    Thanks a lot sir!!

  • @ramraja7796
    @ramraja7796 4 года назад +1

    Hi John, Just copied and executed the sketch and it's giving an error....'receiver' was not declared in the scope why is that? if you can help please.

    • @calvinscarvings.66
      @calvinscarvings.66 3 года назад

      I think you need to write at the top
      #define receiver (the pin you have as the input for the receiver);
      pinMode, (INPUT);
      (Don't take this as fact, I'm a beginner and also this info is probably useless to you at this point 1 year later)

  • @ravikiranmunganda2489
    @ravikiranmunganda2489 3 года назад +4

    dear am getting this in the serial monitor what to do ?
    The function decode(&results)) is deprecated and may not work as expected! Just use decode() - without any parameter.

  • @fishyman2_023
    @fishyman2_023 Год назад +1

    I don't know why but when I try searching the button it says : The function decode(&results)) is deprecated and may not work as expected! Just use decode() without a parameter and IrReceiver.decodedIRData. .
    can someone help me please?

  • @iwan_fitri
    @iwan_fitri Год назад

    friend, I need help, why are all the generated code buttons all the same

  • @shrikantnikam2426
    @shrikantnikam2426 2 года назад +1

    I like it quick video no blah blah.👍

  • @alexigill2792
    @alexigill2792 2 года назад

    I am trying to do this on Arduino Uno and I get the error "Error compiling for board Arduino Uno". Does anyone know how to fix this or if anything can be done?

  • @StrexmerClipz
    @StrexmerClipz 2 года назад

    Hi bro,
    Pls HELP my code is not getting printed in the serial monitor
    Pls reply

  • @Sachinsingh-ph3xk
    @Sachinsingh-ph3xk 4 года назад +1

    Hey Bro I searched this module on Ali express but I could not find it. Please send a link to buy this module.
    Thank you

    • @ramraja7796
      @ramraja7796 4 года назад

      Try Banggood I got mine from them Infrared IR Receiver Module Wireless Remote Control Kit Geekcreit for Arduino - products that work with official Arduino boards
      £2.70

  • @unodragon2294
    @unodragon2294 2 года назад

    thanks it helped

  • @AsBi1
    @AsBi1 Год назад

    very nice very helpful

  • @CULTURE_dz
    @CULTURE_dz 4 года назад

    thanks a lot

  • @lozD83
    @lozD83 Год назад +2

    Next, we need a video on getting good audio levels without distortion

  • @killneyzs3079
    @killneyzs3079 2 года назад

    what are the ingredients to make it?

  • @ryanbeck4947
    @ryanbeck4947 2 года назад

    4:01 what symbol is that in from of the results in the if statement

  • @milutinrakovic5498
    @milutinrakovic5498 4 года назад

    Can somone give a sorce code download?

  • @WAQASJOGI
    @WAQASJOGI 6 лет назад

    Thanks for this informative video

  • @Ninjacat9000Ilovebigfloppa
    @Ninjacat9000Ilovebigfloppa 4 года назад

    Thanks

  • @RajivKumar-dq7pq
    @RajivKumar-dq7pq 5 лет назад

    Can we use this as the coding for a drone

  • @saimaayaz3288
    @saimaayaz3288 3 месяца назад

    I have done everything, but on pressing the buttons on my IR remote, nothing happens on the serial monitor

  • @jappiemoto
    @jappiemoto 3 года назад +2

    When i use &results to decode it it spaces out. It says i need to use decode() just without reaults but i only get 0’s as output please help anyone

    • @kingdavid4463
      @kingdavid4463 3 года назад +2

      I am getting the same thing, have you maybe already solved this problem?

    • @jappiemoto
      @jappiemoto 3 года назад

      @@kingdavid4463 nope i have not solved the problem yet 😕

    • @kingdavid4463
      @kingdavid4463 3 года назад

      @@jappiemoto I figured it out, you need to use version of library 2.8.0 or lower

    • @jappiemoto
      @jappiemoto 3 года назад

      @@kingdavid4463 can you explain how i do that please?

    • @jappiemoto
      @jappiemoto 3 года назад +1

      @@kingdavid4463 omg it worked thank man 🔥👊🏻

  • @jumbo999614
    @jumbo999614 3 года назад +3

    Hex value of each button of my IR remote keeps changing. Each time I press the button I get 2-4 set of repeated Hex values. Is this normal?

    • @iniyansaravanavel2954
      @iniyansaravanavel2954 3 года назад +2

      Yeah it's happening for me to

    • @AndreSantos-ip9ij
      @AndreSantos-ip9ij 3 года назад

      @@iniyansaravanavel2954 still nothing? i have the same issue too

    • @AndreSantos-ip9ij
      @AndreSantos-ip9ij 3 года назад

      i believe it is measuring how hard i press a button, not what the button itself represents... thats my theory

    • @c47tejassamant66
      @c47tejassamant66 2 года назад +1

      keep you remote straight in front of the receiver

    • @makers_lab
      @makers_lab 9 месяцев назад

      @@AndreSantos-ip9ij lol. it's just errors in the bitstream from poor reception.

  • @fault8440
    @fault8440 2 месяца назад

    Hi, thanks for tutorial, but i have a problem, every button transmits FFFFFFF only

  • @kalkidanseyfez2232
    @kalkidanseyfez2232 Год назад

    in serial manipulator the result of "FF'' for all keys

  • @Oyundabilgi
    @Oyundabilgi Год назад

    I see FFFFFFFF's on serial monitor. What could be causing?

    • @makers_lab
      @makers_lab 9 месяцев назад

      I did too at first, and it was because the example code gpt gave me (which is the same as this essentially) with incompatible with the latest version of the library. Updating how the library is used resolved.

  • @MrNoodlesRBLX
    @MrNoodlesRBLX 4 года назад +2

    How do include the remote

    • @MathiasBacher
      @MathiasBacher 3 года назад

      You don't have to include anything for the remote, you just have to include the library for the IR receiver

  • @techtom2171
    @techtom2171 3 года назад

    Sir is this C# language?

  • @montd
    @montd 6 лет назад

    Did I miss something or do you call out the left to right order for the wiring incorrectly? You said From left to right is ground, 5v power and output. Yet the spec sheet for the receiver is (from left to right 1 2 3) Output, Ground, Power. I have the same 1838 model, so I'm a bit confused there.

    • @Fungineers
      @Fungineers  6 лет назад

      You are right, follow the schematic at 1:47 instead of what I said. Thanks for pointing it out :)

    • @montd
      @montd 6 лет назад

      Sorry, wasn't trying to be THAT GUY. pointing out inaccuracies. It was more for my own sanity since this is my first project. Thanks for doing this.

  • @Thesouperkid
    @Thesouperkid 6 лет назад

    I don't see the Code anywhere.. and could you provide a link to the page with the adruino IR libraries?

    • @Fungineers
      @Fungineers  6 лет назад +1

      Hey Chris, the code is right here in the comments. I have pinned it now. The IRRemote.h Library can be found on Github; here's the link: github.com/z3t0/Arduino-IRremote
      Happy Fungineering!

  • @MrNoodlesRBLX
    @MrNoodlesRBLX 4 года назад +2

    #include
    It says their is no file directory.

    • @douglam3923
      @douglam3923 4 года назад +1

      same problem here. copied the folder into the libraries folder and removed the robotir folder. still stays "No such file or directory"

    • @douglam3923
      @douglam3923 4 года назад

      little more googling found that the issue might be fixed if you downgrade your arduino studio to something 1.5.xx. I dont really want to do that. Looking for other solutions.

    • @Ninjacat9000Ilovebigfloppa
      @Ninjacat9000Ilovebigfloppa 4 года назад

      u can get it in manage libraries.. when calling the library the Irremote doesn't turn orange though..

  • @Marina-vy8xh
    @Marina-vy8xh 3 года назад

    Why when I press the button the light isn’t turn on and instead of the code that should appear when you press it .. it shows 0 every time I press it

    • @andresvelasquez3373
      @andresvelasquez3373 3 года назад

      hey, i have the same problem. Did u find the solution?

    • @Marina-vy8xh
      @Marina-vy8xh 3 года назад

      @@andresvelasquez3373 it was a mistake algorithm ... it has to do with the library at the program

    • @andresvelasquez3373
      @andresvelasquez3373 3 года назад

      @@Marina-vy8xh and did you fix it? If so, could you help me?

  • @sebastian27002
    @sebastian27002 4 года назад

    So i've been doing the same code as u have, I've set it up the same as u have, but for some reason whenever i upload it, the serial monitor keeps adding "0" and when i press a button it doesn't register. Anyone able to help?

  • @copyman2456
    @copyman2456 2 года назад

    5V no results??? Now 3,3V and its working fine for my NANO

  • @SanjaySharma-pw6ww
    @SanjaySharma-pw6ww 2 года назад

    pls make a video on ir remote controlled circuit and push to on switches like we see in DTH receiver /tv.
    your video is very much helpful to me as i did not know coding earlier.
    thanks for your valuable video.

  • @Lann91
    @Lann91 3 года назад +1

    Does not work: "The function decode(&results)) is deprecated and may not work as expected! Just use decode() - without any parameter." Tried without parameters, still not working, now showing "0" values for every button.

    • @denisstrechie9139
      @denisstrechie9139 3 года назад +1

      In the Library Manager in Arduino IDE search for the IRremote library and use the 2.8.0 version!

    • @copyman2456
      @copyman2456 2 года назад

      try 3,3 voltage connection

  • @kekahazra9769
    @kekahazra9769 3 года назад

    Can't I code without having IR library?

    • @arpansharma5858
      @arpansharma5858 3 года назад

      no man,
      but it's better to use the web editor of Arduino if you are having some library troubles...

  • @milanshrimali1555
    @milanshrimali1555 5 лет назад

    Haiiii bro can you help me making a laser tag kit plzzzz

  • @rawlensbyrashed2452
    @rawlensbyrashed2452 6 лет назад

    Great!!

  • @gegel4845
    @gegel4845 2 года назад

    your logo hides the last line of code

  • @scinceman96game
    @scinceman96game Год назад

    no add a push button on the breadboard to control led

  • @swastikarora1109
    @swastikarora1109 3 года назад

    Whyyyyyy the ir remote changes its code in every second i press the button???????????????//

  • @pedrodias5031
    @pedrodias5031 Год назад

    Top

  • @Foxardo
    @Foxardo 3 года назад

    me: mum can we have a mic mom: no we have a mic at home the mic at home:

  • @morinonino3110
    @morinonino3110 3 года назад

    Arduino: 1.8.15 (Windows 7), Board: "Arduino Uno"
    sketch_jun27a:12:10: fatal error: IRremote.h: No such file or directory
    #include
    ^~~~~~~~~~~~
    compilation terminated.
    exit status 1
    IRremote.h: No such file or directory
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

  • @aayushtrivedi5173
    @aayushtrivedi5173 4 года назад

    noice!!

  • @ngkean9743
    @ngkean9743 2 года назад

    What's the range?

    • @zealotdraws3017
      @zealotdraws3017 Год назад

      The way ir works is a similar way to how visibly light works you just can’t see it and it bounces a lot more and through more. So there not much of a range outside a certain amount of feet. Depend on the power of the bulb

  • @kalkidanseyfez2232
    @kalkidanseyfez2232 Год назад

    button in serial manipulator the result of "FF'' for all keys

  • @Turjak_art
    @Turjak_art 4 года назад +1

    let me guess you're using your buzzer as mic

  • @jilljessurun2897
    @jilljessurun2897 4 года назад

    for me it only works with LED lights, but not with a motor. How is that possible? I adjusted the code to the electromotor but nothing happens :(

  • @Jack-xr3wk
    @Jack-xr3wk 5 лет назад

    Great video, but I keep getting the error message saying "IRremote.h: No such file or directory"

    • @Fungineers
      @Fungineers  5 лет назад

      Make sure you download the library

    • @Jack-xr3wk
      @Jack-xr3wk 5 лет назад

      I downloaded the library, but now my serial monitor isn't recognizing anything. Here is my code:
      #include
      int receiver = 13;
      IRrecv irrecv(receiver);
      decode_results results;
      void setup(){
      Serial.begin(9600);
      irrecv.enableIRIn();
      }
      void loop(){
      if (irrecv.decode(&results)) {
      Serial.println(results.value, HEX);
      irrecv.resume();
      }
      }

  • @cpowerdesign
    @cpowerdesign Год назад

    Why did my LED explode?

  • @user-on5zw1jp6w
    @user-on5zw1jp6w 24 дня назад +1

    Yey

  • @oguzaltnbas3108
    @oguzaltnbas3108 6 лет назад +1

    I can turn on the LED but can't turn it off using button. Can anyone help me?

    • @Fungineers
      @Fungineers  6 лет назад +1

      oğuz altınbaş is it showing up in the serial monitor when you press?

    • @oguzaltnbas3108
      @oguzaltnbas3108 6 лет назад

      Your question solved the problem. I just missed a few codes. Thanx.

    • @Fungineers
      @Fungineers  6 лет назад

      oğuz altınbaş what resistor did you put with LED? Try 220 ohm and different LED. Is you LED polarity correct? (Long leg positive short leg negative).

    • @Fungineers
      @Fungineers  6 лет назад

      +oğuz altınbaş enjoy :)

  • @Snowball-ni8mz
    @Snowball-ni8mz 4 года назад

    which libary to replace bruh? xd

    • @Fungineers
      @Fungineers  4 года назад +1

      Download the IRremote library

  • @prmajiq
    @prmajiq 6 лет назад +2

    where is code ?

  • @KrampusVsChristmas
    @KrampusVsChristmas 2 года назад

    Great video, but your audio can blow speakers.

  • @Electricman50001
    @Electricman50001 5 лет назад

    I know this is late but when i press the on button it just flashes on. It doesn't stay on

    • @Fungineers
      @Fungineers  5 лет назад

      Your arduino code is the problem

    • @tylerbyrne8019
      @tylerbyrne8019 4 года назад

      @@Fungineers No, it's not the code. I directly copied and pasted your code, tried it out, and still would not stay on, or turn off.

  • @edinfific2576
    @edinfific2576 2 года назад

    Why is your audio cracking? Overdriven microphone?

  • @Akroknight
    @Akroknight 2 года назад

    Great video but clean up audio

  • @minskie
    @minskie 2 месяца назад

    does not work.

  • @WeebooTTV
    @WeebooTTV 6 лет назад

    where is the code?

  • @christinacao6818
    @christinacao6818 3 года назад +2

    The mic is very bad

  • @jaydenlin7929
    @jaydenlin7929 6 лет назад

    down there

  • @hurried_coder404
    @hurried_coder404 3 года назад

    wo , bro fix the mic

  • @devilcloudleitung6080
    @devilcloudleitung6080 4 года назад +3

    ahhhhhhhhhhhhhhhhh my ears use a better mic

  • @chongkahyoon69
    @chongkahyoon69 3 года назад

    move away the "fungineers" it is blocking the code.

  • @cw4608
    @cw4608 4 года назад +1

    I’m reading all the comments/complaints about volume. Am I the only viewer with volume control on their device? Gosh so sorry for all of you victims.

    • @showcasevideos3
      @showcasevideos3 3 года назад

      It's called clipping. Turning down the volume doesn't help.

  • @isimpforeveryanimegirld4513
    @isimpforeveryanimegirld4513 4 года назад +1

    you have just electrocuted my self. And change your microfone

    • @ozone9011
      @ozone9011 3 года назад

      Ah yes, grammar at its finest.

  • @lukasjanky5831
    @lukasjanky5831 5 лет назад

    i just burn my ir reciever because 5v and GND have been change
    thanks😾😾

    • @Fungineers
      @Fungineers  5 лет назад +1

      Sad

    • @iandavis5329
      @iandavis5329 4 года назад +1

      Lukas Janky let it sit for a month and mine came back

  • @jaxxrr
    @jaxxrr 2 года назад

    your mic makes my ears bleed

  • @showcasevideos3
    @showcasevideos3 3 года назад

    The audio is so bad I can't play more than 10 seconds without stoping. Please re-record this video.

  • @shutdahellup69420
    @shutdahellup69420 6 лет назад +1

    Good video but not gonna lie the accents were kinda cringe af, feels like u were trying too hard to sound american.. (No offence)