Contributors

Access WebREPL

Enable WebREPL

The first step to using the WebREPL is to make sure it is available and enabled on your ESP8266 board. As of the latest 1.8.6 MicroPython releases the WebREPL is notenabled by default and must be switched on with a one time command run through the serial port. Make sure you're using MicroPython 1.8.6 or higher to follow the below instructions.

You will be prompted to enable or disable the WebREPL, and to set a password. Enter your choices for both prompts then press y when prompted to save and reboot.

Access WebREPL

Once the WebREPL is running you can connect to it over the ESP8266's WiFi radio. If the board isn't connected already to a wireless access point then it will create one which you can connect to from your computer.

To connect to the board's WiFi network look for a WiFi network advertised as MicroPython-*:

Where the * is the a set of numbers and letters unique to each ESP8266 board (based on its MAC address).

You will need to enter the password micropythoN to connect to the board's access point (the N is capitalized!). If you have trouble see more details on connecting to the board's WiFi network in the official documentation.

If you download the WebREPL client extract the files and open webrepl.html in your browser (Firefox and Chrome are the officially supported browsers at this time).

Note you can't access the WebREPL client page directly from the ESP8266 board. To save space in flash memory the ESP8266 only provides a websocket interface and not the actual client webpage. You'll need to download the WebREPL client page ahead of time or access it from the internet.

Once the WebREPL client page is loaded you should see something like the following (as of ~August 2016, be aware the WebREPL is under active development and might change how it looks over time!):

Now make sure your computer is connected to the ESP8266's WiFi network, then click the Connect button (using the default address of ws://192.168.4.1:8266/ next to the button).

Once connected the WebREPL should prompt you to enter the password you set while running the webrepl_setup command earlier. Enter the password that you set to continue.

Try entering Python code at the REPL to see the output of it running. The WebREPL should function just like the serial REPL so you can use it to experiment with MicroPython, run code you've loaded on the board, and more:

That's all there is to accessing the WebREPL from the ESP8266's WiFi network!

Access WebREPL From Other WiFi Networks

Accessing the WebREPL over the ESP8266's own WiFi access point like above is handy if there's no router or other WiFi network available. However if you do have access to a WiFi network you can instead connect the ESP8266 to this network and access the WebREPL from any other machine on the network. This makes it easier to use the WebREPL without losing access to the internet or your own WiFi network on a laptop that can only be connected to one WiFi network at a time.

To use the WebREPL on another WiFi network you'll first need to connect the ESP8266 to the WiFi network. The MicroPython ESP8266 documentation shows a few simple commands to connect to a network. From the serial REPL (don't use the WebREPL since you'll lose access when the commands change to a different WiFi network!) run the following commands:

Notice the first result from the ifconfig call is the IP address assigned to the ESP8266 (192.168.1.207 in this example, but it will differ depending on your WiFi network). If you don't see an IP address then something is wrong with the WiFi configuration or connection to the network. Double check the SSID and password are correct and try the connect call again.

One important thing to note is that the ESP8266 will always remember the last WiFi network it used and attempt to connect automatically on reboot. This is handy since it means when the ESP8266 boots up it will automatically connect to the last network without you having to run the commands above again. The board will only remember the last network though and not an entire history of older networks.

Once the board is connected to the WiFi network enable the WebREPL (as described in the previous section) and notice it prints two IP addresses that it's listening on:

In this case the WebREPL is listening on 192.168.4.1 which is the ESP8266's access point, and 192.168.1.207 which is the IP address of the ESP8266 on a WiFi network.

Now open the WebREPL and use the IP address of the board on your network instead of the 192.168.4.1 default:

Once connected you can use the WebREPL just as you were using it on the ESP8266's WiFi network!

Note if you're connecting the board to a WiFi network it is a very smart idea to disable debug output since connecting and disconnecting WiFi network and can spew debug output to the serial REPL. If the board can't connect to the WiFi network, like if you move it to a different location away from the network, you'll see a constant stream of debug output as the board tries and fails to reconnect to the network. This debug output can cause problems with tools like ampy that try to use the board's serial REPL and don't expect the debug output.

OUT OF STOCK NOTIFICATION

YOUR NAME

YOUR EMAIL

You have been successfully subscribed to the Notification List for this product and will therefore receive an e-mail from us when it is back in stock!

For security reasons, an e-mail has been sent to you acknowledging your subscription. Please remember that this subscription will not result in you receiving any e-mail from us about anything other than the restocking of this item.

If, for any reason, you would like to unsubscribe from the Notification List for this product you will find details of how to do so in the e-mail that has just been sent to you!