Placeholder Image

字幕列表 影片播放

  • please go to the line the computer guy dot com, in order to view schematics, code and Maur for the projects that you are learning about.

  • Welcome back.

  • So one of the big uses for art we know projects is to tell end users when there is a problem.

  • So let's say you have a server room.

  • You're worried about the server room overheating, and so you put in some kind of led light system.

  • So basically, if the temperature is below, a certain level of the light is green.

  • If a typical goes above a certain level.

  • But the light is red, right?

  • That's the type of project you could d'oh with an art.

  • We know.

  • But one of the problems comes up is what happens if there's not a user there to visually see whatever type of notification that you're trying to present.

  • So what if somebody is not looking at a Web browser to see a notification event?

  • What happens if a user is not even in the building to see an led turn on or turn off?

  • Wouldn't it be nice if you're good?

  • We know project could send you a notification using S M T p basically using email service is so whatever email client you have, whether you have a desktop computer, whether you have some kind of smart phone or whether you even have a smart watch, you can get notifications no matter where in the world you are, what time of day it is so on and so forth.

  • And so the project that I'm going to show you how to do today is we're going to use a simple and along temperature sensor.

  • And when the temperature gets above a certain level, what's going to happen is our Arduino, you know, with WiFi is going to post to a PHP script on a server.

  • And then that server is going to send out an email using the mail of function within PHP.

  • And once that email is sent out, then I can reserve the email on whatever email client that I am using.

  • So the important components that we're gonna be needing for this project today was we're gonna use the Arduino, you know, with WiFi that we have been using.

  • I am going to be using a simple and along temperature sensor.

  • Now.

  • It is important, understand?

  • I use the analog temperature sensor because it's just a very easy sensor to use on.

  • Give it thresholds for code within the artery.

  • No, but realize you can use any sense.

  • Or basically, you can state if a sensor triggers or the value gets to a certain you know, height or searching low, you can trigger an event to happen, so it is important to realize that.

  • But so we're using the artery.

  • No, no, no.

  • We're using a basic analog temperature sensor, and then what we're going to use is we're going to use the post function within the post ability within the artery.

  • No una WiFi to post up to AP AP script on a share hosting plant.

  • So it is important understand with this project that I am using a shared hosting plan from Go Daddy.

  • And there's a reason I'm using a shared hosting plan from Go Daddy.

  • In order to send out the email, we're going to use a PHP function simply called mail.

  • So if you're using the PHP scripting language, there is a function that you could use Cold Male, and what that male function does is you give it the variables that you're giving it, and then it uses whatever the default email service for that server is to be able to send out the e mails.

  • When you're building your Web server, you install a Paki, you install my sequel.

  • You would sell PHP well.

  • One of the things that's installed by default on most share hosting platforms is also an email service.

  • So they have already installed the email service.

  • They have already configure the email service.

  • They have already done all that.

  • So when you call the male function within PHP, it simply uses all that to send out the S and T P.

  • Massive.

  • So what is important to understand that if you decide to build your own lamp server to do this project, you're going to have to install your own email service is, and that could be a pain in the butt.

  • To be polite, it could be a payment about.

  • This is one of those times, especially if you are learning you're not planning to put this into a production environment, I would highly recommend you simply spend $5 a month for a shared hosting plan again, Whether it's go, Daddy, Daddy, your host Gator, I don't care who it is.

  • Spend a couple of dollars so that you don't have to build your own server for this particular project.

  • But this is just something to keep in mind.

  • So even if you have a lamp server, even if you have a full Web server with PHP installed if you said the post to that server to the script on that server, that server will not be able to use the mail function unless you have configured the email service is on the server.

  • So just keep that in mind.

  • With this project, we're going to be using a shared hosting plan, and that's what I would highly recommend for you, especially if you're learning.

  • And honestly, even if you're not learning, if this isn't like this is a high security is not high security type message and that you're doing honestly.

  • I just pay $5 a month for a share of hosting plan, just so I don't have to worry about it.

  • But yeah, that's me so that let's go over, take a look, how to physically build this project, and then I will show you the code.

  • Both yard we know code and the PHP code that's required to make this project function.

  • So this is the physical build for our project.

  • And you have probably seen this physical build a number of times before.

  • If you've been watching my other videos again, all we're doing is we're using analog temperature sensor, and we're using this in order to get dynamic readings to be able to trigger events to happen based off of those readings again, you could have motion sensors here.

  • You could have distance sensors here you get of all kinds of different sensors here.

  • I'm just simply using a temperature sensor because it gets the point across.

  • So we have the analog temperature sensor analog temperature sensor.

  • We have this coming to five volt for power we have is going to ground for ground and then the sensor pan for this particular project.

  • We're using a five, but you could use a zero through a five, I guess.

  • Used a five for this.

  • Now, we are going to be powering this off of our computer today, so I'm gonna be plugging this into the computer.

  • This will give us power and will also allow us to see what's going on with serial monitor.

  • But do you realize that if you don't need the cereal, not monitor functionality?

  • You could simply have this plugged in using a normal 12 volt connection or some kind of other USB power supply and have this completely separated for computer.

  • So you could just put this powered up into your server room.

  • And then everything that I'm showing you today will work so long as it's able to actually connect to the WiFi network.

  • So with that, let's go over and start taking a look at the code.

  • So when we're looking this project, it is important to remember that we're going be writing to different programs.

  • So we're going to be writing a sketch for the Arduino and then for our share hosting server.

  • We're also going to be right in a p A P script.

  • So this is again one of the reasons why I laugh so hard when people ask what one what one?

  • The language they should learn if they want to be a coder, because in reality, even something as simple as what I'm showing you today actually uses multiple languages in order to make this thing work.

  • So I really want you to start realizing that when you start thinking about Cody and we start thinking about the coyote world, it's not about learning one product or one language.

  • It's about learning all the different tools that are required in order to get done whatever it is you're trying to accomplish.

  • So first, let us go and take a look at this sketch.

  • So this is the Arctic doing now sketch that I've created and this sketch is what will be uploaded to the art.

  • We know Bono with WiFi.

  • The first thing that we need to do is we need to include the library for the WiFi for the art we know, you know, with WiFi.

  • So we use WiFi Naina for most of my projects here.

  • Then we need to define the sensor pin.

  • So we're simply defining the analog pen a five as the sensor pin.

  • So this is where we'll be getting readings for the temperature sensor.

  • The next thing that we need to do is we need to give the information for how to connect to the WiFi networks of char s s I D.

  • And I have a guest network called Test and that guest network has no password again.

  • I do this to make my life easier, so I don't have to troubleshoot networking problems while I'm trying to do something else.

  • If you have a password or whatever else, you would plug that password in there, then we're gonna come down.

  • We're gonna create a variable for status for the WiFi network.

  • We're basically going to send it to idle.

  • So this is for when we're trying to connect to the WiFi network.

  • This is used for the for the wild loop for trying to connect.

  • Then we're going to come down for the server.

  • So char server.

  • So this is the server that we're going to be connecting?

  • Thio s.

  • So for today, I'm actually using the fail normal dot com server.

  • So it's www dot fail normal dot com.

  • Now it is important to understand is I am not putting any folder structure here.

  • I am not putting the script information here.

  • I am simply putting the server that I'm pointing acid WW dot fail normal dot Com Www You are the computer guy dot com.

  • Whatever the domain name is for your server, just put that there.

  • You do not put the folder.

  • You did not put the script name.

  • You don't put anything else there.

  • They were gonna come down.

  • We're going to create a string four post data.

  • So post data is the data that we are actually going to be sending to the server for that post.

  • So we just create that variable there, and then I'm also creating a string, and I'm going to call it a post variable, and it's going to tempt equals.

  • So basically, this is simply the name of the post variable that I'm sending.

  • So temp equals 86 temp equal 76 p equals 102.

  • So basically, when I send the information in a post, I have to say, with the variable name is so that I can that I can pull out what the value for the variable name is.

  • So here, that variable name variable name is actually temp, and then it's going to be equals.

  • So I just put that all here together.

  • So whatever your your variable name is, you know, time equals distance equals whatever they were gonna come down.

  • We're gonna set up the clients a WiFi client client again.

  • This is just simply required for the WiFi network.

  • Copy and paste.

  • Shove it in.

  • Now that we've done that, we have to set up our environment.

  • So we go into a void set up to set up the environment.

  • The first thing we're going to do is cereal about began 9600 to start serial monitor.

  • This is mainly just for troubleshooting purposes.

  • Then we're going to go into the wild loop.

  • This wild loop is what connects us to the WiFi networks awhile, while a status does not equal wirelessly connected a serial, a print, blah, blah, blah WiFi not begin.

  • And this is the function to bribe the S S I.

  • D.

  • And the password to try to connect to the WiFi network.

  • It keeps looping through there until that it actually connects.

  • And then once it actually connects to the WiFi network, it breaks out.

  • Same thing is normal.

  • Then what we have down here is we're simply going to print out to the serial monitors some basic information, so we know a little bit about what's going on with art.

  • We know s we're going to print out the s s I d So what?

  • The s s i d is And we're also going to print out the i P address.

  • So once it's been connected, it'll say it is connected to this s i s s I d.

  • It's connected to test, and this is what I p addresses in case we need that.

  • So now we're going to go down and we're going to go into the loop.

  • That's actually gonna provide the cool functionality, right?

  • The first thing in this loop is we have the simple copy and paste math here for coming up with the temperature.

  • So in order to basically, you have to grab the voltage value, you have to grab the value that the animal temperature sensor is providing.

  • And then you do a bunch of math on that to turn into a temperature in Fahrenheit.

  • This is that math again.

  • We've talked about it for other projects.

  • Copy and paste that if you want to look not learn more about it, take a look at those other projects.

  • Then we're gonna come down here and we're gonna take this post data variable.

  • So that string that we create it up here, string, post data and we're going to make it equal to post variable was going to be equal to tempt equals and then plus, so what this does, is it It's called concatenation.

  • So contamination is when you when you kind of super blue things on to the end of each other.

  • So what it's gonna do is going to do temperature, attempt equals and then the value for temperature f.

  • So we create a variable temperature f here.

  • So this is a temperature of Fahrenheit, and so we're going to do temp equals.

  • Whatever the value of temperature F is, there's no space, there's nothing there.

  • This is all just sandwich together, and that becomes our post data, and that is what will be posted to the server.

  • Then we're gonna come down here to the actual if statement and so four hour if statement we have.

  • If temperature F is greater or equal to 80 so 80 degrees is what I figure is too high a temperature.

  • If that happens, then what we're going to do is we're going to connect, and we're going to send the post at so then we'll say if client not connect server at 80 so server server is up here, so that's www dot fail normal dot com.

  • And 80 is the port, right?

  • So if client doc connect, so if it can connect to www dot feel normal dot com at poor 80 then go through and do the rest of this.

  • So then we're going to do client so clients it is ascending out to the client that you've connected to.

  • So this is sending out to that Web server that you're connected to.

  • It's sending to www dot fail normal.

  • That very important.

  • When you talk about, we're talking about printing.

  • It's important who you're printing, too.

  • So this is printing out to the client you connected.

  • Thio cereal is printing out to the cereal, so once we've connected, we're going to client that print lines were sending on.

  • It's gonna be a post, so we're gonna say Post and then this is where we put in the folder structure and the script that we're actually pointing at.

  • So I have created a folder called Test on Fail normal dot com and then PHP script we were sending this post data to is email script dot PHP and they were simply saying is a T T p 1.1.

  • So this is where you put that folder structure and the actual script that you're sending this to again.

  • Remember, this is PHP and everything else, so things like capitalization does matter.

  • So make sure all your capitalization is right anyway, so we're gonna post they were going to say the host.

  • So what is the host?

  • We just put in the w w dot failed horrible dot com.

  • So host and server should remain the same.

  • They were a new client, not print line caught content type.

  • So we're gonna be telling it what type of content this is.

  • And so we're saying former U.

  • R L encoded.

  • That's for the post.

  • Then we're gonna tell it how long the data is the content length on.

  • That's what we do here.

  • We have a variable for figuring out what the content like that we're sending it to again.

  • At this point, this is just copy of paste.

  • And then finally, after what we do, all of that, we actually send the post data.

  • It's a client, not print post data, and that post data is going be temperature equals, whatever the value of temperature is, and that would be that would be sent up there.

  • Then what we're going to do is on this serial monitor.

  • So this is cereal print line.

  • Just so I know that this has occurred, we will.

  • We will print out email sent.

  • So we'll say email sent front line, and then it'll print another line and tell us what the value of temperature F is.

  • Just so we know when it got said again for doing any kind of trouble shooting here, then if the client is still connected, then the client is going to stop again.

  • This is copy and paste now, one of things.

  • It's not copy and paste.

  • Here is this delay.

  • Delay.

  • This is something you got to think about as a coder, and this is gonna be your decision.

  • You can do whatever the hell you want right here, but basically we need to some type of a limiter.

  • Remember that when you're dealing with Arduino Arduino diskettes looping Lupin, Lupin!

  • Lupin!

  • Lupin!

  • Lupin!

  • Lupin!

  • Lupin!

  • Lupin!

  • Lupin!

  • Lupin!

  • Lupin!

  • Right!

  • And so if you look at this, if you look at this, if you don't put any kind of delay in here.

  • Guess what's gonna happen as soon as the temperature goes above 80 degrees in your server room, you are going to get spam to hi Helen bag because it is going to run through this every time it loops.

  • So if it's above 80 degrees, it will send an email, sent an email, sent an email, sent a team.

  • I'll send an email, and all of sudden you've literally got 1000 e mails and your your mailbox, right?

  • Because basically, if it's above 80 that I'm sending the post, it goes to PHP script PHP script fires off email that's not useful to anybody.

  • So what I have done here is I've put in a delay of 60,000 so one that 1000 milliseconds equals one second.

  • So 60,000 milliseconds equals basically one minute, 60 seconds.

  • So what's gonna happen is if the temperature goes above 80 it will do.

  • It will do all of this right here, and then it will simply sit.

  • It will delay for one minute.

  • Now what type of limiting system you do that's all on you again.

  • When I do these projects, I try to make these projects as simple as possible.

  • So you understand what's going on?

  • If I was going to put this into a production environment, I would figure out something a hell of a lot more complicated than simply 60,000 milliseconds.

  • But this is something that's very easy to understand.

  • So this limiter here, you could create some kind of timer so you could have some kind of timer and then measure the timer thing.

  • You could actually put some kind of limiter within the PHP script itself.

  • There are a lot of different ways you could put some kind of limit or they're The main thing that you have to think about is basically how are you not going to span the hell out of yourself if the temperature goes above 80 degrees again, you may even something as simple was, I don't know, maybe put this to 300,000.

  • You know, maybe that limits it Thio going every five minutes.

  • But you will have to sit think about something, especially in the real world.

  • Because again, if this starts triggering and then it takes you, you know it takes you half an hour to figure out what the problem is.

  • You're going to get spam toe.

  • Hi, Helen.

  • Back.

  • So you gotta figure out some kind of limiter here.

  • I simply put that one minute.

  • Then out of this, we're going to do serial dot print line, post data.

  • So the main used for this is if this doesn't fire, basically is just going to print out as it loops through it will tell us what the current post data Isobel say temperature equal 72 different or equals 74.

  • And then I have a simple delay on the overall script.

  • About three seconds.

  • 3000 milliseconds.

  • Three seconds.

  • And I'll show you how that works.

  • Once we've powered everything up and we have a serial monitor going.

  • Okay, so this is going to be sending this information is post information to www dot feel normal dot com forward slash test email script dot PHP.

  • So let's go over and take a look at the email script Now again, Whenever you're dealing with PHP, do you realize you can simply write PHP in any kind of text editor you want?

  • Ah, lot of times, especially for these projects, I will show you this in a basic text editor because I think it's easier and more comfortable for especially new people to work with, but you can use I de ese or whatever us.

  • But literally, I'm simply using text edit on a Mac in order to write this.

  • So this is going to put up in the test folder sitting up there.

  • It fail normal dot com, and the first thing that we have to do is we have to open the PHP script.

  • Then what we're going to do is we're going to create a variable for time, so we're going to make a dollar sign.

  • So when you're dealing with PHP, every variable has have a dollar sign in front.

  • It was one of those quirks of PHP, and so we're going to create a variable called Time, and we're going to make it equal to the time code function.

  • So basically, timecode function.

  • This just gives numbers.

  • So at the time, as the computer sees it, it's not actually that useful for most people.

  • I sometimes simply use a pure time variable just for troubleshooting purpose is to make sure things are auto updating where I'll put the time variable in there.

  • Yes, so I can see the number changes every time I refresh the page like because that's all I care about.

  • But one of the things is in the real world, you may actually have to have time in in a format that makes sense to a normal human being.

  • And so what we're going to do here is that we're going to create the time stamp variable time stamp variable is going to be equal to there's something called the date function set a date function and in the date function.

  • What we're going to say is, we want to make this 24 hours, so we want to turn time, so we're gonna feed the time variable.

  • We want to form at this in 24 hours, with the minutes with the seconds.

  • So what this date function is going to do is going to give us a time stamp and the 24 hour format.

  • If you want to learn more about this, you could just take a look at the time function in PHP.

  • But may think here is we just need a value for this time stamp variable that is useful to a normal human being.

  • Then the next thing that we're going to do.

  • The next variable that we're going to do is we're actually going to create the dollar sign A temp F variable temperature Fahrenheit, Baylor variable.

  • We're going to make it equal to dollar sign.

  • Underscore.

  • Post Capitals bracket, double quotation marks.

  • Temp.

  • Right.

  • So back in the yard, we know script right when we came up here and we created this variable.

  • So the post variable temp, that's what we're grabbing here.

  • We're grabbing the value that has been posted from temp, and we're turning that into the value for the variable dollar sign Tip F then passed that we're going to go down, and we have to give the male function the values for variables that it needs.

  • So the first thing is dollar sign two equals, and then we have to give an email address that we're going to be sending this email to.

  • So I have created a test email account.

  • Simply test geek dot com.

  • And so this is who the email is going to be set to.

  • Then we do dollar sign subject equals.

  • And so this is simply gonna be the subject blind.

  • And I'm gonna have temperature alert here you could have something else.

  • Let's put temperature alert.

  • Then what we're gonna do is we're gonna have a message.

  • So what is the message?

  • And so this gets a low, convoluted little bit.

  • There's some concocted nation in here again.

  • We're super gluing some things together.

  • So the message is going to equal double quotation marks act.

  • So we're gonna say at Colin the space, the value of time stamp.

  • So act 3 40 at 2 20 at whatever else.

  • Right?

  • Then we're going toe so at and then we do a period so within PHP can catch.

  • Nation is done with a period.

  • We're gonna put the value of a dollar sign, timestamp.

  • Then we're gonna can cat named to the end of that.

  • We're gonna superglue under the under that using period and then double quotation marks.

  • We're gonna put a space in there.

  • The temperature reached.

  • All right.

  • Space double quotation marks.

  • The working cat may begin.

  • We're using a little period and whatever the value for temperature F is so at 2 40 the temperature reached 95 degrees.

  • Right?

  • Or it would just be 95.

  • Actually, we don't put degrees in there and So this is the message that will be sent on.

  • That's where using that little king cat nation to duct tape things together.

  • Then the final thing is the headers.

  • So some additional headers that you can put in for the email S o for this.

  • What I'm going to do is from Colon, and we're going to say alert system at e t c g dot com So, basically, who is this from now?

  • Do you realize for a hacking purposes?

  • I'm just saying, this is not a hacking video, but somebody was gonna do a hacking video.

  • Just realized This is literally the from is literally just text I put in whatever that how I want.

  • So I'm putting alert system at e.

  • T c g dot com.

  • So one of the things that this could be useful for is, let's say you have rules in your email box, so messages from this email address go here or get forwarded here or something else happens.

  • So that's that's one of the things you could use for multiple layers of how this whole system can work is you could plug in a specific email address here, basically as something used for those rules to know what your email client should do with the message coming.

  • But I'm just simply doing alert system of e t c t dot com So I could see that there.

  • Then what we're going to do is we're going to do the male function.

  • So this is the male function and basically the male function.

  • All we're gonna do is we're just going to feed it the values of the variables of that we've created so right in the mail function, it is going to be to the value for to the value for subject, the value for message.

  • And then it is kind of weird that the value for headers So do just realize headers, for whatever reason is after a message again is just how it is.

  • This is how it works.

  • Then, of course, we do the semi colon at the end, you're gonna notice.

  • Here I have this print script ran time, and so for print, this actually prints out to a web page so I can go directly to this script.

  • And if I go directly to the script, it will fire off the script, and I'm using this as a troubleshooting tool just to make sure this script is actually firing.

  • I'll show you that second, but this is the code that's required four for this particular project so that let me let me let me actually power up the board and upload the code, and I'll show you how this works.

  • Okay, so I've uploaded the script and I've powered up the board.

  • And so now the Arduino, you know, with WiFi is reading the temperature readings, and we can actually make this script work now.

  • One of things I want to show you before we get into that is I do want to show you this little troubleshooting routine that that I use.

  • And this is the type of thing I use.

  • You don't We probably don't want this in the production environment.

  • But again, when you're just troubleshooting trying to make sure everything's working, this could be useful.

  • So, basically, if I call the script directly, right?

  • So if I go www failed normal dot com, Then I go forward slash test.

  • It's in the folder test and then I do email script PHP.

  • Right.

  • And then I hit her.

  • Why?

  • I put that that that little code in there is.

  • This is what we'll see.

  • So script ran at basically says 2 to 57 35.

  • So two o'clock to 57 minutes.

  • Two in the afternoon.

  • And so the important thing for me here is that the script is actually running.

  • You want to make sure again, like when you do these scripts?

  • I mean, did you did you screw up, Capitalization?

  • Did you did you forget the frickin PHP tags or to close the pH tags?

  • PHP tags?

  • One of things you want to know is whether or not the script is actually running.

  • So I put this in here just to verify that the script is actually running now, one of things that you will notice is the time seems weird like Well, wait a minute, you lie.

  • That's a weird time stamp.

  • So that's a time stamp.

  • But this says two of basically two o'clock or almost three o'clock here and this has 11 o'clock here, will remember this time stamp is going to be based off of whatever the server time is.

  • So whatever time you ve set in your server, so actually, in the server itself, within Lennox, your Web server, Whatever the time is, that's what the time function is going to use as the time.

  • So one of the problems you can run into, like my issue here.

  • It's because I use a shared hosting plan.

  • I can't change the time of that main server.

  • So something that you just may have to to realize if you're gonna be using a shared server is realized.

  • The difference in time between between what?

  • That server is telling you what your actual time is.

  • You may just have to get that in your head again.

  • If you get an email alert that says something an event happened in the future, it actually happen in future.

  • It's just the time on the server.

  • So anyways, let's go over.

  • Take a look at the yard away now, So I got the Arduino here.

  • We're going to go to tools.

  • We're going to go to serial monitor, and so we're seeing it's trying to connect to the network name test.

  • This is basic normal thing that goes through than a few seconds, will get our nice little I P address and I'll start spitting out the temperature's okay, s s i d is test I p addresses 1 72 16 42 5 Now one of things that I've done here is I've turned on the show time stamp again.

  • For me, it is just something useful for troubleshooting purposes.

  • Especially like when I do that.

  • You said the email to make sure that it only on Lee pauses for 60 seconds for one minute so we can see right now is since the temperature.

  • So since the temperature is below 80 degrees, it's looping through, and every three seconds it's telling us what the temperature is.

  • So tempt equals 71 20 Tempe goals 79 32 so on and so forth.

  • So if I go over here and I put my finger on the temperature sensor, we will then see the temperature goes up, goes up 78.23 And then once it goes above 80 now we see it says e mail sent.

  • Temperature equals 83.50 So that temp equals 83.50 The temp is the variable name, and in the 83.50 is the value.

  • And so the in the post that's where we're going to be a big grab the value for the variable in the PHP script.

  • Then all we're gonna do is we're gonna go over to our email client, so I simply have our workspace up.

  • Let me see you do a refresh.

  • Um, and we have on alert here, so let's go and take a look at the alert.

  • Okay, so this alert here.

  • So this is the alert that I got from running the test.

  • Right?

  • So when I went to this script, remember when I went to the script, but I didn't actually given a post information.

  • The script ran and there was no a value for the variable temperature F.

  • So when I go when I took it, take a look of the email.

  • This is what we get at again.

  • Two fifties of in the temperature.

  • Reached nothing.

  • And the reason reason it reached nothing is because I called the script directly.

  • Did not give it any post information to go back to inbox.

  • Refresh.

  • There we go.

  • Now we have we have received this current alert.

  • So the current alert we click on this.

  • So this is what we actually are getting from the Arduino, You know, WiFi as of this moment.

  • So at 15 hundreds of basically three o'clock, the temperature reached 83 point 50 And so I could say, Oh, no, Look at that.

  • The temperature reached 83 degrees.

  • I need to do something about it.

  • So basically the temperature sensor with yard we know at this point it pops right.

  • It paused for at this point.

  • It paused for 60 seconds, so paused for 60 seconds and then waits and order to run through the loop again.

  • If the temperature had continued to be above 80 degrees, it would have been sent me another e mail at the 62nd mark and then another email after that.

  • Another email after that.

  • Another email after that, since we can see that the temperature went down, then it stopped sending e mails.

  • And so we got that one e mail.

  • And so really, that's all there is for this particular project, and it's just important to understand that you're able to use our DWI.

  • No.

  • So you write the the art we know sketch then that is able to post up to a server again.

  • We're using a shared shared hosting is Lennox Server were ableto post up to a PHP script.

  • And then that PHP script is able to use the mail function on the Lenox server today.

  • Send you an email, and overall, it's a pretty simple system that works pretty well.

  • So that's all there is to this very simple project, right?

  • So ever artery?

  • No, you know, with WiFi, we have an analog temperature sensor, were able to post up to a Web server.

  • That Web server then takes that post information using a PHP script, uses the male function and then spits out the email.

  • But this is one of the things that I want you to understand about the real world of technology.

  • Ah, lot of people like to complain about the types of videos that I do when they say, Oh, Eli, the videos that you do are so simple.

  • Why don't you talk about rial technology?

  • And what I want you to understand is really Technology is simple.

  • It's a lot of very simple components that you duct taped together into a complex system, so building a layup server is pretty simple.

  • Doing a PHP script is pretty simple writing Arduino sketch and connecting a temperature sensor is pretty simple.

  • But when you're trying to tie all these things together, communicated over a network, make sure everything functions how it needs to function in a production environment.

  • That's when it gets complicated.

  • Ah, whole bunch of very simple things come together to make something complex.

  • Now again, I will warn you if you're going to be doing this project if you If you don't have a server that's built with email functionality already set up, I would highly recommend you just use a shared hosting platform.

  • Shared hosting insist server.

  • Get three bucks.

  • Five bucks whatever per month, I think will make your life a hell of a lot easier.

  • And again, even if you do running production stuff somebody think about is how secure those communications really have to be.

  • Because it was just like stupid ass notifications.

  • Simply is bouncing it through share.

  • Hosting server might make your life a hell of a lot easier to, because if you're running through a share hosting server, you don't have to worry about power supplies failing.

  • You don't worry about a lot of weird things going on, so this is just something to keep in mind now, issues that you may run into using the male function on a shared hosting server is depending on how stringent your anti spam measures are within your enterprise of these email messages.

  • Maybe caught, maybe shoved in the spam been by your whatever spam service is that you're using.

  • Since you're not using, like a really email account you're not sending from a normal email account with everything that goes along with that, it may be flying to spam.

  • So that's just something to keep in mind when I do this.

  • Using Google or using any of the normal email service is the emails come through fine, eh?

  • So you just, you know, depends on what spam surfaces you're using.

  • If you're using some kind of very stringent spam service, you may simply not get the email at all.

  • It may just simply delete it, for whatever reason, again because, as I showed you, it could be a phishing attack.

  • Remember that from that from all that from is is text I could put in whatever the hell I could put in support at Bank of America dot com.

  • So there's a reason why a spam system would simply delete this type of thing, because literally what I just showed you could be could be a type of phishing attack if you wanted to build it that way.

  • So one.

  • If you're using a strange it's Pam system, just realize you may not get your email messages or two.

  • If you're not using such a strength, a spam system.

  • This may also just simply get dropped into your spam box again, whether using female or outlook or something else.

  • Because it's a non normal email service may get jumped in your spam box, so you may have to look in your spam.

  • And then you may have to say, This is not spam and go from there.

  • So that's that's the only real kind of hiccup you might run into this into with this.

  • Thea other thing is also making sure with your share hosting plan that it does do, and the male function with Ph.

  • B.

  • Does have.

  • The email service is one of the reasons that he used fail normal dot com versus Eli, the computer guy dot com for this particular project is because of the email alighting Peter Guy dot com Actually use email service is custom.

  • Email service is on that particular server.

  • Eso.

  • When I try to run the male function there, it fails out because of other configurations that have set up some.

  • One of the reasons I went with fail normal dot com is that that particular servers a pretty vanilla server.

  • It's set up normally, eh?

  • So he didn't run into the same issues.

  • So those were some of the things that you may have to work with if you're gonna be dealing with this.

  • But again, if you go with a simple go with a clean a clean of $5 a month, go Daddy, your host gator or whatever sharing hosting plan and this male function should work fine for you.

  • Now, if you are worried about Spanish use or anything like that, your email messages not going through one of the classes where the videos we will do when the future is using something such as like a send grid ap I order sent e mails.

  • So in order to send an email right now, we're using the male function within PHP.

  • You can also use send grids AP I so we take all that post information, we dump that into a format that send grid understands.

  • And then we can actually send out an email on SMTP email through said Degrades infrastructure.

  • But then that requires us they're going to do this, integrate a p I and said for a sin, Great empire.

  • So one thing that I would tell you, if you're thinking about using something like this and again a production environment, I would really say Take the time and energy to learn how to integrate.

  • Sent Big Red, I think send Grid is free for up to 100 email messages a day.

  • Something like that.

  • I would argue, if I was gonna do this in production, I would probably integrate.

  • Send a grid into the system.

  • You'll probably get better results for being able to send out e mails and make sure everything is is good and you don't run into any kind of weird problems.

please go to the line the computer guy dot com, in order to view schematics, code and Maur for the projects that you are learning about.

字幕與單字

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

B1 中級

使用PHP郵件功能從Arduino Uno用WiFi發送郵件通知。 (Send Email Notifications from Arduino Uno with WiFi using PHP Mail Function)

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