This is on infrared receivers and you will need an emitter(remote) to follow this. any infrared remote will work. (tv, cd player, led light) this one is a neat one that can be use for remote control of an arduino project!
Affiliate links for arduino sensors! Large Arduino Kit (Recommended) includes various sensors, a couple breadboards, loose components, pcb board, jumper wires, soldering iron AND more: https://www.banggood.com/custlink/mmKhdf9Si8
Want to send me something? Technivorous 902 n Hughes Blunt Sd 57522
All right folks, welcome to Arduino for Beginners. This is Arduino 101.
All right, today we are taking a look at an infrared receiver module. Now this is HW490 here
and this guy is pretty sweet. So what it does is it receives a signal from an infrared transmitter.
Now I have one here. This is a remote with one built in and you can normally tell by that little
LED looking diode there. And I also have a transmitter somewhere in here and I'll show
you how to assemble that and send a signal eventually here in one of these videos. But
this video we're going to focus on receiving a signal. So in order to do that we're going to
go ahead and reduce some of this noise here because I really only need two of these lines
and we don't need these. We'll leave those. No, let's do this the right way. So let's go to
okay. So I have my outward to my LED right here. This is connected to pin number five.
Then I have my signal from the IR here connected to pin number seven. So
that is what's being labeled our signal pin right here, receiver pin. And we are using a library
here, IR remote. So you're going to need to download and include that and then create an
instance of the IR receiver. Doing that takes care of the pins on the receiver for you. You
don't need to worry about that once you've made this constant integer here. So once we get going
in the setup, we are going to set our pin mode to output on what I have labeled G, which is that
LED right now. I was using three color. I'm down to just one for this demonstration because it's
a little simpler. And we'll take a look here in our loop. We're going to look at these two methods
mainly. Like I said, this is for a three color LED and on that LED, these other parts of this
loop, it's going to go through here, just change the color. And right now we just have a blue LED
plugged in. So we're just going to try to get it to turn on and off. So then there's another
command for the receiver inside of the loop.
Then we have this change color code here, which we are actually going to change what we're using
here. And I'm going to comment this out. And the reason I didn't just delete it is because I am
going to keep using this later and I'll show you how to use it. But for right now, what we need to
do is digital right G and we want it to be on. So this is going to be high and we'll copy and paste
this down here and do low. Then I will show you what's going on. Okay. So for right now, ignore
everything in here and just concentrate on this. So this is if IR receiver.decode gets results,
then we're going to use the serial monitor to print the results.value as a hex code. Now a
hex code looks like this. Um, and this zero X designation before these six digits lets you
know that it's a hex code. So again, skipping all this, just, let's just see what this does right
here. I'm going to go ahead and push this. I've already got it on here actually. So I can tell
you, but let's open the, Oh, I somehow deleted the hashtag. There we go. So we can open the
serial monitor here. Come on now. Ah, yes. We'll uncomment that later as well. Okay. Compiled.
It's uploading. Open the serial monitor here. And as you can see, slide this over here. Now
when I press on a button on the remote, I get a six digit code in the serial monitor.
That is the on button, I believe. Nope. That's the on button. That's the off button. So, um,
these are actually in the code right now programmed to do something, except there, there we go.
Turns it on. Um, and the off button will turns it off, turn it off. There's a half a second delay.
So if I press them real fast, sometimes it doesn't work. But, uh, what's happening is
I can press this button and ignore all these FFFs here. That's what happens when I hold it down.
But when I just touch it, I get this six digit code. So if I take that six digit code,
which is for this button here that says 50%, uh, if I take that code and plug it into one of these,
um, right here, and then change the name of this. So it prints, uh, 50% and then change the
function. So it'll do whatever I tell it to, as long as it receives that code. So, um, that's
basically how this works. It's pretty simple. Like I said, right now I have it set to, um,
not just it'll print, uh, when I hit the on button, it'll turn the light on. It'll also
say on button in the serial monitor, the same with the off button. So that's how I know what
button I'm hitting. I have a couple other ones programmed in here, but I have them commented out
and that wiring is a little bit more complicated. So we're not going to jump into that right now,
but this is the gist of how you get a receiver. So again, if I want to get a,
let's see what the code for this flash button is. Let's say I want to make that do something
with my Arduino. So if I hit the flash button, I get this code. I can just copy it, paste it in
here after the X, just these six digits. And then it'll say if results.value equals equals, and then
do flash button code. So pretty straightforward, pretty fun to play around with. Uh, like I said,
I had the three color out earlier. We'll do a different video on that as well. And then I will
show you how to do the IR transmitter as well as the receiver. So a couple more videos on IR,
but this one will pretty much get you up and running. If you have a remote that has a diode
built in and it's pretty fun to play with. Well, that's it guys, that's going to wrap up this
video. If you've noticed the shirt, the merch is available. Go ahead and check out the Teespring
merch link down below. It won't be available on a channel store until I reach 10,000 subscribers.
And so far I'm just about to hit 5,000. So it'll be a little while, a couple more months before
you see this on the actual channel, but they are available now. I have a couple other designs. Feel
free to pop over there and check them out and know that any purchase through the Teespring site
definitely helps to promote our site here and increase the channel's ability to make videos
in the future. So we appreciate all your support. Don't forget to check out the Teespring link,
check out our Patreon link, leave a like on this video and hit that subscribe button because we
have a lot more coming at you in the coming days.