Installing MicroPython on a ESP-32

STUFF FROM THE PYCON TEAM:

An excellent reference is the official MicroPython one here.

Install CP210x drivers Find out COM port (in this case COM3) https://www.mathworks.com/help/supportpkg/arduinoio/ug/find-arduino-port-on-windows-mac-and-linux.html esptool.py –chip esp32 –port COM3 erase_flash wget http://micropython.org/resources/firmware/esp32-20180511-v1.9.4.bin Note that this is now an old firmware esptool.py –chip esp32 –port COM3 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin Putty over serial to COM3 with baud rate 115200 import webrepl_setup On flash, the AP mode was not enabled import network sta_if = network.WLAN(network.STA_IF) sta_if.active(True) sta_if.connect(‘Brave-Fiber-Ruckus’, ‘braveGl0bal’) Leave putty open, or else all this will be undone Load up a webrepl - Hosted - or self-hosted Connect via WebREPL Download boot.py from the device and update it with the following lines:

import webrepl import network

webrepl.start() sta_if = network.WLAN(network.STA_IF) if not sta_if.isconnected(): print(‘connecting to network…’) sta_if.active(True) # Note that your WiFi details will be different sta_if.connect(‘WiFi SSID’, ‘password’) while not sta_if.isconnected(): pass print(‘network config:‘, sta_if.ifconfig()) Send the updated file back to device.

Now you can close Putty, reboot the device and it will immediately be on the network.

Two image files:

-rw-rw-r– 1 wookie wookie 70128 Dec 12 17:25 esp32-devboard-pinout.jpeg -rw-rw-r– 1 wookie wookie 101697 Dec 12 17:25 esp32-devkit-v1.jpeg

R OSRM
Avatar
Andrew B. Collier
Entrepreneur / Data Scientist

Related