In this video, we'll be going over the Censor Stream Project, which is essentially taking data from our surroundings such as light, sound, and temperature, and then studying that data to AWS IoT, and then displaying that same data on the EC2 server. So, here are some of the requirements that we need. Of course, we need the sensors mezzanine to connect all the sensors to the Dragonboard, and we need three grove connectors to compensate for how many sensors we have. And then we got to connect these as well. And we got the temperature sensor which is connected to A0, light sensor that is connected to A1, and sound sensor that is connected to A2, and these are analog ports on the mezzanine. And if you guys don't know what these are, we advise you guys to go back and review course two, and we'll get on with this. So now, just like a general description of what's going on exactly. This will make a lot more sense when you see the code in action and what's happening. So, the first thing we have is an Arduino program to take in analog data from the sensors. Now, that's just on the mezzanine itself. Now, what it does with that data is it just processes it a little bit, do some math, and then sends it to the Dragonboard over serial. And on the Dragonboard, it reads it from serial and then sends it over to the AWS IoT, and on the topic "dbSensors." We've kind of gone over this already, but again, the topic is kind of like a radio frequency, like when you're listening to 94.9. That's just some random radio channel here. And basically, it just broadcast it. It doesn't care about who listens to it, but it's just the easy way to communicate. And then after it sent it to that channel on AWS, it listens on that same channel and then whatever some data is sent to it, it'll send it and save it to a DynamoDB database. DynamoDB might sound strange but it's just Amazon's own database service. After that, we create an HTTP access point which, basically, you go to this URL and it hands you data. And we do that using Lambda and API Gateway. Now, for the AWS IoT, and Lambda and API Gateway, that's supposed to be done in the AWS console. So, we link to that as much. So basically, it'll allow us to access the data from the Dragonboard using a URL. And the last part is serving a website on a web server using NodeJS on an EC2 instance. Now, again, an EC2 instance is just some computer running at Amazon that we borrow and that's accessible through the web. So, now we'll be going through the demo. So, here we are in the folder that we created, Embedded-Programming. That's just like a temporary folder that we've created for now. But, when we release this, you'll expect it to be in our GitHub, which is under UCSD Coursera folder that you can clone. This is just a working repository stuff, don't worry about it. So, here are some of the directories within the module itself, and within the program itself. So, the first part is the Arduino and this part, let's cd into it first, and then let's ls. And then, this part is important for reading what is actually happening in the outside world into the mezzanine, and then converting that to some kind of serial input that we we store into a Python file, and then we can run this Python file to see what is actually getting inputted from the sensors. So, the first part is the Arduino part, and this is the part where it takes it in, rather than the part that actually prints it out. So, let's just go into this file. We'll be going over how it's settling on more later. But just to get you a look of it, it's not too complicated, just reading from each sensor, doing a little bit of math, and then printing out over serial. And then we can exit out of this quick view. We'll go over it more in the next video. And here's the readSerial Python file. And this is just printing out what we saw from the sensors. And let's go back to our directory, our previous directory, and let's ls again. And the Dragonboard is the second part of our program and let's just cd into it. Here, we see some important files. These are some of the keys that they provided so that your information doesn't get corrupted on the way or there are some security stuff that goes on between. The main thing we got to worry about is just this. The send-data-aws part, so let's bring them into that. So, sorry we didn't start at the top. So, this part is important for communicating onto the MQTT client, and parsing out all the information and formatting in a way that can be readable for later, so that we can print out the data correctly. We will be going over this later as well. And then, in order to start off, we recommend that you run the start.sh script as well. Just heads up, installs the Python SDK for it and just gives you a quick start. And then, let's cd into the EC2 server. And this part is the NodeJS file which is for above JavaScript, and this allows us to print what we want onto a web server. And we want it to be accessible through any phone, computer, so forth, so we are using, well, we'll go over it later, but we'll be using HTTP. And here, look how the file looks like. And then, let's move on to some of the AWS IoT stuff that happens on the AWS IoT website. Not so quick. Let's just run the Arduino program and then make sure the sensors are set up. Okay. So, first we want to run the Arduino. And then let's ls. And then just do your make upload reset_stty. You don't have to have this memorized, but we do because we've done this so much. And what this is doing is reading input from the sensors and putting it on a serial port. Taking a while, and then we run sudo python readSerial.py, and this will print out what we're reading from the sensor itself. So, if you mess with the sensors, you can see that these numbers change. We went over this in a sensor cluster video, if you guys want to check that out. But basically, if you just mess with the sensors, the data will change. The temperature got hotter because he grabbed the temperature sensor. And then, I can make the sound one get higher at 648. So, you've seen the data changing. And then we just want to go through the Dragonboard folder and running that file. So, if you go into it and then we can go to the Dragonboard, and then just run send-data. Now this will send the data from the Dragonboard, and then send it to AWS so that anybody can listen to it that's on that channel. Okay, so let's check it out on the website. We have the data being sent out to AWS IoT. So now, we're going to see how that looks like on AWS. So just on that service thing, and then we can just choose test. And this basically just allows us to listen to one of the channels or frequencies that we chose before, like listening to 94.9 FM, like you want to listen to your favorite music. But our music is sensor data, not as exciting. So, the channel that we call it is dbSensors, and you can just type that in and click Subscribe. And you can see here, here's a bunch of data on the sensors. Ninety, 25.12, keeps constantly updating, so it's hard to scroll with it. But if Andrew just makes the temperature one go higher, you can see that it goes from 25 points all the way to 27. This is live data showing on your website or your laptop. So now, we're going to go from this, and just show you how can display it normally through a website. Now, we're just going to use another service, it's called EC2. We've gone over this a bit before, but remember it's just a computer AWS has, and it's open to the internet, and we can just run stuff on it. We're just going to go to Running Instances. I already have mine set up, we just zoom out a little bit. And the one we chose, I labeled as IoT. And just go here and you can just start it. One important thing when you guys are using this, make sure you guys don't, like when you start it, you run it, it charges you. When you stop, make sure you don't put Terminate because that deletes your entire computer. No, not your actual computer but whatever you're running on AWS. I did that for a class project, sad. So, it just takes a bit to start up. We installed NodeJS and some other programs on this before. They'll be in the instructions on the Github for this. So if you to just want to connect, copy this, I just control+C that, and then we can go to Ubuntu's terminal. And here, we have the pem file, that's like the password to the server, and we just copy and paste this. So, it'll just ask you, "Do you want to connect to the server?" And just say, "Yes." And, here you go. And then we can go directly to our files that we need, course three. So, this folder or directory will appear a different name by the time you guys use it. And you guys can do all of this directly on the Dragonboard, you don't need a separate Linux computer for it. You could totally run the server on your Dragonboard, but for this, we just want to show it being accessible from anywhere. And go there. And then we can go here and temp-light-sound. And just since we're running on EC2 server, we'll want to run a code for that. And then we have node modules, don't worry about that. That's just how NodeJS likes to store its library that you install into just the folder next to it. And then index.html, that's just the page that will show up. If you're not experienced with web development, a good resource is W3School, so if you guys or even just using your favorite search engine and looking it up, HTML, CSS, JavaScript, and stuff like that is really useful. But we'll just start up this NodeJS server. So, one thing to note is how you run a node file is by using NodeJS in a file, kind of like Python. But you can see here that this will fail because the server wants to run on port 80, but that's a protected port, so we have to run it with sudo. And here, you can see that, "App listening on port 80," no error, it works. And then now, we can visualize the data by going to the website hosted on a server. Now, you can do that by just going to IPP for public IP and copying those numbers, and going to your favorite browser, copy that in. And there we go. This is the website we have, it's right there. Now, if Andrew messes with the sensors, you can see all that change. See? He's messing with the sound one by tapping it really loudly. So now, those crazy yellow spikes. So, yellow is obviously for sound, blue is for light. So, if we cover the light one, where did it go? There it is. So, we cover the light one. So, we cover it with my hand and it just drops in light intensity. The red one's temperature is way low compared to the rest, that's just because it had some math done on it. So, this is essentially what you can do. You can turn data that you're collecting on like next to you in your home, displaying it on a website that anybody can see. Now, this is just for some simple data, but if you want some more interesting stuff, like I don't know, health data or something, you can just display and possibly your doctor you can see it, and give information on that feedback directly. And this can just be constantly running, connecting data. On another way, you can also make it so that the website interacts with some kind of servo, or something like Dragonboard. Basically, it's just showing how you connect websites to devices and sensors that you interact with physically. So, that's our demo for that. We'll be going over how the code works in the next video.