Placeholder Image

字幕列表 影片播放

  • Please go to the line, the computer guy dot com and failed normal dot com to see the videos that are too dangerous for YouTube.

  • Welcome back in this particular video, I dare say we're going to do a project that is actually valuable for a lot of the geeks out there.

  • So all the geeks out there, let's see a raise of hands.

  • How many of you folks have been told?

  • One of the ways to improve your health?

  • One of ways to improve your mood is to get house plants and you've gone out there and you did you delicately about house plants and then you didn't couldn't figure out when the water them and went not to water them.

  • And so the houseplants died.

  • And you're sitting in there just looking at this kind of disgusted lump of stuff.

  • That fungus is growing over wondering why in the hell this is supposed to make you feel better and hands and hands any folks out there that I've done that.

  • Well, one of the big problems is you go out there, you get house plans, and then the question is, is when do you water them to make sure that you water them when the when the soil is dry.

  • But to make sure you don't overwater them.

  • I mean, how many times you have that problem?

  • You sit there, Go Oh, I haven't wanted the plan in a week.

  • And so then you wanted a plan.

  • And then the next day you're looking at the flan going crap that water the plant yesterday, I'm not sure sold up a little bit more water in there and then the plane from drying out.

  • Now it's drowning.

  • It's that's all kinds of bad.

  • You know, if you haven't done it, you at least have a friend who has.

  • So we're going to be doing today with this particular project is we're going to be using one these analog soil moisture sensors, and we're going to be using l A days.

  • So when the moisture is below with moisture, the analog reading that we're getting is low.

  • So basically, remember where we're trying to figure out the resistance here.

  • So the less resistance, the lower the number, the Maur moisture, there isn't soil, so the lower the number, the more moisture.

  • So what we're gonna d'oh is if we're getting a reading of below 300.

  • Then we're going to light up the green led because that says, Okay, we're getting a lot of conductivity through here, so that means there's there's moisture here, so we're going to say that the soil is moist, but if the number is above 300 we're going to turn on the red L e d.

  • To say, Hey, we probably need to water the plants.

  • Oh, this is going to give you a visual cue a visual notification on when to or not to want in your plant.

  • Now to be clear here now, to be clear for any of the gigs, I'm not saying that the Level 300 is the level that's appropriate for your particular plant.

  • We are going to read out to the serial monitor in this project to see what our sensors are reading.

  • So if you're going to do this in the real world, what I would say is figure out what moisture level your plants should be shoved a little moisture sensor in there, get your reading and then create the very opal based off of that reading.

  • The other thing that we're going to do in this particular project is we're going to use it not just one, but to moisture sensors.

  • Remember, with moisture sensors, Europe were able to take an analog reading and you're using even an Arduino, you know, bored.

  • You're able to have at least five analog inputs.

  • So we're gonna do is we're gonna have two of these connected to the Arduino, you know, just to show you that you can use one board in order to create a system for multiple pots.

  • So again, if you go out there and you buy a couple of herbs and a couple of other things, you have five pots.

  • You can actually put five moisture sensors in one moisture sensor per pot and then have a notification system.

  • So you know Oh, my, my garlic or whatever, that needs water.

  • But my tomato plant is okay.

  • So with that, let's go over to the work bench.

  • I'll show you the components and how to build this thing.

  • Then we'll do the code, and then I'll bring it all together to show you how it works.

  • Now here is the project, as it's been built, now may look a little bit more complicated than it actually is.

  • If you divide this off into its own separate components, you realize that this is a relatively simple project.

  • So again, we're gonna be using to moisture sensors.

  • So one, too.

  • So we have two sets of spikes, and then we have to control our boards for these moisture sensors.

  • So here we have the positive on the ground that run to the controller board.

  • The positive, the ground, they're running this controller board.

  • Then from the controller boards, we have positive.

  • So we're going to be running these off of five old.

  • So both of these were being run off of five volts.

  • So we have positive we have ground.

  • We're then going be running these to the bread board of the reason being is that we're going to need a lot of ground connections and multiple five all connections.

  • So we're going to be running the power and the ground off of the power and the ground power rails off of this bread board.

  • So the power for both of these power and ground go to power and ground rails on the bread board.

  • And then, of course, the sensor wires, this sense of analog sensor wired for this one and the analog sensor wire for this one.

  • This goes to a zero and a one on the, you know, board.

  • And so that's what we're dealing with here with these sensors.

  • Then we're going to be doing is we're gonna be running the ground wire and we're gonna be running the five volt liar to power the power rails on the bread board.

  • So that comes here.

  • And then from there, we're dealing with the l E.

  • D s.

  • So since we have to, we have to moisture sensors.

  • We need two sets of, eh, ladies?

  • So this is the green and red for sensor one.

  • This is the green and red for sensor to again, the negative, the negative.

  • We simply have a little jumper wire here that goes to the negative on the power rail.

  • And then, in order to power the LAPD's, we then have specific wires, jumper wires running thio, the digital pens on the led.

  • So basically, we're on the art.

  • We know.

  • So when the Arduino powers, it powers up digital pen at number nine, that will correspond with powering up the red led for sensor too So that's all we're dealing with this again.

  • If you've been dealing with these projects this point, essentially what we're doing is we're setting up a little visual alert board using L E.

  • D's.

  • We use the 220 ohm resistors here we use a standard led is green or red or whatever colors you want.

  • You do the negative over to the power rail, and then you actually run the power to turn on the ladies to the digital pens on the Arduino, you know?

  • So that's what we got that, of course, over here to to simulate your signal light two different pots.

  • We have one eye and e cup full of their one Eli the computer guy cup full of dirt.

  • And, of course, to show you that these are dynamic sensors.

  • We have a turkey baster again, and we have water one of the very few time.

  • One of the absolutely very few times you should have water anywhere in New York.

  • We know project we're gonna dio is we're gonna read the sensor.

  • One of the one of the soil samples.

  • The value is up near about 400 eso what that'll show is a red light will turn on and will show that the soil is dry, so I'll use a turkey baster to add some water.

  • Then we'll see the value go down, and then the light will turn green to say that the soil is wet enough.

  • So with that, let's go over and take a look at the code to see how this comes together in the cup.

  • So here is a code for this particular project, and again it's relatively simple.

  • So the first thing that we're going to have to do is we're going have to define the analog pens for the soil sensors, so we'll simply have soil sensor one that will go to analog Penn zero a zero soil sensor to to antelope in a one.

  • Then we're going to have to define the L E D lights to be able to turn them on.

  • So defined green led one that will go to Digital pen six.

  • Red led one will go to Digital pen seven.

  • Green led to will go to Digital pen eight.

  • Red led to will go to Digital Pen nine.

  • Now again, when you're doing things like assigning pens, you will have your own way to do it.

  • I'd like to group things together, so I think I think of these as modules.

  • So the green led one and Rand led one that they go together, so I want them to six and seven.

  • Green led to and right.

  • Led to I think of them is going together.

  • So I put them to 88 and nine.

  • You?

  • Of course.

  • The numbers here don't really matter.

  • You could You could make these whatever little pants you want.

  • They were gonna go down here.

  • We're going to create a variable for good moisture.

  • So what?

  • What is a moisture level that I consider good.

  • So I'm gonna consider anything below 300 to be good.

  • Now again, we're dealing these moisture sensors.

  • The higher the number, the more resistance there.

  • So I think it goes up to 1000.

  • 23,023 is when you're literally just holding the moisture sensor in your hand and there's no to conductivity at all.

  • Zero is if you short the moisture sensor and you have a wire that simply goes from one side to the other.

  • So when we stick this into the ground into the ground or into the soil.

  • Basically, the higher the number that dry, you're the soil.

  • ISS s o.

  • I have just simply again this is arbitrary.

  • And let me be cleared all the geeks out there, this is frickin arbitrary.

  • If you code this into your plant and your plant dies, it's not my fault.

  • I just simply set a value of 300 because that works for this particular project again to say again, Figure out what number works for your plant.

  • Don't Scott be based anyways?

  • Then we're gonna go down.

  • We're gonna set up the environment than with this.

  • All were simply doing is the pin mode function we're setting Green led Red led Green led to Read led to were setting all of those two output basically just to be able to turn on the l ladies and then for troubleshooting purposes.

  • And the rest were starting Cyril Monitor.

  • So cereal's up again at 9600 they would come down to the fun code.

  • Now, the first part of this code is where we're going to be dealing with a serial monger again.

  • This is just for troubleshooting purposes or when you're trying to go in there and do things like tweak, tweak the value for the good moisture.

  • You can rip all this out.

  • To be clear, this particular project, you could simply plug this end to a battery pack or plug this into a wall outlet.

  • And it doesn't need a serial about Adora.

  • Also do remember that I'm just putting a serial monitor and they're just so we can actually see what's going on again for troubleshooting purposes.

  • So we're gonna create int.

  • We're gonna create a very vocal sensor value one, and we're going to set that to the value of our analog read since a soil sensor one.

  • So we're just simply pulling what is the value?

  • What is what are we reading out of soil?

  • Sensor one.

  • When I create a variable sensor value to equals and log read of soil sensor to soap example, we just need a variable to be of work with.

  • Then we're going to do here for zero.

  • Monitor is cereal dot print sensor one equals so print out sensor one equals and then the value of sensor one.

  • Then we'll say serial print.

  • Since their two equals and the value of sensor value to so simply prints out So we know what we're looking at.

  • Then we get down here and this is the code that is required for the L E.

  • D s.

  • So if Sensor Valley one is less than good moisture, that means it's good again.

  • Lower the value is good.

  • Then digital right green led one high, so it's gonna turn the green led on for led one did.

  • You're right red led one low.

  • So it's gotta turn.

  • Turn off the red led else Digital right green led one low red led one high.

  • So, basically, if it's if if, since their value one is greater than good moisture that is going to turn the green led one off and it's going to turn the red led.

  • They were gonna come down here against sensor value to it's basically the same thing.

  • We just plug in the two instead of one s O.

  • If sensor value to is less than good moisture, then green only do.

  • Two is going to be turned on.

  • High red led to is going to be turned off else again.

  • Green led to is going to be turned off red led two is going to be turned on And then we're on the same plate delay for a second.

  • Blue, blue, blue, blue, blue, blue, blue.

  • And so with that, let me plug on the project, upload the code, and I'll show you how this works.

  • Okay, so I've connected up the yard.

  • We No, no, no to the U.

  • S.

  • B.

  • Cable.

  • So this USB cable connects to my computer.

  • So what powers?

  • The Arduino, you know, And it will allow us to re from serial mater.

  • As you can see, we have our soil moisture sensors here, and I have just left them out of the soil for a second.

  • Yes, So you can see what that high reading is.

  • Basically, the reading if there's no conductivity at all we're gonna do is we're gonna go to tools.

  • We're going to go to serial monitor and we're going to see what the output iss.

  • Okay, so what we can see here a Sierra one equals 1023 Cereal to our sensor two equals 1023.

  • So when there is no conductivity at all, you get 1000 23.

  • So we're d'oh as we're going to pull Show This ended this ter and we're going to start see the sense of values change.

  • So Sensor One is now at 453 473 So on and so forth.

  • And so they were gonna plug in this over here into the wet soil and we can see that that's down like 236 240 or whatever.

  • One thing that I do have to say when you're dealing with these moisture sensors in all seriousness, leave them for, like, five minutes in order for them to figure out what they're reading.

  • Because when you show them into the soil, I'm not sure what's going on the the chemistry level or whatever else, but it really does take a little bit of time before they figure out what they're looking at.

  • So what we can see now is at the dry soil Sensor one is reading somewhere around 464 465 and since they're too is reading around 258 so dry soil that's high, obviously since or two is low.

  • And so what we can see is that for for sensor from Boylston Whisper Sensor One.

  • We're getting the red led.

  • So we're being told that this pot is dry.

  • It needs water.

  • On the other hand, this pot over here.

  • Since it's below 303 240 or so, we get the green light to be told.

  • We don't need to water this particular part.

  • And that's really all there is to this project.

  • So what we're gonna do here again?

  • One time, The one time one dive you're allowed to play with water around your Arduino and again again, Do this at your own risk to be clear.

  • Water and electricity don't mix.

  • Do this at your own rest.

  • But anyway, so what I do is I wanna take a turkey baster here.

  • Turkey baster.

  • Got some water on, dear.

  • Just gonna dump this in and see where the level comes down.

  • So now now we go.

  • There we go.

  • So we're down to 284.

  • Whatever.

  • And we can see that that now says green.

  • Oh, no.

  • Nope.

  • But again, it takes a second for to figure out its minds.

  • We've got to give it a little bit more water.

  • So give it a little bit more water here.

  • He drives down again and the led turns grain.

  • So now we have two pots.

  • We have two pots that are fully water, and now our plants are plants will be able to grow now.

  • One of things Thio think about is what you could also do.

  • Since we're dealing with the analog numbers here, you could figure out pops back up to write again.

  • I say it takes a second.

  • One of things you could do is you could figure out how much how wet is bad.

  • So we know dry is bad.

  • If it's too dry is doing, it's too dry.

  • We know that's bad, but there's a problem if it's also too wet.

  • So one of things that you could do is you could have different colors, right?

  • So if it's above 300 is red.

  • If it's you know, between 200 Thio 2 300 it's yellow or something.

  • And then it was below 200 which means there's too much water.

  • Then that might be a problem.

  • Maybe you do like yellow or something like that.

  • So this is basically how it works.

  • I don't know why this keeps again.

  • These moisture sensors were paying us to be clear.

  • If you're dealing with these moisture sensors, they're not exactly It is done a lot of water there ago.

  • We're gonna do this the geek way.

  • We're gonna do this the geek way.

  • There you go.

  • So there you are.

  • There's the project.

  • So for all you geeks out there that you know, one a better of life, a healthier life, having a having indoor plants.

  • Maybe now, maybe now when you see that red led, you were like, Oh, I should probably water that thing.

  • That's a good idea.

  • Do remember to do remember, powering and led is the same as powering like a P S O buzzer so you can actually power a buzzer.

  • So if you think Oh, I don't I don't know if I'll remember to look at an led light.

  • Maybe if you have a buzzer and the buzzers buzzing, maybe that will get you to notice or and a future project one things we're going to do in the future is we're actually going to connect set up like this to power a water pump, and then and then not only you can you be notified that there's a problem?

  • But you could have the Arduino actually solve the problem for you, which is really that's what we're looking for in the modern world.

  • The modern world is no longer simply about notifications.

  • Notifications.

  • That's all 2005.

  • When we're looking to the future, what we want is to be we want to be notified that there was a problem and what our system did to solve the problem.

  • That's what we want in the modern world.

  • So that's what we're going to get to one of things that I will say when these analog sensors with these little things is they are.

  • They're quirky, These air a bit quirky, Uh, literally one of the one of the things that I did before I did.

  • This particular video is actually shoved both sensors into the exact same pot, and they really were reading different readings.

  • Eso if you're going to be doing this at home, One of the big things that I would say is when you're setting those variables, you may actually want to create different variables for the good moisture, right?

  • Good moisture for pot one and good moisture for pot to a good moisture for pot three and then see what the sensor is reading and then create the value for those variables based off of the individual pots and the individual sensors.

  • That is just one of those things that I will warn you with these particular sensors is you can put two.

  • What are of what are supposed to be?

  • I don't It's supposed to be identical sensors into the exact same pot, not that far away from each other on, and you will get a pretty large variants.

  • I was getting up to, ah, 100 variance with what the sensors were seen.

  • So just keep this in mind if you actually plan to deploy this into your own into your own little urban jungle.

  • So just one of those things to be thinking about so that that's really all there is this project as always.

  • I joined doing this video.

Please go to the line, the computer guy dot com and failed normal dot com to see the videos that are too dangerous for YouTube.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

土壤溼度傳感器 LED 報警器與 Arduino Uno 一起使用。 (Soil Moisture Sensor LED Alert with Arduino Uno)

  • 0 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字