Getting Started (3): Setup ESP8266 Dev Board
For all projects on SimpleIOThings, you’ll need to setup ESP8266 Dev Boards. The dev board is the most important piece of hardware in our projects because they execute computer programs that power our sensors and connect to the internet. In this “Getting Started” tutorial, we’re going to teach the dev board to understand a programming language.
One of the reasons why IoT devices can be built so easily now is because of the ESP8266 development board. IoT enthusiasts have been excited about the ESP8266 because its a full system on a chip (SoC) that has onboard wifi connectivity that can cost as low as 3 dollars. The IoT community has been building with Raspberry Pi and Arduino microcomputers for a while now, and while capable these computers cost up to $35 dollars, don’t have onboard wifi, and aren’t easily powered with common ports like microusb. The standalone ESP8266 chip is great, but doesn’t have an easy to use power supply and it’s hard to configure without special cables.
The ESP8266 development board is a bit bigger and a little more expensive than standalone ESP8266 chips, but its easier to connect to a PC, upload custom software, and it can be powered with a common microusb cable.
Also, the price of the board is generally less than $5 dollars! This means that many simple IOT devices can be built for 10 dollars or less. Here’s a link to the dev board we’ll be using in our projects.
AliExpress.com Product – 2015 New product Wireless module NodeMcu Lua Wifi Nodemcu WIFI Network Development Board Based ESP8266,High quality products
(Note: I can already hear a thousand nerds out there groaning because I’m using the dev board instead of the standalone chip. Remember this page is about building IoT devices easily. This isn’t the cheapest possible way to make a device, but in my opinion its worth it to pay a couple extra dollars for the convenience of a microusb interface and power connection.)
When it arrives in the mail its just a mashup of metal and silicon, but after this tutorial it will understand how to execute commands in a powerful software language called “Lua” (which is in the Python family of computer languages for you nerds out there). Don’t worry though, you won’t be expected to code anything.
You should connect your dev board to your computer’s USB port using your cable like so. If you have windows computer and an internet connection, the drivers for the board should automatically load. If for some reason it doesn’t you can Google “NodeMCU drivers” and a number of websites with appropriate files should show up. The drivers you need may depend on the type of dev board you purchased. If you purchased the CP2102 variant (which is recommended) you will need to download drivers for that board type. Drivers are available online for the CH340 variants as well.
Once your drivers are installed, you’ll also need to determine which communications port the device is connected to. Click your “Start” button and type “Device Manager.” Your device manager should pop up. Click and expand the “Ports (Com & LPT)” menu and you should see your device listed there. In my case, my ESP8266 dev board’s port was set to COM18. For now just take note of that and jot it down somewhere.
Now we have to install “firmware” on to the dev board. This firmware will allow the board to execute programs and understand Lua. To do this we need to download a “flashing” program and the firmware itself. The flashing program will use the firmware file to load firmware onto your board.
The latest versions of the flashing program can be found on github, a popular and trusted site for computer programmers to collaborate on projects. Pick the appropriate flasher based on whether your PC is using a 32-bit or 64-bit operating system.
The firmware file can be found on Github. Follow the link below. As of 1/3/2018, the file version that works best is at the bottom of the release page. It is the “integer” version and it will look something like this: [nodemcu_integer_0.X.X-dev_201XXXXX.bin]. A screenshot is also provided below for reference.
There are also some other interesting places to get firmware for the ESP8266 dev board, including a custom firmware builder, however a number of users have reported trouble with the firmware they get from other sources. For now, I recommend sticking with the Github release.
Okay, if you’ve made it this far, you’ve connected your dev board to your PC, obtained the port number, installed your dev board drivers, and downloaded the ESP8266flasher program and the firmware .bin file. Awesome.
Now find your downloaded ESP8266 flasher program and start it. This should pop up:
Change the port number to the port for your ESP8266 Development Board, which you jotted down earlier.
Now click the Config tab, and click the topmost gear on the right hand side.
Once you click the gear icon, use the dialog box to find your firmware (.bin) file in your downloads folder and click “Open.” Then go back to the “Operation” Tab and click “FLASH!” Once the progress bar moves all the way from left to right, your dev board can now understand the Lua language. Congrats!
The last task in this step is to download a program called LuaLoader and use it to connect with your dev board. LuaLoader is a program that can understand the Lua programs your board is running. It also has a lot of handy tools that let you setup wifi, read digital outputs, and so on. Once again, Github has what we need.
– LuaLoader @ Github
Once you’ve downloaded LuaLoader, extract the zip file (if needed), open Lualoader.exe as an administrator. To open as an administrator, right click Lualoader.exe, and then click “Run as an Administrator.” Once open, click Settings, Com Port Settings, and set the port to the one your dev board is connected to and click “OK.”
Then click “Connect” in the menu bar of the Lualoader program. Your ESP8266 dev board should flash an LED for a second, and your Lualoader will show you some strange characters. Congrats, you now have a dev board that is ready to receive a program.
If you were able to use this tutorial to install firmware onto your dev board and then connect it to your Windows PC, then you’ll be able to upload custom software to it to build several smart buttons and sensors. Congrats! Now take the next step and check out some of the sensor building tutorials.