Get Started in Electronics #10 - Using the Infrared Remote and Sensor
Вставка
- Опубліковано 5 вер 2024
- Hello, 3D Printing and Electronics friends! Today we're going to see how to use the Infrared Remote Control and IR Sensor to control an Arduino Uno! Well...Actually it's Elegoo's version, but still.
In this series, we're using the Elegoo Uno Super Starter Kit. Want to buy an Elegoo Uno Super Starter Kit for yourself? You can pick one up here:
• amzn.to/2B92t4i 🇺🇲US [affiliate link]
• amzn.to/2IR2n5n 🇨🇦Canada [affiliate link]
LINKS:
BV3D Arduino Prototyping Base
• www.thingivers...
Arduino IDE Download Page
• www.arduino.cc...
Elegoo Download Page
• bit.ly/2UQVG9d
Did this video help you out, save you a bunch of time, or help you learn something new?
If so, please consider becoming a channel member, or buying me a coffee, or leaving a tip! Your support really helps, and is VERY MUCH APPRECIATED!
✅ BV3D Channel Membership: ua-cam.com/users/bv...
☕️ Buy Me a Coffee: www.buymeacoff...
👍🏻 PayPal tip jar: www.paypal.me/...
*️⃣ The BV3D Channel Storefront on Amazon:
• www.amazon.com...
*️⃣ Popular 3D printer affiliate links:
• BIQU: shrsl.com/3s4hr
• Creality: shrsl.com/3qu2u
• Comgrow: bit.ly/33xcDtB [Check out the Creality REFURBS!]
• Elegoo: shrsl.com/3pu98
• FLSun: flsun3d.com/?r...
• Pergear: bit.ly/BV3Dper...
• Sovol: bit.ly/3h90d2L
• Sunlu: bit.ly/3hGNzpQ
• Voxelab: bit.ly/3vVG9Wq
*️⃣ In the market for a magnetic flexible build system for your 3D printer?
💥Wham Bam Systems flex plates: bit.ly/2YzogLZ
As a Wham Bam Systems Associate I earn from qualifying purchases.
*️⃣ Shop for just about anything:
🛒🇺🇲US: amzn.to/2x4hBxS [affiliate link]
🛒🇨🇦Canada: amzn.to/2Ycb5ju [affiliate link]
As an Amazon Associate I earn from qualifying purchases.
SOCIAL MEDIA
Follow me on Twitter (@bryan_vines): / bryan_vines
Disclosure:
I sometimes receive compensation such as discounted or free products, and when applicable, this is disclosed in videos and their descriptions. Whether free, discounted, or paid full price, any reviewed product is tested to the best of my ability, and I give my honest impression. All opinions expressed are my own.
#BV3D
#BV3DChannel
#3DPrintingFriends
Please continue on with the series i have a lot of unused components that i really want to use
It would be cool if you could make a video where you showed us how to set up a buzzer with the remote. Thank you for this awesome series!
As of August 2022, the download on Elegoo doesn't seem to provide the "IR" file anymore, so I can't "#include..." the correct ".h" files for this tutorial to work. And it can no longer be found in the Arduino Library lists. It doesn't recognize the "IRrecv" command also. Any ideas? I really want to learn how to use this IR sensor. I love this video series though. Great job so far.
Awesome! I learned so much in this series. Keep posting and keep it up! Great puns :)
I've learned so much while watching these Arduino videos. You're an excellent teacher. I hope to learn more from you from this Elegoo Super Starter Kit.
why are you soooooooooo good at explaining ??
but really i have learned a lot from this series and i hope you keep uploading awesome videos
The coding detail in this demo is really valuable to me with what I'm trying to develop since my project requires redefining the functions of the remote's 21 keys. Thanks heaps, Bryan. (subscribed)
I sincerely appreciate your explanations and humor!!!
Another great video! However, please everybody pay attention to order of the cabels,if you have another type of receiver. For example, number of my receiver is 1838(written on top of the receiver) and i almost burnt it, because the cabel order shawn on the video was different than mine😂
thanks , i was so glad when you said you were not using the code that came with the kits i had been trying using the code that came with kit and others on the web. do you know how awesome and helpful you are. the builtin codes are awful . yes i can spend hours figuring it out and learn a little but i learned a lot more following you and your explanations.
mr vines, your jokes are what keeps me from short-circuiting my bloodstream :D
Every time I pick up a new hobby I look up videos about it and you have some on it as well. My dude lol
Super video! I applauded for $5.00 👏👏
Hi Seth! I realize this is like a year late, but THANK YOU very much! UA-cam rolled out this Applaud feature (now called Super Thanks) but, until very recently, didn't give creators an easy way to find them. Now they have, and I wanted to say I am grateful for your support!
Almost 10K views and less than 400 likes?? Come on guys, the Dad jokes alone are worth a like!! 🤣🤣🤣
So true
Great Video, Keep it up.
Thanks, Olly 😀
This awesome video needs to be uodated. thank you
lol i love your jokes.
im starting from scratch as a level 0 programmer and am working my way through your lessons. i really appreciate your channel. subscribed. happy holidays my guy
Thank you!!i also would love to make reviews!!😊
YOU ARE AMAZING THANK YOU
Love the video man keep it up
Thanks, will do! 👍
Again great stuff. Unfortunately I couldn't follow along with this video because the files that you have on this video is very different from the ones on the link below.
hi Bryan, thanks for your videos!
after 10 lession with you i got the first truble but i can't figure it out; quickly: my Serial.begin(9600) doesn't show my nothing else than "IR Receiver Button Decode
"; with every button i press the receiver is blinking (red led on the board) but nothing is Printed on my serial monitor.....how???!
Im having the same problem and the led doesn’t turn off i left it alone for a while came back it turned off but soon as i touched it again after a couple uses it went back to the same thing led on and when you press the button it lights up more and I literally copied the code and its not working im so confused
same here
I figured it out. There are 2 steps you need to try in the following order. A) Most probably you have installed the latest version of IRRemote library (as I have done) which was updated about a week ago and has some syntax changes. Modify your code so that it reflects them. I will paste my working example below for your reference. B) I read that IRRemote library sometimes conflicts with preinstalled IR Robot Remote Control libraries. Try deleting them. I hope this helps!
also posted a comment about the same issue without seeing this thread, still havnt been able to get it working though
Edit: i figured it out! read my original comment under this video for a walkthrough
how come my second library didn't load? I couldn't check the file because IR.h didn't exist? How do I get around this? Cheers
My kit didn't include an "IR.h" file either, just came with the "IRremote.h." You can download the version he uploaded if you want the file.
Really nice presentation style.
Cool video! If u know, could u make a video about how to use the rgb matrix board? I
have one but can't figure out how to work it. Thanks for this series :)
thank youuuuu so much this is outstanding
some more work on the thumbnails and this channel will BLOW UP!! love this channel
Sadly elegoo removed this test code from latest download.
Hey Bryan, When I go to the link in the description for Elegoo, it takes me to V1.0, which I already have, not V2.0 which appears to have the library "IR.h". Help!
My monitor says "The function decode(&results)) is deprecated and may not work as expected! Just use decode() without a parameter and IrReceiver.decodedIRData. ." what do i do?
Excellent video!
Hi Brian
I love the videos. I have the kit and am starting to use it, but when are you going to do more of the videos for the kit please?
Regards,
Nigel
I have a different code called IR_Receiver_Module... I don't know what to do! Great video though as always!
Could you make an updated tutorial to this because IRremote by shirif does not exist anymore only IRemote by Armin Joachimseyer also elegoo has updated there code . If you do make an updated tutorial thanks you
Shriff does exist, but the code is different. Im having issues as well.
I just discovered this video and your channel, and it's phenomenal! I'm working with exactly the same kit you're using, and I have a couple of observations from doing this project.
1. The version of the IRremote library is crucial for this sketch to work properly. I could only get it to work with 2.80. I know there were MAJOR changes with the 3.X versions, but I couldn't even get it to work with 2.81. Your video helped me figure out the source of my issue, and this solved my frustration.
2. The sketch works great, with the exception of one button: the FastForward. For some reason, this button displays "FAST FORWADOWN
" in the serial monitor. I assumed there was a typo in the IR.h file, but I can't find it. Does your kit/sketch also display the wrong name for this button? Any ideas why this would happen?
Thanks again for your awesome work! I'm definitely a new fan!!
If you are still interested:
You are right, the error comes from the IR.h file. It seems to do this when the strings of text in the keyBuf array are too long. Change the length of the strings in the declaration of the array. In other words, you should have something like this: char keyBuf[][15] = {everything here stays the same};
@@rafalocity Thank you so much for the explanation! I still have a lot to learn about Arduino sketches. 😀
@@kwouters You're welcome! Keep on learning!
If you are watching this in the future now the updated material is oct 2020
Do you know the treat to get the same file?
I can’t find the instruction to the IR.H file and I can’t find the Irremote by Shiriff. Can you please help. Thank you
i have a problem, when i connect every cable, (i checked and they are successfully connected correctly), the red led on the ir receiver just turns on and keeps there, which first i didnt mind but when the code didnt work i tried disconnecting the yellow one, and now the receiver worked, but i cant use it cause it has no pin point to make me use the code, help please
I have been trying to follow this lesson. The information you have is very different than what downloads from elegoo. The file auto-downloads. I have been unable to download the sketch that is as up-to-date as yours.
--- me too. the download is the same as the CD, from 2019 --- 11APR22
Library has since been deprecated. Receiver still flashes for input but nothing is printed on the monitor. Instead, I get the following warning in the Serial Monitor:
---------------------------------------------------
Thank you for using the IRremote library!
It seems, that you are using a old version 2.0 code / example.
This version is no longer supported!
Please use one of the new code examples from the library,
available at "File > Examples > Examples from Custom Libraries / IRremote".
Start with the SimpleReceiver or SimpleSender example.
------------------------------------------
I did try some of the 'examples' code but they weren't compatible with this lesson.
Any ideas
Did you ever figure it out? I got similar issues
@@rayzr8945 Sorry mate, I don't honestly recall. I have a feeling a moved onto another exercise with my Arduino.
Okay so I know this tutorial was posted a while ago and the PDF Elegoo tutorial was posted even longer ago but the code simply did not work for me. The first thing I had to do was write a program that decoded each button by printing it's HEX number in the serial monitor because the ones in the code were wrong. After doing that I wrote the code below. It is not elegant but it gets the job done.
#include "IRremote.h"
IRrecv IR(11);
int ledPin = 8;
void setup()
{
IR.enableIRIn();
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if(IR.decode())
{
if(IR.decodedIRData.decodedRawData == 0xBA45FF00){Serial.println("POWER");}
if (IR.decodedIRData.decodedRawData ==0xB847FF00) {Serial.println("FUNC/STOP");}
if (IR.decodedIRData.decodedRawData == 0xB946FF00) {Serial.println("VOL+");}
if (IR.decodedIRData.decodedRawData == 0xBB44FF00) {Serial.println("FAST BACK");}
if (IR.decodedIRData.decodedRawData == 0xBF40FF00) {Serial.println("PAUSE");}
if (IR.decodedIRData.decodedRawData == 0xBC43FF00) {Serial.println("FAST FORWARD");}
if (IR.decodedIRData.decodedRawData == 0xF807FF00) {Serial.println("DOWN");}
if (IR.decodedIRData.decodedRawData == 0xEA15FF00) {Serial.println("VOL-");}
if (IR.decodedIRData.decodedRawData == 0xF609FF00) {Serial.println("UP");}
if (IR.decodedIRData.decodedRawData == 0xE619FF00) {Serial.println("EQ");}
if (IR.decodedIRData.decodedRawData == 0xF20DFF00) {Serial.println("ST/REPT");}
if (IR.decodedIRData.decodedRawData == 0xE916FF00) {Serial.println("0");}
if(IR.decodedIRData.decodedRawData == 0xF30CFF00) {Serial.println("1");}
if(IR.decodedIRData.decodedRawData == 0xE718FF00) {Serial.println("2");}
if(IR.decodedIRData.decodedRawData == 0xA15EFF00) {Serial.println("3");}
if(IR.decodedIRData.decodedRawData == 0xF708FF00) {Serial.println("4");}
if(IR.decodedIRData.decodedRawData == 0xE31CFF00) {Serial.println("5");}
if(IR.decodedIRData.decodedRawData == 0xA55AFF00) {Serial.println("6");}
if(IR.decodedIRData.decodedRawData == 0xBD42FF00) {Serial.println("7");}
if(IR.decodedIRData.decodedRawData == 0xAD52FF00) {Serial.println("8");}
if(IR.decodedIRData.decodedRawData == 0xB54AFF00) {Serial.println("9");}
delay(1000);
IR.resume();
}
}
could you upload that to a drive and link it?
i updated your code:
#include
int receiver = 11; // Signal Pin of IR receiver to Arduino Digital Pin 11
/*----( Declare objects )----*/
IRrecv irrecv(receiver); // create instance of 'irrecv'
/*----( Function )----*/
void translateIR() // takes action based on IR code received
// describing Remote IR codes
{
switch(irrecv.decodedIRData.decodedRawData)
{
case 0xBA45FF00: Serial.println("POWER"); break;
case 0xB847FF00: Serial.println("FUNC/STOP"); break;
case 0xB946FF00: Serial.println("VOL+"); break;
case 0xBB44FF00: Serial.println("FAST BACK"); break;
case 0xBF40FF00: Serial.println("PAUSE"); break;
case 0xBC43FF00: Serial.println("FAST FORWARD"); break;
case 0xF807FF00: Serial.println("DOWN"); break;
case 0xEA15FF00: Serial.println("VOL-"); break;
case 0xF609FF00: Serial.println("UP"); break;
case 0xE619FF00: Serial.println("EQ"); break;
case 0xF20DFF00: Serial.println("ST/REPT"); break;
case 0xE916FF00: Serial.println("0"); break;
case 0xF30CFF00: Serial.println("1"); break;
case 0xE718FF00: Serial.println("2"); break;
case 0xA15EFF00: Serial.println("3"); break;
case 0xF708FF00: Serial.println("4"); break;
case 0xE31CFF00: Serial.println("5"); break;
case 0xA55AFF00: Serial.println("6"); break;
case 0xBD42FF00: Serial.println("7"); break;
case 0xAD52FF00: Serial.println("8"); break;
case 0xB54AFF00: Serial.println("9"); break;
default: Serial.println("Other button:"); break;
}
delay(100);
} //END translateIR
void setup() /*---( SETUP: RUNS ONCE )---*/
{
Serial.begin(9600);
Serial.println("IR Receiver Button Decode");
irrecv.enableIRIn(); // Start the receiver
}
/*-(end setup )--*/
void loop() /*---( LOOP: RUNS CONSTANTLY )---*/
{
if (irrecv.decode()) // have we received an IR signal?
{
translateIR();
irrecv.resume(); // receive the next value
}
}/* -(end main loop )- */
I am facing issues while making a 4 relay module driven AC switchboard controlled by IR Remote.
Can you help me?
I am from India, so the remote could be different and I don't have the extra .h file you had with all codes. I need to retrieve codes first using code from KEN SHIRIFF example and then develop code using retrieved HEX values for my project.
Please let me know if you can help, thanks already.
the part 2 moduler learning is no longer there
I look at your video and copied all the code, and changed mg version to see if it works and am getting error within the IR.ino portion.
how does it know what pins are the input from the receiver?
That's a great question, and I didn't address it in the video.
The receiver pin is defined in the IR.h file, on line 4: *#define** RECEIVER 11*
This is used in IR.ino, on line 7: *IRrecv irrecv(RECEIVER);*
So, the RECEIVER label is defined as 11, and then that value is used when setting up an instance of IRrecv.
Another highly entertaining & educational video. Keep the #DadJokes coming. Thanks Bryan
Why do some tools need a power5 v while others don't?
You abandoned me! Will you be doing videos for all of the code that comes with the starter kit? I need to motion-activate a step motor and I can't go on without you.
I cant seem to find this code example I can only find code from 2016 I can think it does the same thing though
Edit I think it’s the same it just doesn’t include ir and uses the code name for buttons
They have different code for this now and I don't know if it's just me (I may have a faulty remote or something) but the code out of the box gives some odd outputs to the serial monitor. I tried to add an if statement for the led similar to yours and got it to sort of work.. the led blinks instead of staying on or off ¯\_(ツ)_/¯
how do i code it? i code java but how i get app can just use any coder?
hello! I've been enjoying your videos very much but for some reason, the included source code with this module doesn't seem to work.
i think it has something to do with a recent update to the IRremote library. but I am getting lots of orange error text and can't get the serial monitor to register pressed remote buttons
Problem solved!!
at 7:38 when he shows what to install he is installing the old library which doesn't compile the code properly anymore
remove any IR libraries you may have installed by going to documents>arduino>libraries and deleting any libraries named IR, IRremote, etc
then go to your IRremote module and copy the IRremote library folder to the Arduino libraries folder. your code should now work as expected!
ps. this advice came straight from elegoo customer service but they have not yet responded about whether or not they will be updating their example codes to match the new updated 3.0.1 IRremote library
Thank you!
I've been thinking that I'd like to learn more about coding the Arduino. How did you get started? Is it more like Java or C++?
The Arduino uses C as its programming language.
it didnt want to put the other tab thier
When i download the file from the internet, my code is different than yours, I understand it was probably updated, but I can’t get it to work. Ive watched many other videos, but it never works. If anyone knows what to do id appreciate feedback. Thanks.
--- me too. the download is the same as the CD, from 2019 --- 11APR22
# There's always the "remote" possibility of something going wrong
STUPID STUPID his jokes r STUPID
unfortaintly the irremote.h is not longer downladable
4:14 Deutschland (Germany)
Did not work.
this worked for me:
#include
int receiver = 11; // Signal Pin of IR receiver to Arduino Digital Pin 11
/*----( Declare objects )----*/
IRrecv irrecv(receiver); // create instance of 'irrecv'
/*----( Function )----*/
void translateIR() // takes action based on IR code received
// describing Remote IR codes
{
switch(irrecv.decodedIRData.decodedRawData)
{
case 0xBA45FF00: Serial.println("POWER"); break;
case 0xB847FF00: Serial.println("FUNC/STOP"); break;
case 0xB946FF00: Serial.println("VOL+"); break;
case 0xBB44FF00: Serial.println("FAST BACK"); break;
case 0xBF40FF00: Serial.println("PAUSE"); break;
case 0xBC43FF00: Serial.println("FAST FORWARD"); break;
case 0xF807FF00: Serial.println("DOWN"); break;
case 0xEA15FF00: Serial.println("VOL-"); break;
case 0xF609FF00: Serial.println("UP"); break;
case 0xE619FF00: Serial.println("EQ"); break;
case 0xF20DFF00: Serial.println("ST/REPT"); break;
case 0xE916FF00: Serial.println("0"); break;
case 0xF30CFF00: Serial.println("1"); break;
case 0xE718FF00: Serial.println("2"); break;
case 0xA15EFF00: Serial.println("3"); break;
case 0xF708FF00: Serial.println("4"); break;
case 0xE31CFF00: Serial.println("5"); break;
case 0xA55AFF00: Serial.println("6"); break;
case 0xBD42FF00: Serial.println("7"); break;
case 0xAD52FF00: Serial.println("8"); break;
case 0xB54AFF00: Serial.println("9"); break;
default: Serial.println("Other button:"); break;
}
delay(100);
} //END translateIR
void setup() /*---( SETUP: RUNS ONCE )---*/
{
Serial.begin(9600);
Serial.println("IR Receiver Button Decode");
irrecv.enableIRIn(); // Start the receiver
}
// }/*-(end setup )--*/
void loop() /*---( LOOP: RUNS CONSTANTLY )---*/
{
if (irrecv.decode()) // have we received an IR signal?
{
translateIR();
irrecv.resume(); // receive the next value
}
}/* -(end main loop )- */
@@HackerFlavio Do you know how to make the led turn on?
I R Baboon.
I M Weasel 😂
@@BV3D hehe glad you got the reference and it made you smile.
Michael Dorn voicing Weasel was one of the best parts of that show. Thanks for reminding me of it!
@@BV3D truly. Keep up the good work fella.
some thing wrong # dad joke +_+