Using 2 Pin IF Receivers/Emitters | Arduino Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's good everybody I'm gonna make a video on how to use two pin infrared receivers and the emitters there's not too many tutorials on how to use these so I'm gonna make a quick video showing you how to use them setting them up with your Arduino and reading input from them so let's go ahead and set up the circuit and then we'll look at the code alright so everything you're gonna need to do this is of course your Arduino your two pin infrared emitter and receiver a 10 ohm resistor a 10k resistor and of course breadboard and jumper wires let's go ahead and plug in our emitter and receiver now these are directional they point straight up because so you can have them really close to each other which makes things a lot easier because all we're trying to do here is bounce light coming from the emitter bounce it back into the receiver so let's plug those there we have our negative legs and our positive legs now the 10 ohm resistor this is for the emitter because this these specific ones that I got were only rated for forward voltage of like 1.2 to 1.5 volts so that's not very much you have to be careful with these ones so the only reason I have the resistor is because I'm plugging it into the 3.3 volt pin on the Arduino so go ahead and put that resistor on the positive end of your leg through the resistor into the 3.3 volts on the Arduino and then of course take your negative end of the emitter and plug that into ground okay there's the emitter now the receivers a little wonky you actually connect the power through the negative leg of the receiver so I'll show you how to do that so let's go ahead and connect negative end of the receiver which is rated for 5 volts plug that into 5 volt pin on the Arduino and then this 10k resistor is for the pulldown on the positive end of the receiver one part of the positive end goes into our analog 0 for reading the input and we put our pulldown resistor on the same track of the positive end and this goes to ground alright so there is our finished circuit I'm going to go ahead and give it a closer look and then we'll get to the code [Music] okay so here is our very basic Arduino sketch up here at the top you need your integer your infrared read which you will be displaying in the serial monitor and the set up course Tercero begin get your bod right there pin mode and arduino you have to set a zero not just zero for your input because we're reading it through the receiver and in your loop function you're going to be setting infrared read to analog read a zero our input analog input and then of course we're going to serial print line and Freret read and see what we get so let's go ahead upload that done uploading open the serial monitor and as you can see we're getting values at the low end around 250 260 right now and let's go ahead and start up here I can't see my hand but I'm coming down slowly reaching around 300 400 five six seven eight and all the way to nine almost 1,000 I can get about right there two reaches 982 983 now the resistor that we have full of pull down on the positive leg of the receiver that's determining what kind of values are getting you can use a 10k 5k it doesn't really matter just play around with it see what values you get which ones you prefer I think the 10k gives the best values this is what we're getting here these are the easiest to work with they're getting a nice range of values here and of course if you use a more reflective surface to get even better results around 993 just not a whole bunch more but it's definitely a lot more precise yeah yeah then of course if you use like a black surface you get her the end results cuz in Fred's being absorbed by the black but yeah that's the super simple setup for this your Arduino sketch is you know super freakin basic these infrared LEDs and receivers come in super handy for projects I'm doing a big project right now that I'm gonna be working on so I'm gonna be using a lot of these and my professor just helped me discover this because I was confused because a lot of things on the internet have just three prong receivers so you know I decided to make it a nice tutorial on how to use the two pin so thanks for watching and I'll see you next time
Info
Channel: Caleb Rowe
Views: 26,766
Rating: undefined out of 5
Keywords: infrared, arduino, tutorial, two pin infrared, 2 pin, 2 prong infrared, 3 pin infrared, emitter, arduino sketch, basic tutorial arduino
Id: _mOF1JXo1DU
Channel Id: undefined
Length: 5min 10sec (310 seconds)
Published: Tue Mar 20 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.