Wireless IOT ESP8266-01

For a wireless timelap camera shutter project, I got hold of a few cheap (~2 Euro) ESP8266-01 Internet Of Things (IOT) modules.
They are small (25x12mm) wifi 2.4 GHz ready devices with an integrated TCP/IP stack, a filesystem and an script interpreter for the Lua programming language:

To flash new firmware and to upload Lua scripts, you will need:
1.A serial converter module from USB to 3.3 V serial.
2.A 3.3 V @ 300 mA power supply.
3.Buttons to reset and to enable flash mode.
4.Firmware building via the cloud service.
5.ESP8266 firmware flasher program
6.Lua script uploading program
At Ebay or Aliexpress, the serial converter module from USB to 3.3V serial can be obtained at around 1 €.

The signal level can be selected ( 3.3 V or 5V ) for this version with the CH340G converter chip:

I designed a ESP8266-01 programmer with a LED at GPIO2:

Next step is to obtain the necessary firmware for the actual project. Quite a number of modules are available to build a specific ESP8266 firmware. This is made possible with a “Cloud Build Service” at: http://nodemcu.readthedocs.io/en/master/en/build/ :

Clicking on “cloud build service” provides the option to choose the modules you want for the build.:

I wanted a http socket on top of the built-in tcp/ip stack, so the HTTP module is selected. Further down the web page your email address is needed for the automated build service to inform when the actual build process is finished and the build is ready to download. The build I got from the above module selection is available here: nodemcu-8-modules
The Windows version of the ESP8266 firmware flasher program is available from Github.com: ESP8266 firmware flasher . Connect power and the serial converter module to the ESP8266. Serial converter TXD goes to RX of the ESP8266 and serial converter RXD goes to TX of the ESP8266. Keep the Flash button pressed and press Reset button once. Release the Flash button. Select the binary build file in the Config tab and start the firmware flashing process:

To upload Lua scripts to the ESP8266 module, I prefer the Esplorer program available from http://esp8266.ru/esplorer/ :

The Lua script is loaded into the left panel, and can be transferred for testing via the selected COM-port. The right panel shows the result of the script. At https://github.com/nodemcu/nodemcufirmware/tree/master/lua_examples you will find Lua script examples for the ESP8266. My version of the http serverside script to toggle the LED at GPIO2 is available here: server_LED-blink_template
The first line: wifi.setmode(wifi.STATION) defines the wifi mode to STATION. The second line: wifi.sta.config(“your-ap-ssid”, “your-ap-password”) defines the ssid and password of the wifi access point
you are going to use. No fixed IP is defined, that is, the access point must provide the IP via DHCP.

Leave a Reply