WebREPL Set Up for Micropython

WebREPL allows programming Micropython, modifying, adding and deleting files using your home network without having to disconnect from the internet. Your device doesn't even have to be physically connected to a PC , the option to use the normal usb com port still remains.
WebREPL is an option built into the Thonny IDE and the following instructional steps were written while using Thonny and a variety of ESP32 modules. It's obviously not as fast to use as a usb com port but I think it works well and you don't even have to be in the same room as the device..

1./ Using Thonny and your device connected via usb save the following code to the device as boot.py. Rename SSID and PASSWORD to suit your network

import network
import time
import webrepl

def wifi_connect():
    wlan = network.WLAN(network.STA_IF)
    wlan.active(True)
    wlan.connect(SSID, PASSWORD)
    while not wlan.isconnected():
        time.sleep_ms(100)
    import webrepl_setup
    
wifi_connect()

webrepl.start()

2./ In the Shell type "import boot"
3./ The resulting output should ask whether you want to enable webrepl on boot.
4./ Type E and press enter.
5./ It then asks for a password followed by confirmation, enter and confirm your password.
6./ After that you should be back at the prompt in the Shell ">>>"
7./ Now comment out the line of code "import webrepl_setup" and save the modified code to your device as boot.py.
8./ In the Shell type "import boot"
9./ This time you should get the following message in the Shell, your URL details will probably be different.

WebREPL server started on http://192.168.1.215:8266/
Started webrepl in normal mode

10./ Finally goto "Tools - Options - Intepreter and change the port to WebREPL , and enter the url from the previous step eg. ws://192.168.1.215:8266/ , then the password. When you click "OK" the Shell should say WebREPL connected and the files on the device should be refreshed in the file view pane of Thonny, this takes a few seconds so be patient.

Boards tried and tested successfully

ESP32 Devkit V1
ESP32 S2 DevkitC
Nano ESP32 S3
Lilygo T display with ESP32 S3
Rasberry Pi Pico W (RP2040)

Guys I would love some feedback positive or negative on this instructional, I did have a failure on a Seeed Studio ESP C3 and I have not tried all of the Nano's the Giga or Portenta.

Even if it's not for you long term maybe you could give it a try, any comments would be great .

I did a quick test on a Raspberry Pi PicoW and it worked. It didn’t seem any faster or better than RVNC into a Raspberry Pi 4 running Thonny and hosting the PicoW though so I won’t be changing probably.

1 Like

@EmilyJane thanks, my objective is to give anyone that is inclined the option to "wifi" into their board in the easiest way possible and also give a list of known devices that work with this method so your comment is 5 stars.

I think you’re objective is good and I’m just used to doing it over VNC because when I started programming Picos in MicroPython there wasn’t a W version so WebRepl wasn’t an option.