ESP8266 – Part I – Initial Setup and Configuration

THIS POST HAS BEEN UPDATED – SEE BELOW.

I was recently sent a NodeMCU ESP8266 by some rando on the Internet. According to Wikipedia “the ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability.” It’s basically an Arduino with WiFi. And they are like $7 online. I ordered a few more off Amazon once I got the first one working. These were the ones I ordered:

https://www.amazon.com/HiLetgo-Internet-Development-Wireless-Micropython/dp/B010N1SPRK

There are a bunch of different hardware versions so just be careful which one you are getting.

The same friend rando that sent me the board suggested I start with something called “Sonoff-Tasmota” which the Github page describes in the following manner:

Alternative firmware for ESP8266 based devices like iTead Sonoff with web UI, rules and timers, OTA updates, custom device templates and sensor support. Allows control over MQTTHTTPSerial and KNX for integrations with smart home systems. Written for Arduino IDE and PlatformIO.

Here are some super quick instructions to get you started (also courtesy of the same friend rando):

DO THIS AT YOUR OWN RISK. IF YOU DON’T UNDERSTAND WHAT’S HAPPENING, STOP AND LOOK IT UP.

  • Install Python on computer
  • Run “Pip install esptool”
  • Download “sonoff.bin” in esptool directory
  • Put NodeMCU into “flash mode” by holding down flash button while plugging
    into your computer via USB
  • Run this command:
    • esptool.py.exe –port COM5 write_flash -fm dio 0x00000 sonoff.bin
  • Restart the NodeMCU by unplugging and replugging
  • Use something like Putty to serial into the device on Com5 using buad rate 115200. This will tell you the IP address
  • When the device reboots it will create a Wifi access points which you can connect to, then browse to the IP address you learned in the previous step. It takes you to a page where you can give it the SSID and password to connect it to your actual network.

FUN NOTE: Both your SSID and password will be sent to the NodeMCU in cleartext, for any one sniffing all the unencrypted Wifi in the area.

Okay, so originally I was configuring these over unsecured Wifi, but I found a better way to get it on your network:

  • After you flash the device, restart by unplugging and replugging
  • Connect via serial (I used the Arduino IDE) with the correct COM port and set the BUAD rate to 115200.
  • Enter in the following command through the serial interface:
    • “Backlog ssid1 YOURSSIDHERE; password1 YOURSSIDPASSWORDHERE;”
  • The device will then restart and connect to your network. It will also show you it’s IP address on your network.

You should now have a functioning NodeMCU running Tasmoto-Sonoff. In the next post I will show you how to set up a temperature/humidity sensor.

If at any time you need to erase the NodeMCU so you can reflash it you can use this command:

esptool.py --port COM5 erase_flash
This entry was posted in ESP, Home Automation and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *