The ESP32 comes with arduino-based firmware from the beginning. Change the firmware so that you can write this in Python.
MicroPython reference https://micropython-docs-ja.readthedocs.io/ja/latest/esp32/tutorial/intro.html#powering-the-board
Preparation for inserting micropython.
pip install esptool
On the reference page esptool.py --port /dev/ttyUSB0 erase_flash The command was written, but an error occurred here. For Windows, the port name is different. When I looked at the port connecting the ESP32 from the device manager, it was COM5, so I tried to pass it here. I was confused because the way to specify the port number is different from Linux / mac.
esptool.py --port COM5 erase_flash
This is also the original command
esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin
There was a description. If you go to see the firmware of Micropython's ESP32, there are various things. I downloaded the latest version at the top of GENERIC's non-unstable stuff. (What is written as esp32-idf3-20191220-v1.12.bin) https://micropython.org/download/esp32/
Move to the download folder at the command prompt.
cd Download
Insert the downloaded firmware.
esptool.py --chip esp32 --port COM5 write_flash -z 0x1000 esp32-idf3-20191220-v1.12.bin
(Rewrite port to the current port and 0X1000 or later to the downloaded firmware.)
---- If you just get out and stop at connecting, press the BOOT button on the ESP32 main unit to proceed with the installation.
You have now installed MicroPython.
I referred to this for the transfer of the Python source code. https://qiita.com/moomooya/items/ea30fe1113b21ebc9329#ソースコードの転送
How to get started with MicroPython on the ESP32 https://micropython-docs-ja.readthedocs.io/ja/latest/esp32/tutorial/intro.html#powering-the-board
A guidebook for doing IoT with MicroPython easily to the last minute https://qiita.com/moomooya/items/ea30fe1113b21ebc9329
Recommended Posts