Placeholder Image

Subtitles section Play 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.

  • 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