Conservancy, we love free software!

ESP32 Setup (Advanced!)

These notes are for advanced users who want to work with MicroBlocks on ESP32 boards and are comfortable with the extra technical challenges involved.

The ESP32

The ESP32 is a module from Espressif Systems that combines a 32-bit dual-core processor with WiFi and Bluetooth functionality. Boards based on this module are available for around $11 on Amazon. OddWires makes a nice ESP32 board along with a family of add-on boards called the IoT-Bus Io.

Installing and using MicroBlocks on ESP32 boards is more complex than other boards such as the BBC micro:bit, so the ESP32 is not yet recommended for beginners.

ESP32 Setup

1. Install esptool.py

To install MicroBlocks on an ESP32 board, you'll use a Python program called esptool.py. Different platforms use different commands to install Python programs. For Mac OS you can do the following:

sudo pip install esptool

Windows users could also try Flash Download Tool (ESP8266 & ESP32) available here, although the MicroBlocks team has not tested it.

2. Setup your ESP32 (first time only)

A new ESP32 needs to have three firmware files installed in Flash memory before it will boot: some hardware settings, the second stage bootloader (the primary one is in ROM), and a Flash memory partition table. You can download those three files from here.

Plug in your ESP32 board and run the following commands:

esptool.py erase_flash
esptool.py write_flash 0xe00 boot_app0.bin
esptool.py write_flash 0x1000 bootloader_dio_80m.bin
esptool.py write_flash 0x8000 partitions.bin

Note: Some ESP32 boards require that you hold down a button in order install firmware. Check the documentation for your board.

These files are fixed for a given ESP32 device, so once they've been installed you will usually not need to do this step again. You might need to reinstall the files if your Flash memory gets corrupted or, in some cases, if you program your board with another programming system (for example, one that uses an incompatible Flash partitioning).

Further details about what these files are used for can be found here.

3. Download the MicroBlocks virtual machine for the ESP32

To download the latest version, go to here and click the "View raw" link. In most browsers, that will actually download, not view, the file. The file vm.ino.esp32.bin will be downloaded.

4. Install MicroBlocks on your ESP32

Plug in your ESP32 board and run:

esptool.py write_flash 0x10000 vm.ino.esp32.bin

It should find the correct serial port automatically. You'll see a bunch of stuff print in the terminal as the install happens. The entire process takes 40-45 seconds.

Note: Some ESP32 boards require that you hold down a button in order install firmware. Check the documentation for your board.

4. Connect

Start MicroBlocks, click the "Connect" button, and select the serial port. The indicator should turn green.

To verify that everything is working, try the following:

SetUserLEDBlock.png

The user LED on your board should light up, showing that the board is connected. You're ready to code!