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.

  • So in this video, we're going to use a 16 by two LCD screen.

  • We're going to use an analog temperature sensor, and for this we're going to create a temperature alert system.

  • So imagine we have a server room again.

  • So we have the server room.

  • And if the temperature is in the server room is a particular level or below a particular level, everything is good.

  • So let's say if the temperature is below, let's say 73 degrees, everything's good.

  • The servers are fine.

  • You have no problems.

  • But if the temperature gets between, let's say 73 degrees toe 80 degrees, maybe you want an alert to be notified to know that Oh, the temperature is higher than it should be.

  • Now, if it's below 80 degrees, your servers are gonna shut down.

  • Your networking equipment isn't gonna have a problem, but but you should be worried.

  • You should.

  • You should be a little bit concerned there.

  • Maybe you have to clean out the air conditioning filter something like that to get it back to the level that it should be.

  • So basically, we just wanted alert.

  • We just want Hey, the temperature is a little too high.

  • You might want to take a look at this, but then one of the temperature gets above 80 degrees above 80 degrees.

  • You gonna let the servers in there?

  • All the equipment in there.

  • That's a point in time that you may start to worry about your equipment either now working as well or actually thermal thermally shutting down and really causing a lot of problems.

  • So in that instance, not only do you wanna have award, you have what you want to have a warning, but you also wanna have an actionable notification.

  • What I mean by an actionable actionable about notification is not simply telling the end user that there is a problem, but also telling them what the hell to d'oh!

  • This is one of the biggest problems in I t world.

  • One of the biggest problems when people create user experience for notification systems is don't do things like no create right lights.

  • They'll create red lights.

  • So the end user knows there's a problem.

  • They absolutely No, there's a problem.

  • The problem is the end use.

  • It really doesn't know what to do about the problem, right?

  • So in this particular project we're going to do is once it gets to that warning level, once it gets about 80 degrees, it's going to show the temperature.

  • And then it's also going to flip and it's going to say, Call this guy Bob And here's his phone number.

  • So not only is there a major problem that has to be dealt with, but here is an actionable task you can d'oh!

  • Here's the thing.

  • It the temperature is too high.

  • Call this guy Bob at this particular number.

  • And so this is one of those things that you really have to start thinking about in the i o T world on your Arduino world, as you designed everything you're designing, the interfaces you're designing, how things will be computed.

  • You're designing the output.

  • And so one of the things that you need to think about is a kid.

  • You don't just tell the end user there's a problem.

  • You also tell him what the hell they should do about, even if all they should do is call somebody That's one of the biggest problems in the I t world is the end user.

  • They knew there was a problem.

  • They just didn't know who wouldn't tell.

  • So what we're going to do in this particular project is we're going to tell them who to call.

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

  • Yeah, I'll show you the components we need for this project that will show you the code.

  • I'll show you it all put together and show you why this is really a pretty cool project.

  • So here, the major components that we're going to need for this project.

  • So of course, we're going to be needing a bread board.

  • We're gonna be meeting that 16 by two LCD screen.

  • We're using the yard, we know, you know, as we normally do with this particular project.

  • Now again, as with most projects, other other boards should work to be able to build this, have a project.

  • But in order to run this particular screen, you do need a lot of digital pens s.

  • So just make sure you have enough digital pins for whatever board that you're using.

  • Then we're going to be using a single single 220 0 resister that will be used for the LCD screen.

  • And then, of course, a potentially ometer.

  • Oh, again.

  • Whatever you think, Yama, you get this kind of a crappy one here that when I use a little bit better but you're gonna need a potentially ometer again.

  • This is just a variable resistor.

  • So we take put all that to the side, Then we can take a look at how this thing looks actually being built.

  • So I've done other videos talking about howto build all the circuitry for the LCD screen here.

  • And so that's been a painting again.

  • You'll notice you need a lot of wires.

  • You need a lot of campers you have resister in here.

  • So there's a lot that goes into building this LCD screen system.

  • So we're not talking about this in this particular project.

  • Go and look at the previous project I've done about that.

  • Basically, all we have here is this all this this way is the standard LCD screen project.

  • And then what we've added is we've added the analog temperature sensor down here again.

  • We have positive we have the negative and then we have the sensor pen, and that's an analog again.

  • Analog sensor pen goes to the analog pens that goes over a zero on the Arduino board.

  • And so this is what the project looks like when it's built.

  • Let's go over and take a look at the code, so this is the code for this project.

  • Now this code is starting to get a little bit long.

  • But if you go and you take a look at it line by line, you'll realize that it's really not that complicated.

  • And frankly, a lot of it is simply copy and paste from other areas.

  • So if you look at the if the l stiff and the else statement right here, you'll notice most of this is identical.

  • We've just we've just added, or we've modified a few different variables and things in there.

  • So let's go up and take a look at the top.

  • So we're using the LCD display the liquid crystal display, So in order to do that, we are going to need the liquid crystal, not age.

  • This is the liquid crystal alive, or it's a pound include the liquid crystal library.

  • The next thing we're going to do is where you wanted to find pound to find the sensor pen.

  • So this is for the analog a temperature sensor.

  • So the sensor pen we're going to put to a zero, Then we're gonna go down here, and we're going to write out a lot of stuff that's required for the LCD screen.

  • So we're gonna define all these different pens.

  • R S E n d 45 d 67 These air all pins actually on the LCD screen itself and then 12 11 543 and two.

  • These are pins that are on the Arduino.

  • Boards were going todo define those pins corresponding.

  • And then we're gonna do is we're gonna be the liquid crystal.

  • We're going tol CD function, and then we're going to tell the LCD screen where these particular pens are.

  • So this is required in order to make the LCD screen work more or less.

  • All of this right here.

  • It just is this You put it in there and you just leave it alone.

  • That's just how it gets right then.

  • One of things we're gonna do is we're going to create a variable and end for plus minus so we're going to be doing with this is we're going to read out the temperature and then beside that, we're going to show whether it's above or below, whatever the optimum temperature is.

  • So if the temperature is too high, not only will, let's say, 80 degrees and warning, but I will say 80 degrees like plus seven, So it's seven degrees above the optimal temperature.

  • It's at 60 degrees on the optimal temperature is 73 when it's going to say they'll say 60 minus 13 again, this gives you a little bit better idea about how the cooling is working, right?

  • Are you right at the limits?

  • Are you well above or below the limits?

  • Just gets a little bit of additional information that might be useful to the end users.

  • They were going to come down, and we're going to set up the environment.

  • The loop is going to run.

  • In order to do that, we're going to do LCD dot begin, and we're going to say what kind of LCD screen we have.

  • So it's a 16 column so 16 characters across Bye to row, two characters up and down, right, so 16 by two And so we use this in order to do, like, the cursor settings and all that, because you actually you actually have to tell the code where to start typing things out.

  • What could be a bit of a pain, But we're gonna go down here, and the first thing that we're going to do is we're going to do the standard code for temperature, Right?

  • So in standard code for Santa cure any kind of analog temperature sensor project basically copy and paste this in there, end reading equals that you're gonna analog read from the sensor pen to in order to get once you get that, you're going to be the voltage secret afloat a decimal point.

  • So 10.1 25 or whatever is what flotus so bolted equals reading times five voltage.

  • You will then take this.

  • That is what voltage will equal.

  • And then you will divide that number by 1024 and then set the value of voltage tow whatever the results is, that's what it means when you have something like this.

  • So it's plus equals minus equals, divided by equals.

  • Times equals what you dio is you.

  • You do that to this side, and then you set the value of the variable that.

  • Then we're going to create a float for temperature seat.

  • So temperature Celsius ball change minus 0.5 times 100.

  • But here in the U.

  • S.

  • We used temperature Fahrenheit.

  • So we're going to create a float temperature F equals temperature.

  • See times nine, divided by five plus 32.

  • Again, this is all your copy and paste, but going over a little bit just to just to make sure everybody remembers.

  • Then what we're gonna do is we're now going to go into the if l if else if else statement basically printing things out, this will be printing out the alert on Sunday.

  • So the first thing that we need to do is we need to use the LCD a not clear function.

  • So what this is going to do is this is going to clear the LCD screen.

  • Basically, think of this as this is turning all the characters too low, right?

  • So I thought about that before, when you're dealing with, like, LCD are led.

  • I'm sorry.

  • Led lights.

  • When you turn led lights on.

  • You also have to to remember to turn them off, right?

  • So if you if you turn one led light on in a certain situation and you forget to turn it off and then you turn another led light on in a different situation, then all the led lights are turned on and you never turn them off.

  • You can have the same problem with the LCD screen where, if you have, if you have text that takes up, a different amounts of space is on your screen.

  • Then, when you flip between different text, some of the characters won't reset, so you'll get some really weird issues.

  • So if you want to just see something curious, we just wanted to just want to play around, see something curious.

  • You may want to just delete this LCD, not clear function in your sketch.

  • When you do it and you'll see, you'll see a weird error.

  • You'll see if we like What?

  • What what the hell am I looking at kind of hair.

  • So the first thing that we have to do with LCD clear What that does is that clears a screen, basically turns all the characters on the screen off.

  • So then we're gonna do here is we're gonna start with if the temperature is too high.

  • So if temperature is greater than or equal 80 so if it's a template for Fahrenheit is greater, greater than or equal to 80.

  • Then what we're going to do first is we're going to take that plus minus variable, and it's going to equal temperature F minus 75.

  • So what is going to tell us is how many degrees it iss above the the temperature.

  • The temperature of that supposed to be 75 is the standard temperature here, so it's 75 is a temperature that it's supposed to be.

  • Then we're going to do is we're gonna go down here and we're going to say L C D doc set cursor.

  • So we're going to set where the cursor is going to begin writing from and that 00 to remember when you're dealing with an LCD screen.

  • Numbering starts at zero, not at once or the first position is zero.

  • So we're doing the first column of the first Rose were saying 00 and so what we're going to do right now is we're going to do LCD dot print warning so it's above 80 degrees.

  • It was warning.

  • Warning.

  • Will Robinson, Then what we're going to do is we're gonna go go to LCD dot set cursor.

  • So zero, So zero is the first column.

  • So it's 16 16 across, too.

  • So it's at the columns of the first position off the second column.

  • So one is a second column, and then what we're going to do is we're going to print temp.

  • Then what we're gonna do is we're going to LCD dot set cursor.

  • We're going to go to these.

  • This would be actually the seventh, so it's 66 means seven.

  • So it's 1/7 spate of the seventh Column over on the second row, and then we're going to print the value of temperature.

  • Then what we're going to do is LCD, not set cursor.

  • We're going, we're putting in 12.

  • That means the 13th.

  • Call him on Row two and we're gonna do a plus, so it's higher temperature and they're going to LCD dot set cursor 13.

  • So the 14th position on the cot on this 14th column on the second row and we're going to do the value of plus minus.

  • So if this temperature is, let's say it's 85 degrees.

  • Then we'll say warning temperature 85 plus.

  • And since this is the temperature that is supposed to be, that's that's a threshold temperature.

  • Then we'll say plus 10.

  • Then what we're going to do is we're going to DeLay because this is the warning where we have to give some kind of actionable notification to the end user.

  • So we're gonna delay for two seconds, so that will show up for two seconds.

  • Then we're going to do LCD dot clear.

  • So we're going to clear the screen.

  • Everything is taken off the screen.

  • Then we're going to LCD dot set cursor 200 The first visit first column in the first row, and we're gonna say L c dot print call Bob Ross called Barbara's call.

  • Barbara's now one of things you do have Thio to think about when everything about these notifications is remember, you do only have 16 characters, you only have 16 letters.

  • So this is kind of a joke, saying Bob Ross is like Oh ha ha, but something that you have to think about it.

  • You've only got someone to characters here.

  • You only got 16 characters.

  • So whatever you're saying, it has to fit in 16 characters.

  • And so Bob Ross is a word that are a name that fit within 16 characters.

  • And so that's what I'm using.

  • But that's that's something you're gonna have to think about.

  • Like, you know, you put in tech support or do you put help desk right?

  • If you're trying to write this out, if you try to say, call Tech support, that's probably gonna be too many characters, whereas you say call help desk that will all fit it.

  • So that's kind of weird stuff you gotta be thinking about with the user user experience.

  • These interface, they're going tol CD set cursor.

  • So the first column on the second row LCD print on.

  • Then we're going to print a phone.

  • One would want hyphen to to to life in 333 whatever the actual phone number is or an email address, something that is below 16 characters, and then we're gonna go on delay for two seconds.

  • So while the temperature is above eight degrees for two seconds, it will give a warning with a temperature and then for two seconds, it will say call Bob Ross.

  • And the phone number again is something that you have to be thinking about what things like delay is you actually have to give the person long enough to be able to write it down and read it.

  • If you just put this for a second, can you imagine if somebody put the delay for a second or half a second?

  • It was just like flipping back and forth.

  • You would have a very pissed off and user.

  • So this is the kind of thing that you have to think about, like thinking about the delay.

  • Like, how long do you don't do?

  • You delay it for 10 seconds, you do it for 10 seconds.

  • That's a long time.

  • But if you delay it for one second, that's too sure.

  • So that's the kind of thing you have to think about the user experience.

  • Like, how long are you gonna delay things like the message is for they were gonna come down here.

  • We're gonna do with else.

  • If so, the else.

  • If this is just gonna be in alert, Right, Elsa?

  • Temperature is less than 80 degrees, and temperature of Fahrenheit is greater than or equal 75 degrees, So 75 degrees to eight degrees.

  • This is what's gonna happen.

  • So again we have a plus minus variable equals temperature F minus 75.

  • They were going to you l c d dot set cursor to the first position.

  • The first column of the first row.

  • We're going to print alert.

  • Then we're going to go to the first column of the second row print temperature.

  • We're gonna go to the seventh column of the second row over print the value of typical Fahrenheit around you'd go to the 13th column of the second row we're gonna write.

  • Plus, we're going to go to the 14th column of a second row and we're going to write the value of plus minus.

  • So this is plus So if this was 77 degrees, it would say alert temperature of 77 plus two.

  • So you know, it's two degrees over the temperature that's supposed to be.

  • Then finally, we're gonna come down to else, so it's not one of those two things else is below 75 degrees.

  • So here's what we're gonna do is we're coming again.

  • You gotta remember the math.

  • So we're gonna have to swap around the plus minus.

  • So here the idea is temperature is above 75.

  • Here, remember, temperature is supposed to below 75 so we do plus minus equal 75 minus temperature.

  • So if it's 70 right, so 70 is five below 75.

  • So we just have to swipe that switch that around for the basic map.

  • Then all we're gonna do is set Curse of the 1st 1st column of the first road We're going to print out good, because everything's fine, right?

  • Then we're gonna go to the first column of the second row type out temp.

  • We're gonna go the seventh column of the second row.

  • We're gonna do the value of temperature Fahrenheit, 13th column of the second row, and we're gonna do minus now because we're now underwear under 75.

  • We're gonna go to four teeth column in the second row, and then we're gonna be plus whatever the value plus minus is so if it's 70 degrees, will print out good temperature 70 degrees minus five.

  • So it's five degrees under that threshold.

  • Tempeh cure.

  • Then for here, we're going to delay for 2000 milliseconds or two seconds, and then we're going to loop through again.

  • The big thing here, the big thing here with his loop is that you have this LCD clear.

  • So it clears the screen as the values change.

  • So with that, let's upload this thing Thio two little project, and I can show you how this works in the real world.

  • So the project has been built, the code has been uploaded, and now we're gonna give this thing some power.

  • And okay, so now we can see.

  • Right now, we can see it is good that the camp temperature is currently 65 point, whatever.

  • 1 70 degrees and then we have that.

  • So that is below.

  • That's nine below 11 below.

  • So we know everything is pretty good here.

  • Then what I'm gonna do is I'm going to touch this as of course, going to raise the temperature was you go to 67.

  • It was a 71.

  • It was a 74.

  • Now attorney gets to alert, so the temperature is too high.

  • 77 plus two plus four too high.

  • And then once we get to 80 now, I have a full fledged warning.

  • Call Bob Ross +111222333 and basically get as long as the temperature is above 80 it will just continue to look through this.

  • Then, as the temperature goes down, we can see that we'll go back to the alert again.

  • So now it's down to alert 75 degrees.

  • Then the temperature goes down.

  • A cool.

  • Then we go down too.

  • Good.

  • So this is basically how it works in the real world.

  • And I really want you to really be thinking about this.

  • The whole idea of being able to give some kind of actionable response to your end users again not just telling them that there is a warning not just telling them there's a problem, but telling them what the hell d'oh again.

  • You could have called Bob Ross.

  • You can have email.

  • You could even just have flipped on the fan, right?

  • Literally like you can print out of 16 by, too.

  • So whatever you could just say, turn, turn on, exhaust fan.

  • You could do something like that.

  • But that tells the end user what they should be doing.

  • Not simply that there's a problem, so that's all there is to this particular project.

  • Basically, just have an analog sensor.

  • Oh, you have the method of the mess of wiring this thing up.

  • Wiring this thing up to really is a pain in the butt.

  • But, you know, whatever.

  • You wired this thing up and then you you do a little bit of code.

  • Really, With all of this, the base concept here still remains pretty simple.

  • You just have to write out a lot of code for how to print out on the screen.

  • And that's really what programming and coding turns into right when when you first see some huge program, you know, you see 10,000 lines of code or something, it can be very daunting.

  • It can make you very worried.

  • You think, Oh, I'll never be able to do that.

  • Well, you realize is a lot of code in there.

  • You've got a lot of duplicate code.

  • You have a lot of code again where basically you take a whole chunk of code and then you know, you, you paste that to the els party.

  • If else statement, and then you simply modify a couple of things in there.

  • And really, even when you look at the code.

  • The code itself is relatively simple, even if it is a pain in the butt.

  • But to write, you know you have to set where the cursor starts, then you have to write out what you want to write out.

  • Then, if you want another word, you have to figure out where the cursor should start in that second word, and then you print that out in the third word, figure out what the cursor starts on the third word, and you print that out.

  • And then if you have to, rose and you gotta go down to the second row.

  • And so you know, if you look at that, what you realize is it's really simple.

  • It's really simple.

  • It's setting where the cursor is and then saying what should be printed out.

  • It just It's just very verbose to get it done right.

  • It takes a lot of takes, a lot of code to get something that seems relatively simple, accomplished.

  • So that's one of the reasons why you shouldn't be too daunted when you look at coding or anything in technology is just realized.

  • Everything in technology at its core is relatively simple.

  • It's relatively simple items that gets stacked together to make a very complicated project.

  • All you have to do is you just have to You have to start.

  • If you think about all the things that need to happen and then you write out all the parts of those individual things and then at a certain point you actually have something that seems that seems pretty impressive.

  • So that's all there is to this particular project.

  • One of the big takeaways I want you to be thinking about from this project, though, is again.

  • What information can you give to the end user that they can do something with?

  • One of most frustrating things I see in the I T world is you see these technology professionals and they'll create alerts creating what we read.

  • Lies will be alerts, and there'll be no pain losing text messages and all kinds of stuff.

  • But the user doesn't know what to do with it.

  • It was her life.

  • Well, I knew the server room was ah, 105 degrees.

  • I saw it.

  • I saw the warnings.

  • I saw 105 degrees, but I didn't know what I was supposed to dio and then you get the idea for all.

  • Didn't you read on Paid 500?

  • You know, appendix A of the user manual that if if the temperature is above X amount of degrees, you should call this person and it's now No, I didn't I didn't read that manual.

  • I didn't know we had that manual.

  • Is that manual still exist?

  • Right.

  • So if you can give your device, if you can allow your device to actually communicate to the end user and give them actionable things that d'oh that will make everybody's lives a hell of a lot better.

  • So, as always, I enjoy doing this video and look for a seat on 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.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it