Jun 30 2017

MicroPython WebREPL on Android

I created an app (apk) to run MicroPython WebREPL on Android. Imagine you have your ESP8266 (with the MicroPython firmware) in some location where the only access to it is via a wireless connection. If you need to access and change/control it, you will need WebREPL.

Of course, a wireless enabled laptop would get access to WebREPL if you have it installed locally. However, if you are connected to the ESP8266, you might not have internet access to remotely load the WebREPL code.

Alternatively, an Android phone provides the ultimate in portability but has no file system (per se) to store and load the WebREPL code from a browser like the laptop would. You probably could load the WebREPL code in a browser while connected to the internet, then switch over the WiFi to the ESP8266. However, I prefer an app.

So, to make WebREPL available thru an app on Android, I used Apache Cordova to create it. This is a ‘screen shot’ of how it appears on the phone:

MicroPython WebREPL on AndroidIf you are interested in the complete Apache Cordova project code to access the MicroPython WebREPL on Android, download it from HERE. If you are only interested in the apk (app) file, download it from HERE.

The current version of WebREPL uses a no longer supported version of an xterm emulator called term.js  found HERE. While that version works on a PC browser and a browser (like Firefox) in Android, it does not work right inside of an Android app. The keyboard does not function right. So I replaced it with its predecessor called xterm.js found HERE.

If you are interested in the steps I took to create the app, here is what I did:

Those commands will create the basic code for an app. Next, I download and unziped the code from webrepl and xterm.js.

Next, I customized the config.xml to add the MicroPython icon by adding this line:

Then I download the png graphic and  put it in the micropython directory with the name MicroPython.png.

Next, I went to the micropython/www directory and removed everything there. Then I copied over to it these files from where I unzipped the webrepl code:

I renamed webrepl.html to index.html. Next,  I copied over to it (micropython/www) all of the files and directories in the dist directory of the unzipped xterm.js. Then, index.html needed to be changed a bit to use xterm.js vs term.js.

Finally, I built the apk with the command:

and installed it in the phone. After connecting the Android phone wirelessly to the ESP8266 to get an IP address, the MicroPython WebREPL on Android apk is ready to run!


Skip to comment form

    • Hab on September 26, 2017 at 9:16 am
    • Reply

    You rock

    • Urban on February 25, 2018 at 4:15 am
    • Reply

    Great App, thanks! It works perfectly with my ESP 8266 12F in station mode. However, when I download a file, althou it seems to get the file, I cant find it on the phones file system. Is there a way to set up where the files are saved?

      • earl on February 26, 2018 at 6:55 am
      • Reply

      Hi Urban,

      Take a look at https://github.com/micropython/webrepl where webrepl is documented. It seems that file transfer is ‘problematic’ on the ESP8266 using the webrepl html client. There is a script called webrepl_cli.py which is suppose to be used instead (from a PC). Download webrepl_cli.py and websocket_helper.py from the github link (to your PC) and then run webrepl_cli.py and it will list its syntax.


    • Danijel on March 4, 2018 at 11:58 am
    • Reply

    Thank you for this project, it is super helpful 🙂

    • Cytao on March 9, 2018 at 11:45 pm
    • Reply

    You did a good job!

    • Roops on March 17, 2018 at 5:46 pm
    • Reply

    What am I doing wrong? I click on your link to download the apk and it briefly jumps to another page and returns me back here without downloading. Is the link broken??

      • earl on March 18, 2018 at 4:43 pm
      • Reply

      Hi! Here is the link:


      It is the same one in the post. It works. It is not broken. You might try with a different browser and/or make sure that it accepts the file type of .apk

      Is something in your system prohibiting that type of download?


Leave a Reply

Your email address will not be published.