ESP8266 Hack #1: Web Enabled LED - WiFi Internet-of-Things IoT

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good evening all now this is an LED green LED and a couple of batteries and I've been working on this for about three days continuously and it's taken me that long to get it working and why is it taken so long well it's a rather special LED with batteries it's a web-enabled LED with batteries this is the esp8266 wireless interface module but it's much more than that it's a micro controller and wireless interface module and it's now running a web server which can receive instructions from the internet to turn this LED on and off and if I felt like putting a an entry into my Reuter you could turn this LED on and off from wherever you're watching this video I haven't done that so that's not possible but it is in theory so without further ado let's see this thing actually working you can see I've balanced my little web-enabled LED on top of a bottle of water and I've opened a brand new webpage just Google at the moment but I'm going to dial in or type in the IP address of this little module and if I type just one it will remember the rest it's 192.168.1.1 to nine now that's a LAN address if I go to that page the web server on this little chip has served up a web page and it says hello YouTube and given me a selection of either on or off to turn this LED on or off now it's currently on so if I click off the green LED goes off and the URL at the top here changes to the status pin equals off okay let's turn the LED back on so I will select on the green LED comes on and the status has changed to pin equals on now this is pretty impressive stuff because as you can see I'm holding this thing now this is completely standalone module battery powered wireless enabled so it's not connected to anything and yet I can go onto a browser web page essentially on the Internet click off and turn that little green LED off click on sometimes it is a little bit badly behaved there's still an X up there so it's still trying to find this thing okay I admit it is a little bit flaky at times so I've put it back on the water bottle it does seem to be a bit happier in that position I have to say that the router there are turned on and to try it off the root of the wireless access point is not that far away it's only about a meter and a half above this desk and if I take this little module to other places in the house it's a bit hit-and-miss and the other thing is it doesn't seem to work if I use the browser on my tablet but I say that maybe this time it is going to work let's try off now it's saying this webpage is not available so it doesn't work on my tablet it does work on my desktop machine which is yd thern ette so as I say it's not entirely a hundred percent reliable now you'll notice that this device doesn't have an arduino connected to it rather refreshing really that's because it doesn't need an arduino this chip is both a wireless transceiver and a microcontroller and it doesn't make a whole lot of sense to connect another microcontroller to this microcontroller for all a couple of reasons really this module is so cheap about 2 pounds that if we connect an arduino to it we've doubled the cost arduino pro mini tsar around 2 pounds so that brings the price up to 4 pounds there's no point we might as well run our code in this microcontroller and the other thing is that if you have two microcontrollers talking to each other over the relatively slow serial interface well it's a bit like computers communicating through to baked bean cans and a piece of string so the holy grail for the esp8266 community has been to try and run code on this microcontroller one of the things you need to do is to put new firmware onto this module so i'm going to have to wind the clock back a bit now and actually put the old firmware back now no one in their right mind would attempt to install firmware over Wi-Fi so I've taken one of the batteries out of this battery holder and I've connected up a serial interface cable to VCC ground transmit and receive and I'll give you all the connections for this shortly and I've hooked it up to one of these serial 2 USB converters this one uses the CH 340 and I'm going to plug this into a USB port on my PC one of the reasons it took me three days to get this to work is because the information you need isn't all in one place there are bits here there and everywhere but this isn't a bad place to start it's import hack and I'll provide a link to this blog you can see here there's a wiring diagram now let's just go through it VCC is up here on the top right you also need to link it to this pin CH underscore PD now I did this through a 10k resistor just to pull this up ground is here bottom left but when you're flashing firmware and that's what I'm about to do you also need to link that through to this pin which is GPIO zero they've marked it there now I put a two pin terminal header there so I can connect a link pin and then take it off again whenever I want then the other connections are here this is our X but it's our X on this module so you connect it through to TX on your FTDI or CH 340 usb-to-serial and conversely this is TX on the module down here connects through to our X on your usb-to-serial now in addition to that I've put a capacitor on here it's a 10 to them it's not a particularly big one I've strung it across VCC and ground and I've also put my LED between ground and this pin immediately above it which is GPIO 2 now further down this article it says download the esp8266 flasher this is the firmware uploader or downloader we don't need to worry too much about this they do give the link because I'm only going to use this to go backwards to put the old firmware in I'm actually going to use a different flasher to go forwards again and put the firmware in which I'm using to run the webserver so here's the esp8266 flash downloader now we have to select a binary file to download so I'll click this now with the flash downloader you get this older version of the expressive original binary firmware so I'm going to select that and open now I also have to change the comport it defaults to com1 my serial to USB adapter this thing here I happen to know is on comm five so let's change that to comm five and now there's something very important you have to do before you press download and that is that you have to fit well in my case a link because I've put those two terminal pins between GPIO zero and ground by linking those two pins together and rebooting the module it goes into firmware upload or download mode whichever wanted it so I'm just going to fit that link now so there's the link fitted now if I take power off the module and put it back on the module will be in firmware upload mode so I'm just going to disconnect my USB to take power off the module reconnect it now I'm ready to hit download so let's do that it says erasing flash now it starts writing and you can see blue light is flashing on the esp8266 module it's writing blocks of code it acts as a progress bar it is quite useful to see this happening because you know that something is working and you can see the percentage they're climbing up so when that gets to 100% we're done however there is one little gotcha and it gets to the end it says leaving and if I scroll the scroll bar down it says fail to leave flash mode don't worry about that it doesn't appear to matter let's remove the link so in no longer in firmware upload mode and now I can close the 8 to 6 6 flasher now the next thing that the import hack article tells you to do is to download cool term which I have done but we're only going to use it very briefly to check that the original firmware is back in this module I've set call term to calm 5 I've set it this time to a board rate of 115 200 because the early versions of firmware and that's what I've put back in here were this board rate not 9600 so let's see whether we get any response from the module yes it says error if I type 80 it says okay and I can go on and list access points and so on and make sure that this thing is working but I won't do that just for the moment now I've put in some more of these 80 commands 80 CW mode equals 3 to set this to I think it's both station and access point and then an 80 plus C WLAP and that makes it list all the access points that it can see get HQ and repeat me are both my access points so it proves that this is actually working the Wi-Fi part of it is working and this shows because these 80 commands that it's now running the original firmware that these modules are supplied with now those steps using the ESP flasher and cool term have been simply to return this module back to its original state containing the expressive original firmware where you use the 80 commands to get it to do things now I'm going to move forward again and turn this back into that web-enabled EDD but using a completely different set of steps and we're going to come across something called node MCU and also a programming language called Lua and the Lua uploader see all that in part 2
Info
Channel: Julian Ilett
Views: 306,954
Rating: undefined out of 5
Keywords: Espressif, ESP8266, Internet of Things, Web Server, LED, USB to Serial, IoT
Id: VvIoBFLj2Xo
Channel Id: undefined
Length: 12min 19sec (739 seconds)
Published: Fri Jan 16 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.