$19 Particle Photon unboxing and demonstration of wifi enabled IoT

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hey guys, John from John's DIY Playground. Today I want review for you the internet of things board called the Photon, made by Particle. They're at http://particle.io/ they make this board which is wifi-based you can flash it over the air and send and receive data from it very easily on the web. They also make an Electron device they call it, it's a 3G cellular version of this which is really, really interesting. Check out my video on my channel for that review if you're interested in that product. Today I'm going to unbox this Photon and show you what you get inside, and how to get your first program up and running. So let's have a look. It's a very small device as you can see compared to this quarter. It's got analog and digital outputs just like an Arduino would. It comes with this nice sticker. It tells you go to their website http://particle.io/start to get started which we'll show in a minute. And then the device itself I ordered with headers which means it comes pre-soldered with the pins on it so it's easy to breadboard. On the bottom it's very plain, which is fine. On top you've got a couple of buttons, you've got a built-in chip antenna, and then you've got this uFl connector. That's if you wanted to use an external antenna, but I find that just using the wifi network with the chip antenna has no signal problems whatsoever. Let's take a look what we need to do next on the web. Alright guys so get started I've followed the instruction on the box that said http://particle.io/start pulls up this page here. You've got the Core which is like maybe a 2-year old device. The Photon what we're talking about today is really like Core 2.0 in my opinion. And then there's the Electron which really just came out here in February 2016. So we're going to setup a Photon and so I'll click on that. And it's giving us an introduction and a guide. It's best to set this up by using the online instructions so I'll click on this "Setup my Photon". And it's going to say to power on the device which we'll do here in a moment. But very straightforward instructions. The other thing to remember is you want to connect at first with your wifi in your house. And the way to do that is you use your smartphone. In order to do that, you can go on Android or iPhone and visit the store, find the Particle, just search "Particle Photon" and you'll find it. I've of course already downloaded this for my iPhone. There's the particle app called Tinker. But you can see here it's going to show some of my devices. I've got an Electron as you can see I've got a couple of other devices. I'm going to setup a 4th device here for you today and show you how that works. A 3rd Photon of mine. So let me power up and we'll get started with the next steps. So I got my Photon attached to a breadboard here. I'm just going to plug it in for the first time. The problem with it is it's not going to be able to see my network yet. So that's why I logged in on that Particle phone app and created a user account. I'm using my existing one of course in this case. This flashing blue is normal for first time on. So what you do is when you show the screen that I just showed a moment ago on your phone, you hit the plus icon down at the lower right part of your phone and then you click on "setup a Photon". Hit the plus button. It says "Click ready" when you're ready for it. Choose your Photon, it should show up in the list on the screen. And of course this thing is just flashing away here as you can see. It's trying to connect to the Photon and the phone. I'm using a different phone right now, but it's trying to connect to it. And now it says "please select your wifi network" so I'm going to select my home network. And then it asks for the password, I'm not going to show that of course but I'm typing that in right now. And then I say connect. It's saying "connecting your Photon to your network, it can take about a minute". But you can see it's already reacting. The light is changing here how it's flashing. And now that it's breathing cyan like that, I know that its actually talking to the internet. It's on the cloud. So what might happen next is if it needs any kind of firmware updates it would start flashing again like a deep magenta color. So what I'm going to do now is just let this thing go for a few minutes and then we'll come back and we'll talk about writing our first program. Now that my Photon is connected to the cloud and has talked to basically the Particle.io website, I can see it now in the list of my devices, and it's got the "hoiser_crazy", it always comes up with this random name. But you can edit it and just change it. Go ahead and click there and change it to whatever the heck you want. In my case I'm going to name it tabasco4. Why not? So now it's got a new name. And let's move onto the next step. Before I get into showing you the software that will we're going to use for this demonstration, I wanted to point out how I hooked up my Photon to this breadboard. So first we have onboard this digital D7 LED. We're going to make that flash on and off once per second. Second thing we're going to do is I have this photoresistor, it's hooked up to the A0 pin and the A5. Then I also have a 1K ohm resistor hooked up to the ground, also hooked to analog 5. And then on the other side the third thing we're going to control is this LED from the web. I have that plugged into D0 and then it runs from the other pin back over to ground through this 220 ohm resistor. And that's how you setup your breadboard for this demonstration. Alright because we're going to control and LED over the web, we're going to have to actually write 2 pieces of code. I'll go over the easier of the two pieces right here. This is the HTML file. And you can find this on my GitHub site that I'll put in the description below. But your file will need to be modified in such a way it works with your Photon. There's only 2 areas to change. The first is on this line #14 where it says Your Device ID goes Here. You need to find out what your device ID is on your Photon. And so in order to do that what you do is you come over to the Particle build site and you would click on your Devices. And then you would choose your device and when you click on this right arrow it'll open up and show you your device ID. So that's as easy as that for that section. Now the other part you need that's critical is you need to keep the LED part of this line and the question mark and then delete this access token. Well, I'm sorry, you leave the access token equals and you put this part where Your Access Token goes here. That section is also found on the Particle web site. And to find that, what you do is again go to the build section and you would click on the settings gear. And that will open and show you what your access token is. Both of those pieces are critical in order for this web functionality to work. Now this is the second of the two pieces of code that we need. This is in the Particle build website where I place this. And you'll find a copy of this also on my GitHub website which you'll see in the links below this video. But I did comment it quite a bit so hopefully it's easy enough for everyone to follow. I won't get into too much detail here about the code but basically again our three objectives. It's going to flash the onboard LED at pin D7, we're going to read the sensor light levels and report that to the Particle web site, I'll show you how we can see what those reports are in real time. And then finally we're going to control that LED over the web as we described earlier with that HMTL file. Each Particle code is similar to Arduino where you declare your different integers and variables up in the front, in the beginning. Then it runs through this setup routine which is just a 1-time through when its on power up it initializes and does all these different things here. We actually describe a function called "LEDtoggle" that's going to be at the end of this code you'll see. Then there's the main loop section. It's not that big, it actually only goes to here. But we're cycling through the code very quickly and what we're doing is we're checking the system time on the Photon using the command called millis. And then comparing that to let's say the last time the Photon blinked the LED or reported to the Particle web site. So that's how we do this. We don't sit and do delays, we're actually using millis and setting timers. Now as far as the light level, we're going to report that in two different way. First, we're going to report and categorize it and say if it's dark, medium, or is it bright. We can send those different strings up to the Particle web site and we'll show that. And then finally we're actually going to show the light level as a value. It can be a value of 0 through 4095. However in the case of the photoresistor I'm using I'm getting readings anywhere from 200 to about 1100. So we're going to setup our if then statements based on those ranges. And then finally at the end of the loop there's a separate function again called LED toggle. And that's how we're going to control that external LED over the web. It's looking for a command to run this function and it either turns the LED on or off. OK so no we're ready to finally demonstrate how this all works. So what I'm going to do first here is I'm going to plug in my Photon. And you can hear my computer acknowledging that its connected via USB in this case. The next thing you want to do is you come over before your flash anything and you want to choose which device is the device you are going to actually flash to. So again click on devices section here and wherever this star is, is the item that's going to be flashed. So we want to flash to tabasco4 which is our new Photon. So now that I have the star there we can go ahead and do the actual flashing. Now to do that, you just click on this little lightning bolt, and you'll see the status down here tells us it's going to be flashing magenta, which it is. And that's it. It's already over the air sent that code to my Photon. I'll show you how the onboard LED is flashing on the web part of the code but let's show the dashboard first. Since we're hooked up the Particle dashboard can be found at dashboard.particle.io. And this shows a user log of what's happening with your device online. So you can actually see these references to tabasco4 and it's sending the sensor value last reported was 857 and then the category as I mention in my code is we're going with low, medium, or high. And it's reporting this value every so often according to the delay value that I set in the code. If I cover the sensor with my finger like I am now you can see its says dark. And the value drops significantly. We're down to 258. Conversely if I try to get it into kind of a brighter area and wait for it to report you can see 1352 and it's reporting bright. Alright guys so here we have the Photon itself up and running. You've got it breathing cyan which is the normal status when its hooked up to the cloud. D7 is flashing on and off at a rate of once every second like we talked. Our light sensor is functioning and reporting the light levels to the web, and then we have this external LED which we're about to control. I've pulled up my web site, web page that we showed earlier. The HTML. Cilcked on the "turn LED on" and then I click the "Do it" button. I'll do that right now. And there you can see it reacted almost instantaneously. So if I hit back on my browser, and I click "turn the LED off", then click Do It, and there you have it. It's reacting very, very quickly. And that's it, that's how the demonstration works. Hope you enjoyed it, hope you learned something. If you did, please click on "Like" and also subscribe to my channel so you'll be informed when new videos come out. This is John from John's DIY Playground, and have a great day.
Info
Channel: John's DIY Playground
Views: 27,010
Rating: undefined out of 5
Keywords: DIY, IoT, Particle, Photon, wifi, unboxing, demonstration, internet, cloud, arduino, remote, sensor, LED, control, cc, Closed Caption, technical, AVR, microcontroller, microprocessor, analog, digital
Id: 6Y9bD25zxHk
Channel Id: undefined
Length: 12min 40sec (760 seconds)
Published: Thu Mar 03 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.