Yesterday I saw the recording of the talk from Christine Spindler on the 35c3 about MicroPython [here], which was great by the way. I heard about MicroPython before and had already looked into it.
So, because I have a MicroPython capable board lying on my bench, I will play a little with it.
Get MicroPython running on the ESP32
The board lying on my bench is a ESP32 DOIT v1. So, I need the MicroPython binary for this board. You can find the binaries in the download section of the MicroPython page. Scroll down to ESP32 or click on the ESP32 link on the page. I’m using the latest version which is esp32-20181230-v1.9.4-771-gb33f108cd.bin at this time. For the ESP32 are two firmware versions available. One is the standard firmware (which I use here) and the other has built-in SPI RAM support. So if you are unsure which version you need, take the standard version. The website states that this version will work on any board.
To flash the binary onto the ESP32 board you need the ESPTool. For me the easiest way to install it was with pip. So, if you already have Python installed on your computer, just install it that way. I had to open an command line window under Windows 10 as administrator to install it properly. Then type:
It is recommended by the MicroPython website to erase the flash before flashing the MicroPython code onto the ESP32. My board is detected on serial port COM4. So, I use this command to erase the flash:
Which results in this output:
Now we can flash the MicroPython binary to the microcontroller:
This results in the following output:
And that’s it. You now have MicroPython running on your ESP32. And to check this we connect to the board via serial port. I’m using Putty for that. The default baud rate of the board is 115200.
The installation of MicroPython onto the ESP32 is very easy. But currently I only can write my code via the REPL. So, I have to find a way to send my Python script from my preferred editor to the board. We will see how practical the workflow is after using it a while.