Automatic WebREPL / WebSocket network scanner

MicroPython has this great feature: WebREPL. It uses WebSockets to allow interactive Python shell sessions to the device running MicroPython, and also allows files to be uploaded and downloaded – all over the network, so we can easily program, debug and interact with ESP32, ESP8266 and other MicroPython enabled boards over Wifi! CircuitPython still does not have WebREPL, but I am looking forward to it (!

However, sometimes is hard to discover which IP is assigned to a specific board, especially if the board is connected to a USB power bank or a power supply and has no display/interface to show the IP. Sometimes I use the the Wifi Access Point configuration page to see the DHCP client list and try to guess which one is leased to the board I am working with.

In that way, we decided to add a “WebREPL device scanner” feature on BIPES. You can use this feature to discover/identify all IP addresses associated with WebREPL ports using WebSocket (on port 8266). The feature is presented as a button next to the Connect button and opens a new page. It is useful even if you don’t use BIPES, but need to find the IP address of a board on the same network your computer is.

On the “Scan Board” page, select your network prefix and click “Start Scan”. A JavaScript will try to connect to all IPs in that subnet and handle connection errors/successes, showing boards found and ready to connect. The “Select” button will close the scanner page and fill the Address input box of BIPES Console tab with the selected board URL.

It is a quick and simple solution, which can save time and make activities more practical. Hope it helps you!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s