this is the photoresistor. part number HW-486 and its really fun. there are a ton of cool things you can do with this arduino module. if youre enjoying these tutorial please...
Like and Subscribe!
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
AI Generated·May contain errors
All right folks, welcome to Arduino for Beginners. This is Arduino 101.
And we're looking at this little guy. Now this is a photoresistor. This one is pre-built onto a board
and the board is labeled HW486. Now what this does is senses light and how much of it. And you can
use this to turn things on and off depending on whether or not it's daytime or nighttime.
And it's a pretty handy little device. But let's jump over to our code real quick
because it's super simple and I want to show it to you before we get this running.
So the first thing we have up here is the sensor pin. And we are hooked into number two. But we
are hooked into analog number two. Not the digital pin. We're in the analog pin.
And then we have an integer value at zero. And that's it. We're going to go right into setup,
turn on our serial monitor with a baud rate of 9600. And then we're going to jump right into
the loop. And all we're doing is setting value, this integer here, equal to the analog read of
the sensor pin. That's right. Analog read. Not digital read. Then we are going to hit serial dot
print line and then the value in decimal here. So basically it's going to print low values if
the light is really high and high values if the light is really dark. So then there's a little
delay in there. And I will show you this through the serial monitor. Let's go ahead and upload.
And it doesn't take long at all. Pretty quick little sketch. Go ahead and grab the serial
monitor. And it is already outputting data. So we're getting about 210 there. What happens if
I point it at my production lights? It goes down even lower. What happens if I cover it with my
hand? Well then you get your super, super dark high values there. And when I move away my hand,
super, super low because it's getting a lot of light. And I can actually turn this a little bit
more and make it a little glare. But you can see it affect the sensor. Super, super sensitive sensor.
So that's the reason we're using the analog input is because we want all those different values,
not just an on or an off. Because that will allow you to do something like adjust the dimness of
dimness of the lights in your smart home according to how much ambient light is around. So you can
put out more power to the overhead lights if not enough light is reaching the floor. Say because
the sun's going down or something like that. So pretty interesting and handy little device.
They do have them without being attached on the board. I don't know if I have one around here,
but they look just like this simple component right here. And they're fairly easy to hook up
and fun to play around 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 am 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.