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.

  • So in today's video we're going to be doing is we're going to be creating a visual alert system to say whether the Internet is up or the Internet is down.

  • So imagine if you're in the help desk world.

  • If you're on the desktop support world and you get the call and some say that down and a big question is, Is the Internet down or is the user being a moron?

  • Wanted to be nice to just have a visual system so that your users in your environment, if they're having a problem, they can look up?

  • If an led light is green, they know is most likely their problem.

  • The Internet isn't actually down, and if the led light is red, then they know.

  • Oh yeah, the Internet is probably down, right?

  • They go to Salesforce when they go to Salesforce.

  • Are they not getting the sales force because they just installed some stupid ass new plug in and fire fax?

  • Or can they not get the sales force because the Internet connection is simply disconnected.

  • So what we're going to be doing today is we're gonna be using our we know, you know, with WiFi.

  • So this is going to connect to our wireless network.

  • And then what we're going to do is we're going to simply connect.

  • Just connect to google dot com.

  • We're gonna go go to google dot com at Port 80 and we're going to see whether this aren't we know.

  • You know why?

  • If I can't connect to google dot com at Port 80 if it can, then it means you have an Internet connection all the way to Google google dot com.

  • And so, therefore, it's not an Internet problem.

  • If you can't connect, then you know that there's probably an issue along the way now to be clear again when you're doing troubleshooting because because he can't get to and I peed address.

  • It doesn't mean the service or platform is doing what the hell is supposed to d'oh!

  • But this is just one of those simple troubleshooting tools that you can have so that everybody can be onboard.

  • Everybody could be on the same page, right?

  • If you have a little cubicle farm.

  • All the people of typical farm they can look up and go.

  • Oh, the Internet line is Rand.

  • It's time to go on a coffee break again.

  • This is one of those important things to be thinking about in the real operations world in the real world is giving people tools so they know how to respond appropriately.

  • So imagine you have a cubicle farm.

  • People are working, working, working, working, working, working and all the all of a sudden, the internet doesn't doesn't seem to be working, right, Right.

  • You know, one of their questions is do I sit at my desk and do stupid things?

  • Or is this time for a coffee break?

  • Is this time for a potty break?

  • Is this time Thio?

  • I don't know.

  • Call the baby sitter and make sure the baby sitter knows toe calm at the appropriate time tonight.

  • Right?

  • So if they can look up, if they can look up visually say c o the internet is down.

  • Okay, I'm gonna go to the bathroom right now while the I t folks fix it right?

  • Not only does that make them feel more comfortable, but it allows them to start started doing things that are appropriate for the current situation.

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

  • I'll show you how to build this little thing.

  • This is literally all theirs, basically not a whole lot to it.

  • Then I will show you the coat and then I'll show you how it works when it all comes together.

  • So this project, like most of these kind of notification alert system projects, actually doesn't have a whole hell of a lot to again.

  • We have our Arduino, you know, with WiFi here and then basically all we've got for hardware otherwise are the two led green led a railing.

  • Led.

  • Of course, we have 220 0 resistors.

  • And so we don't blow out these ladies.

  • Then what we have is we have to the green led.

  • We have digital pen at number nine is going for the positive to power the green ality digital pin number 10 is going to the red led on power positive then for ground.

  • Since all we all we have for this particular project is simply too l ladies, I'm just running the ground wires back to the two the two ground connectors on the Arduino board itself.

  • So we don't need to make this any more complicated than it has to be.

  • And so this is all that's required in order to make this work Now again, since this shows with the ladies, we can connect this to an external power supply and not have this connected to the computer at all s so we can connect us again to like something like a battery pack, or just connect this to a wall outlet.

  • Today I will be used connecting directly to the computer because we will also be using the serial monitor to see what the output from the cereal monitor is and see how that corresponds to these l ladies.

  • But do you realize with this project this is one of those projects that you can separate off and have completely disconnected from a computer so that let's go over and take a look at the code?

  • So here's a coat that we're looking at today, So this is relatively simple code.

  • There's not a lot here, but it is important that you understand all the different components of it.

  • There's some a couple of I want to release a tricky things but things that if you if you mess up, could cause problems, that's the first thing we need to do is we need thio Include the WiFi, A library.

  • So we have the WiFi Naina, the eight library included here.

  • Then we're going to have the two led is the green led and the red led.

  • So we're going to have Google Online led.

  • So this will be the green led that's gonna connect to digital panic nine in the Google off line led the Red led and that is going to go to a digital 10.

  • 10.

  • Then we have the information that's required in order to connect to the WiFi network.

  • So we have the chart as s I.

  • D.

  • So my s s i d is test and I do not have a password at all.

  • So that's all that's here again.

  • I leave my password blank gonna keep this simple so I don't run into weird networking issues.

  • Well, I'm developing things.

  • Then we're going to come down, we're going to create a variable for status, and we're going to set that status value to W El Idol status.

  • So This is just simply a variable that we can determine what is the current status of the wireless link when we're trying to connect, the next thing we're gonna do and this is one of the important ones, is we're going to create a variable for Google.

  • So basically, this is what we're going to be testing against, and so you can put whatever domain you want here.

  • So I am using Google.

  • So the reason that I use Google is I figure, again, being on the east Coast of the United States, Google should have 99.9999% up time.

  • So if all I'm trying to do is make sure that the intern that the Internet is working appropriately, connecting to something like Google makes sense to me to be clear.

  • If you are in Africa, if you're in South America, if you are somewhere else and you don't believe that in your area, Google hasn't 99% up time that you may want to put in a domain name here that is more appropriate to sit your situation.

  • I don't Ali Baba Doc, like literally maybe ali baba dot com something like that.

  • So basically, you name this city.

  • The brackets remain.

  • The brackets remain, but the front part of this can shape so you could have this toe Alibaba.

  • And then it's ali baba dot com 10 cent dot com Whatever you are, plug in there.

  • Now we're gonna come down on We're going to create a client for the WiFi client.

  • So So using the library.

  • What we're doing here is where we are allowing the Arduino itself to be a client.

  • So we're allowing this to be able to connect to another networking device.

  • So we have WiFi client on, then we're going to just call that client.

  • Then we're going to come down and we're actually going to set up the environment.

  • So we have pen mode.

  • Google Online led output Dan Mode, who will offline led output.

  • Same thing is normal serial about again.

  • So we're gonna be using the serial monitor here again to see how things correspond.

  • The LAPD's correspond to what we're actually reading out from the Arduino.

  • This can be removed if you really want Thio, then down here.

  • This is basically the copy paste thing that we normally do for connecting to the WiFi network.

  • While while Luke the status is not equal to connected, then it's basically trying to connect.

  • Then we have status equals.

  • And this is the wife Ida.

  • Begin.

  • This is the function that starts that tries to start the WiFi service.

  • So S s I D password tries to connect delays for 10,000 milliseconds.

  • 10 seconds.

  • If it doesn't connect, it continues to loop.

  • As soon as it does connect, it breaks out.

  • They were gonna come down here, got a setup serial print with the SS ideas.

  • That's what this is.

  • We see this a lot.

  • Then we're going to print out what the local I P addresses.

  • So again, this this may be important for you to know what the local I P addresses.

  • So that's what we're printing out here.

  • But then, one of the important things that I've added because again, we're doing network troubleshooting network trouble.

  • There's a lot of stuff involved network right now.

  • And so one of the big problems you may run into is your default gateway, right?

  • Your default gateway is what should be connecting you to the Internet.

  • So especially with the a c p somebody goes in.

  • Somebody is really stupid.

  • Screws up your D A C p scope or, you know, mucks around with the default gateway by accident, you may be providing the incorrect default gateway to your d A c p clients.

  • And that's why you're able to get to the Internet.

  • So again, that's where you gotta You gotta be careful.

  • It's not that the Internet doesn't work that somebody fat finger the number for the default gateway, the incorrect default gateway is being provided, and that's causing the communication issues.

  • So what I'm gonna do here is gonna say I p address.

  • So this is a type of variable, and we're going to call a gateway, and we're going to make gateway equal to wifi dot gateway i p.

  • And this is going to read what the default gateway that your Arduino, you know with WiFi has been provided.

  • So we go down here, it's going to print out the I P address and then is going to print out the default gateway because again, you don't know how many times I've seen.

  • Always somebody always somebody else did some I I swear somebody else always does it, but somebody goes in there doing something with the D A.

  • C P scope.

  • They do something really stupid.

  • For some reason on default, Gateway gets screwed up again.

  • The Internet isn't down.

  • It's just be phone gateways the incorrect configuration.

  • So we're gonna have that there and again.

  • This can also show you this may show you what the router is, where the modem is so you can go in trouble.

  • Shoot that.

  • If you need Thio, they were gonna come down and we're going to get into the loop.

  • And as we can see, the loop is incredibly short here.

  • So we're gonna do here if we're going to do is client So client, this is what was created up here.

  • So you have to create that up here.

  • So if client doc connect So we're trying to connect to Google.

  • So Google, if we go up here, this is the variable for Google.

  • So it's gonna be reading from this.

  • So whatever you flung in here and that that's what it's actually reading, it's the value.

  • So what is the value of Google at port eighties was going to try to connect to the value of Google at Port if it does connect.

  • They were on the serial dot friend Google is online.

  • So this a static text and then we're gonna do here is sealed, not print line client Doc remote I p So this is kind of cool.

  • So what this does is this is going to then print out what the i p address of Google that you're getting back is again.

  • This could be useful for troubleshooting.

  • You know, again, D and s gets mucked up again.

  • Especially like with larger enterprises where you can actually administer your own d n s.

  • Sometimes somebody fat fingers, the D n s.

  • And again, it's not that Google is down, it's that the i p address so you can run into problems anyway.

  • So this gives with the the remote I P addresses and we're going to say is digital right?

  • Google Online led is high, so if it is able to connect, then it's gonna be that's gonna turn the green light on digital, right?

  • Google offline led low, so that's going to, uh, turn the red light off so the green light will be on red light is off else.

  • So if it basically, if it can't connected.

  • This is not actually working That is going to serial about print line.

  • Google is off line.

  • Then it's going to turn.

  • The green led off and it's going to turn the red led on.

  • And then it's going to delay for 2000 milliseconds or two seconds.

  • And that's really all we have with the code here.

  • It'll go through the loop and again if if it can connect to the value of this again.

  • This is up here at Port 80.

  • Then all of this will run.

  • You'll get the remote I p.

  • The green light will turn on so on and so forth else.

  • If not, you'll get.

  • Google was offline there.

  • Red led will turn on.

  • So with that, let's let's see this thing in action So ever do we know, you know, with WiFi, we're going to now connect this to our computer, so give the power and allow us to access the serial monitor.

  • We didn't go to the computer.

  • We go to tools, we got a serial monitor and we could see its attempting to connect to a network name test.

  • So right now, no lights are on as it's trying to connect.

  • We're gonna wait.

  • Is gonna take l.

  • I said right around 10 seconds or so.

  • Okay.

  • This is the the information we have now.

  • So we have the s s i d of test.

  • We have the i.

  • P.

  • Address.

  • So this is the I.

  • P address of our Arduino device and then the default gateway of our Torino device.

  • Again, this could be this could be a big problem, right?

  • That default gateway is miss configured.

  • Then it's not about rise.

  • And it's not about Comcast.

  • It's about somebody in your side being fat fingered, then passed that we see Google is online and it's online on that remote I p address of 1 72 to $17 on 64 1 42 and we can see that the led is grain.

  • So that's great.

  • So now what I'm gonna dio is I actually have a a a connection to to the network down here in my basement.

  • So I am literally going to run over, and now I'm going to run over.

  • I'm going to disconnect the network cable.

  • We're gonna see what's going running over running over running over.

  • I know this distant acted as a hardwired connection to the Internet.

  • And so now we're gonna wait a second and it's going through.

  • And one of weird issues you're gonna give is, Although you have that delay of 2000 milliseconds, there is also, like, a time out.

  • So right now the hardwire connection is completely disconnected.

  • But why?

  • It's taking a little bit longer.

  • It'll take like up to 30 seconds initially because it goes through this whole time out process.

  • Basically, it's trying to connect.

  • And okay, so now we have the red led and we see that Google is offline.

  • So now I'm gonna run back.

  • Run, run, run, run, run!

  • So here I'm now connected the hardwire connection back to the internet.

  • So we come back, we can now see Google is online and we can see the light is green.

  • So that is how this thing works in the real world.

  • Literally.

  • When I wanna yank the cable of it shows that Google was off line and you get the red light as soon as you plug the cable back in.

  • Well, we've got a few seconds within a number of seconds.

  • You can see that is back online.

  • The green led is lit.

  • And so So there you go.

  • This is how this project works.

  • So that's a simple project that you can use an Arduino gonna WiFi in order to create a visual alert system for whether the Internet is up or whether the Internet is down.

  • This is one of those great things again when you're dealing with end users that are already stupid as rocks to begin with, right, giving them a little things like this just makes your life a lot easier, because again, if they're sitting there and having problems, if they look up and see the lights red, then they know there is a larger issue going on.

  • If they look up and they see the light's green baby, maybe they'll reboot their computer before they call you.

  • Maybe the other reason that this could be useful is again just for yourself, right?

  • You know, a lot of people think with I t people that were on the computer or on the Internet all day.

  • Somehow we goto work, and for nine hours we're a lock to our computer.

  • But you know, we're going to the bathroom to were grabbing cups of coffee.

  • Two were reading books to We're communicating with people again.

  • When I was doing i t professionally, really, 25% of my time was actually the technical work and 75% was everything else.

  • And so if you have a visual lock system like this, you know, you put this up in your server room, you put this up in your office or your cubicle.

  • This is just a nisi way.

  • You know, you're sitting there reading some Sam's and 24 hour book or trying to figure out some aren't we know project.

  • You look up and all of a sudden you see the lights lights red and you go, Oh, crap.

  • I'm about to start getting some work orders in.

  • Let me go trying to fix this before anybody knows what's going on.

  • So this is great for end users, so they feel more comfortable because they understand what the situation is.

  • This is better for managers again.

  • Imagine if you're a manager.

  • So when one of the companies that I worked in, we had a cubicle farm with 100 sales people, and so when those sales people were asking what should they dio.

  • If the manager can look up and they can see that the Internet itself is down, the manager can say, Oh, well, Hey, why doesn't everybody take lunch early today?

  • Well, the while the darn i t people you know do what the hell they're supposed to do, right?

  • This is one of those cysts that things that can actually be really, really useful in the real world so that this is related.

  • This is what really all there is to it again.

  • If you want to try to make this more complicated, you may do things like blinking.

  • Blinking green lights are blinking red like the for you may you may go through like with iterations, so you may do something with, like turning the green and the red led on or off.

  • So let's say when it's constantly connecting to Google, you have the light be green, but then you have a progressively longer time off for the green led to basically make it blink if it's causing problems.

  • So instead of immediately going from green to red, maybe you could have a middle process where the green light starts to blink.

  • If it's noticing issues And then, if it continues having issues for something like a minute, then it flips over to read those air kind of some of the things you can think about with adding a little bit of code there to make it a little bit more functional again with any of these projects, I'm showing you things in, like this classroom environment you really have to think about.

  • You know, when you're gonna put this out in the production of Iron Man.

  • How do you really want this to work?

  • You really want the length of flip?

  • Read as me immediately if it can connect a Google again in the real world, there's blips.

  • Maybe you want a delay on that process.

  • Maybe the first time it goes to it can't connect a Google away.

  • The second time will way again if it times out after a minute.

  • Maybe you wanted to flip over to Red.

  • That's something that that you might want to think about a little bit, but again, you guys are the tech professional, so I'll let you figure that out.

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 初級

帶WiFi功能的Arduino Uno上/下行LED報警器。 (Internet Up/ Down LED Alert with Arduino Uno with WiFi)

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