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.

  • Are you ready to do something vaguely useful today?

  • Today's project We're gonna be using fans.

  • We're gonna be using led lights.

  • We're gonna use an analog temperature sensor and l 298 motor module and Arduino board all to create something that might actually be a useful in the real world.

  • Now again, For technology professionals, one of the big things that we have to deal with is the environment of our equipment making sure the temperature is at the right level.

  • Humidity?

  • Is that the right level?

  • So on and so forth.

  • And so one of the cool things that you can do with our do we know boards you can create basically environmental sensors, sensors to detect the humanity sensors to detect the temperature so on and so forth.

  • On with that information, you can then alert users or yourself that there's a problem so you can use led lights to basically show whether the conditions green or whether the conditions red you can use an LCD screen in order to explain things a little bit better.

  • You can even use network or WiFi shields to be able to send information out to a server.

  • But in this modern world, we don't just want to be notified that there's a problem.

  • We want our automated systems to try to do something about it.

  • So what's gonna happen today in this project is we're gonna have the yard we know and on the art we know we're going to have our analog temperature sensor.

  • And what this analog temperature sensor was going to do is is going to determine what the temperature is now if the temperature is below a certain level.

  • So I think what we said it at the low 73 degrees Fahrenheit.

  • So it is below 73 degrees Fahrenheit.

  • We're going to have an led light, a green led light that is going to be lit up.

  • So if it's below 73 degrees, the green led is going to be laid up.

  • But if it gets above a 73 degrees but below 80 So let's say oh, a temperature that we might want to be concerned about.

  • At that point, a yellow led is going to turn on, and one fan, 1 12 volt fan is also going to turn on.

  • So the idea is a room, for some reason, is becoming a little warmer than a should.

  • It's not is not emergency conditions, but that's a little bit warm again.

  • Maybe the air conditioning filter hasn't been replaced in a little bit too long.

  • Maybe just the temperature outside is way too hot, and that's causing problems inside the building.

  • Basically, you're just at that point where it's not.

  • It's probably not a danger.

  • Nothing is probably going to start shutting down at that temperature.

  • But if you if you can cool down the environment, that would probably be a good idea.

  • So we're gonna do is one led light is gonna turn on, and then 1 12 volt fan is gonna turn on to try to bring some circulation into the environment.

  • But then what happens then?

  • What happens if, for whatever reason, the temperature keeps going up, it goes above 80 degrees.

  • That might be a time when you really start getting concerned about possibly equipment shutting down that type of thing.

  • So what's gonna happen at that point is a red led is going to turn on and then the second fan.

  • So we're gonna have a 2nd 12 volt fan also turn on The idea here is basically now it's trying to pull even Maur air through that room through that environment.

  • Basically an emergency condition of trying to cool that room down, if at all possible.

  • So what's gonna be happening here is we're gonna have a sensor to detect the temperature.

  • We're then going to be alerted off of what temperature is again, is it?

  • Green is a yellow Is it red so that we have a visual cue that something's going on.

  • But then also this is going to trigger a physical events happen.

  • So when we get to that yellow when it goes above 73 degrees, we're going on a single fan turn on.

  • And then if it goes above 80 degrees, we're going to have the second fan turn on.

  • And this shows you how you can start thinking about how you want physical actions to be triggered again.

  • Not simply that you notify their first.

  • Hey, look, there's a problem.

  • Great, right?

  • Being told that there's a problem it doesn't do anything.

  • Just tell the other problem, right?

  • One of things you need to start thinking about is how can you start trying to solve the problem using your automated systems.

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

  • I'll show you how this little project is put together.

  • Then I'll show you a code, and then we'll show you how it all works when everything is down.

  • So here is the project.

  • Assemble.

  • Well, you'll notice is we have these 2 200 millimeter PC fans here.

  • So one of things I have to think about whenever you're building projects with motors, whether their fans or water pumps or wheels or whatever else one of things I think about is how are you going to power in the motors?

  • What I have decided to do for this particular project is we're actually using a nine volt one and power supply here, and so this we plug into the yard, we know board the artery knows Venda pen set V I N pen will then send the electricity down to the l 298 and module, and that will then power these fans.

  • And that's something that you have to be thinking about with these projects again.

  • These may seem like very wimpy fans.

  • And compared to a lot of fans, they are there.

  • They are.

  • But I don't need a whole hell of a lot of power to actually be in power these things.

  • And so that's something you think about.

  • If you want a much more powerful box fan that could circulate a lot more air than you're gonna be thinking about how to power that off of a motor module, we're off relay.

  • So this is just one of those things that you have to be thinking about is again.

  • It's not just simply what you want to have happen, but again, how how you're gonna power it, how everything's going.

  • So we got our 2 200 millimeter fans here.

  • We, of course, have R l 298 in Motor Model.

  • Here we have our we know board, and then we have our little bread board in the bread board.

  • We have our analog temperature sensor here we have a green led, we have a yellow led and we have the red led on.

  • All of this is set up.

  • Basically, this is set up the standard way.

  • You can figure all this.

  • We just have added multiple projects together.

  • So with the led is we have a 220 ohm resistor.

  • We have these connected up.

  • So these go to the digital ports on the Arduino board, So did reports 23 and four.

  • Those are going to be power in the led.

  • So those they're gonna turn on the ladies when they're triggered for the temperature sensor that's going to go toe analog zero.

  • So a zero go to for the temperature sensor as far the l 298 in module for the speed.

  • So again, when you're talking about E N A or E N b those Ben's control speed.

  • So there was correspond to digital pin six in digital pin seven on the Arduino bore and then actually control the power pens on the l 298 and a module.

  • Then we're gonna be using digital pens 89 10 and 11 to control those and so this.

  • This is how it all looks once you've built everything so that let's go over and take a look at the code.

  • So here's the code for the project.

  • The first thing that we're going to do is we're going to do fine The temperature sensor, the temperature pen s £0.

  • Define a temp sensor and that's going to go to a zero.

  • Says temperature sensor output.

  • It's an analog sensor.

  • So it goes to a zero.

  • Then we're going to define the led pens.

  • Green led is going to be too yellow is gonna be three.

  • Red is going before then we're going to define the speed pens.

  • So this is the speed for for the motor's off of the l 298 and module.

  • So e n A is for digital pen six e and B did your pen seven.

  • Then for the first motor, I in one and I end too.

  • So we're going to sign those two pen eight and then nine.

  • And then for the second motor, I am three and I and four, we're going to sign those two pen 10 and 11.

  • Finally, what we're going to do here is we're actually going thio set the good and high temperatures as a variable.

  • So many times when I deal with the temperature sensors, I just hard code the temperature into the codes of 73 80.

  • Whatever else, I actually code that if else statements down here, what I'm going to do for this particular project is I'm actually just going to make those variables and then set the values for the very old bulls up here.

  • We're gonna create an end variable good attempt equals 73.

  • So essentially, what we're looking at is 73 below is good.

  • They were going to create a variable and high temp equals 80.

  • So, Edie and above equals bad.

  • And then we will use the values of these variables for our if l statements, then we're gonna go down, and we're going to use the pen mode function to turn on all those digital pens a green led yellow led E and A e and B I and one eye into so on and so forth.

  • We have to turn on all those digital pens and set them to output.

  • The next thing that we're going to do here is we're going to do analog, right?

  • So, in the environmental set up, we are also able to set the speed of the motors.

  • And so since I'm not going to be changing the speed within the loop.

  • I'm just going to set the speed here and so analog, right?

  • E n a 2 55 So e and A that motor should be at the highest speed analog, right?

  • E n b 2 55 So e and B should be at the highest speed.

  • Then we're gonna go down.

  • We're gonna do serial dot begin 9600.

  • So this starts the serial monitor so that we can actually look at the readouts from the analog temperature sensor and make sure everything is being triggered when it should be triggered on that closes out the environment.

  • The next thing that we're gonna do is we're gonna go down here and we're just gonna plug in all of this information that's required in order to deal with temperatures.

  • So this is reading, you know, analog read from the temperature sensor float bolted equals reading times five voltage divided by 1024 equals itself.

  • Float temperature C equals voltage minus 10240.5 times 100 float temperature f equals temperature.

  • See times nine divided by five plus 32.

  • So this is just this has to be written in basically any time you're gonna be using that analog temperature sensor then passed that we're going to go down here and we're going to print out to the serial monitor again so that we can see what is going on make make sure our fans and our led zehr triggering when they're supposed be triggered.

  • So you will not print the voltage sealed up prep attempt to receive a print the temperature F for Fahrenheit.

  • So this is just printing out those temperatures so that we can visually make sure everything is working, how it supposed to?

  • And then we get down to the meat of the code actually turning on the L E.

  • D's and turning on and off the motors.

  • So the first thing we're gonna do is we're gonna say if the temperature is too high, So if the temperature is above 80 we want these things to happen.

  • So to do that, we're going to say, is if temperature F is greater tank to or equal to the value of the variable high temp, we go up here.

  • The variable high temp is 80.

  • So if if its temperature Fahrenheit is greater to or equal than 80 then digital, right?

  • Led.

  • We're gonna set that the high we're gonna turn on the red led.

  • Did you write yellow?

  • Led, low, off green led low off.

  • Then we're gonna do is now we're gonna turn on both fans.

  • So if it's a randy condition, if it's above 80 degrees, want both fans of beyond try to cool down that room or that environment.

  • So with this, I am one is Hi, Ianto is low.

  • So remember these are sets these repairs.

  • So whenever we set the pair, one has to be high.

  • One has to be on one has to be off high means that the positive power low means that's the grounds you.

  • So in order to have a circuit you always need positive and ground So once hai ones low.

  • And since both fans have to be on and I am three is also high and I am for is low.

  • So this turns both fans else else.

  • If temperature Fahrenheit temperature F is greater than or equal good attempt.

  • So if it's 73 degrees, um or above and temperature f is less than high temps.

  • It was less than 80 degrees then.

  • I want this thing happened.

  • So this is that yellow condition.

  • It's above the temperature for green and but but still below the temperature for Rex.

  • Then we're gonna turn the red led off.

  • Red led low yellow led hi turns you yellow led on drain led low off.

  • Then what we're going to do is we're only going to turn on one fan, so we're only gonna use one set of these i n pens.

  • So I am.

  • One goes the hi Ianto goes too low.

  • And what that does is that turns on one fan.

  • And then what we can see here is I am three and I and four are both low.

  • So that means that fan is off there.

  • We go down here to else.

  • So basically it's not too high.

  • It's not in the middle.

  • So that means it's green.

  • It's good.

  • Digital, right?

  • Red led is off.

  • Yellow led is off.

  • Lo green led is high.

  • So we've turned on the green, led to say you say everything is good and then as faras.

  • Although I in pens, they're all set to low because that turns all the fans off.

  • The temperature is good.

  • There's no reason to have any fans off, then passed that we simply go down and we have a delay of 1000 milliseconds or one second.

  • And again, I put in that kind of delay.

  • I guess that I guess there's a wayto make it a little easier to read things like the serial monitor.

  • But that delay there is something that you should be considering if you put this into something like production environment of if you don't want the fans constantly turning on or off.

  • Now imagine.

  • Imagine the temperature inside the environment gets a little warm so the fan turns on, which then cools the environment by like 0.1 degrees not and even entire degree by 0.1 degrees.

  • Well, remember, it's that if it's under a threshold by 0.1, that's still below the threshold.

  • So that would turn the fan off, and then the environment would get warm again.

  • We get warm within like, a couple of seconds, and so then we turn the fan off, but then when a fan turns on, then the environment will cool my 0.1 degrees, and so we turned off and then turn on turn off turn off, Turn off, Turn on, It's her up, right?

  • So every time the fan turns on, it cools.

  • So it goes below a threshold that turns a fan off.

  • And then So that's one thing you might think about this delay.

  • I mean, like, really with the delay, you might put this 10,000 milliseconds with 10,000 milliseconds would be 10 seconds.

  • You might put it at 60,000 milliseconds.

  • That would be a full minute, you know, maybe 600,000 milliseconds.

  • That would be 10 minutes.

  • So basically it stops.

  • It waits to read the temperature.

  • If the temperature is above a certain level, then it would turn the fan on for 10 minutes.

  • You know, those are the kinds of things that you have to be thinking about is how fast you want this system to respond.

  • You wanted turning on and off rapidly.

  • That's just one of those things you have to ponder.

  • So with that, let's go over back over the workbench, and I can show you how this thing works once all the code has been uploaded to it and it's all been set up.

  • So here's the project as it's been built and the code has now been uploaded.

  • One thing to remember when you're thinking about powering these Arduino projects is remember that the USB connection provides five volts and so it can power some things for your dad.

  • We know projects, but not necessarily others.

  • So what you can see is you can see the L.

  • A.

  • D.

  • Is actually lit up right now.

  • And so the USB is able to power the analog censor Any led.

  • But if we started to try to trigger this to turn on the fans, the fans would not have enough power to turn on.

  • So that's why we need the external power supply for this.

  • So this is a nine volt one, a power supply.

  • I would take this, plug us into extension cord.

  • Now plug this into the earth.

  • We know, bored.

  • And so with this now, this will give enough power to actually be overpowered fans.

  • Now it is important.

  • Understand, with this particular project is I'm going to keep this connected to the computer because we're going to use the serial monitor, make sure everything is being triggered when it's supposed be triggered.

  • But do you realize if I don't meet zero monitor.

  • At this point, I could unplug the USB, completely disconnect us from a computer and take this whole project and mounted into a wall mounted somewhere.

  • And then I wouldn't need any kind of computer interface.

  • Once the code has been uploaded, that code will run without any other computer attached.

  • So with that, let's go over to a split screen.

  • So it's so I can show you the serial monitor as we go through, and we trigger the different things that happen.

  • Let's go up.

  • We go to tools, we go to serial monitor and we take a look at what temperature this is currently reading so we can see here.

  • The important one for us is degrees Fahrenheit, so we can see at 67.68 degrees Fahrenheit.

  • And with that, we see the green led is on and both fans or off.

  • So we're gonna do is I'm just simply going put my fingers on the temperature sensor that's raising the temperature.

  • It goes up to 74 degrees.

  • You now see the yellow led is on, and a single fan is also on.

  • As the thing goes up to 80 degrees What we'll see is both fans are now on and the red led is on.

  • So the red led is on to tell you as the user, Hey, there's a problem.

  • But for this system, not only is it going to tell you there's a problem, but it's also going to try to do something about it.

  • Then what?

  • You can see.

  • If something gets better, you clean out the air filter whatever else, the room gets cooler.

  • For some reason, if I take my fingers off of the temperature sensor, the temperature starts going down again.

  • Now, since it's about below 80 degrees, yellow light is on.

  • One of the fans has turned off.

  • It keeps going down to 75 74 what we'll see is once we hit below 73 degrees, then the green light has now turned on.

  • And what we can see is that this fan has turned off.

  • So this is a completely automated system.

  • Not only is a turning led us on and off, but it's also turning these fans on and off to try to help mitigate any problems with the situation that you're dealing with.

  • And so that was just a basic project to show you how an Arduino can notify you that there's a problem and it can actually also trigger physical events that happen again.

  • Something like turning on a fan.

  • Now, a lot of people out there I don't know what it is.

  • I don't know what it is.

  • They look a little, aren't we knows they go.

  • Ah, what?

  • Why?

  • Why are you t shirt aren't we knows why are you talking about Are you know what are you talking about?

  • Realty technology and I just want to lose my mind.

  • I just want to lose my mind because back when I had my company back when we were dealing with small clients back when I was in the enterprise world, let me tell you, one of the biggest problems we had were server rooms.

  • Hey, don't get me wrong.

  • Some of our server rooms were amazing.

  • Some of our server rooms had dedicated a t B A C systems and raised floors and they were beautiful.

  • They were up to spec.

  • But I have to say a lot of server rooms I dealt with were literal a broom closets, literal broom closets and again you put some servers in there most of the time they're working, Okay.

  • But like here in the Baltimore area, it gets to be 100 degrees outside the V A C.

  • The air conditioning unit for the entire building is having a hard time keeping up those servers.

  • That room starts getting warmer and warmer and warmer, and all of a sudden you start having thermal events and you really, you know that that could be a really major problem again, like with when you have broom closets.

  • One big problems is, uh, you know, I would have clients who would use broom closets, for whatever reason is their server room.

  • There wasn't a whole lot I could do about it, but the one thing I would say is, just keep the door open, just keep the door cracked and I'll walk away, eyes gets, keep it cracked and and find the systems will be cool enough.

  • But then again, like in all seriousness, then you have an employee walked by.

  • I don't Why is this door open that close the door?

  • Thermal events server shutting down.

  • It's bad.

  • And again, right, so one of things to be thinking about in that type of environment as you sit there and you go.

  • Okay, Well, how can I deal with this?

  • You know what?

  • I could D'oh it all Seriousness is I can cut.

  • I can cut.

  • You know, a hole in the drywall at the top of the broom closet.

  • I can cut a hole at the bottom of the broom closet.

  • Put a couple events there.

  • Right at that top vent, I can add a fan or two.

  • I can add one.

  • These are doing nose with the analog sensor.

  • And then if the temperature goes above a certain level, then you can have those top fans, Then try to pull the air out that circulates air from the bottom, and then maybe you don't have servers crashing.

  • So this really is an important thing again in the i.

  • T.

  • In the tech world, environmental monitoring and trying to mitigate environmental problems is a huge deal on DSO.

  • That's one of the reasons why If I had known about these, if I had known about these like 13 14 years ago, I would have been all over it.

  • Well, sure, when they were developed, but I didn't use them back in the day, but I definitely would use them now.

  • So anyways, as always, I you're doing this video and look forward to the next one.

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.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級

Arduinoを使った温度LEDアラートとファンの起動 (Temperature LED Alert and Fan Activation with Arduino)

  • 1 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語