Resources
What & Link | Type |
---|---|
ESP8266 Community Wiki | Wiki / Reference |
ElectroDragon ESP Wikis | Wiki / Reference |
ESP8266 Community Forums | Forums |
Espressif Github | Github Repos |
Espressif ESP32 ESP-IDF Programming Guide - Source Code: github |
Reference |
Mono Software: IoT with ESP8266 - Part 1: Basics - Good intro to basics & options |
Intro Guide |
tttapa: Beginner's Guide to the ESP8266 - Github source - Example sketches |
Guide |
ESP Board Pinouts
Flashing via USB
This is a great guide on flashing a ESP8266. The key things are:
- 3.3v power supply
- 3.3v RX and TX (either buy a programmer that supports it, or use voltage dividers)
- Pull-up and pull-down specific pins, to set in "flash" mode
Hint: If you are getting gibberish on terminal after flashing new code, make sure you change the "flash" pin so that the device is out of flash mode, and restart. For example, for the ESP8266, you keep GPIO-0 (pin 4, flash) low for flash mode, but after you flash, you need to pull it up to high, to enter normal operation mode.
ESP OTA Updates
One of the major advantages to using a Wifi board over just a standard MCU is the ability to deliver OTA updates, as an alternative to flashing new code over a physical USB connection.
Most ESP guides for OTA recommend using ArduinoOTA, which even comes as a built-in example sketch with the ESP8266 add-on for the Arduino IDE.
You can find full documentation and instructions for the 8266 here. Most of it should also apply to the ESP32.
Few notes:
- Think about where you want to put the OTA handler
- If you want it to constantly listen for updates, you need to call the OTA handler every time, in the main
loop()
- You could use a physical button or switch to put it into a listen loop, to cut down on security risks from OTA udpates
- If you want it to constantly listen for updates, you need to call the OTA handler every time, in the main
- You need to pay attention to chip memory (aka flash storage)
- Since an OTA update requires the board to temporarily store the new binary, as well as the existing running code, you need to have memory equal to 2x the sketch size.
- The OTA library itself will add a lot to your sketch size
- Based on rough estimate, a sketch with nothing but the library works out to about 235 kB
- On an older ESP8266 (v ESP01) with 512 kB of flash, this might mean that only 21 kB of storage is left for new code --> (512 - (235 * 2)) / 2 = 21.
- Newer boards have more memory, which is good, since this is basically unusable with 512 kB.
- You can also manually solder on new flash
You could also use a platform for ESP that supports OTA updates natively, such as Blynk or Espruino.
Support for Other Languages and Platforms
Aside from using Arduino / C++ code, you can also get other platforms to run on many ESP boards. For example:
- Espruino - JavaScript interpreter on microcontrollers. Offers Web IDE, support for (some) modules, and more.
- MicroPython - Python
- NodeMCU - Lua
- Blynk - More of a SaaS platform that allows you to control IoT devices from your phone, and design programs to run using an easy GUI (with "widgets"). You flash a simple Blynk setup script to the board, and after that point, you can control it from the Blynk app that you design on your phone.
- low.js - Node.js / JS for ESP32
- ... and more.