Recently there was a PR merged into CircuitPython that allows for the mounting of a CIRCUITPY drive on an Android device. Previously this was not possible, so I wanted to try it out. For my testing, I used a Samsung Galaxy A13 phone running Android version 13. The board I used was a Circuit Playground Express running CircuitPython 9.0.0-alpha.4.
After plugging the CPX into my phone, I was able to see the drive in both Google Files and Android Files apps. In Google, it shows up as CIRCUITPY Drive and in Android it shows up as USB storage 1.
I tried a few text editor apps for opening and saving the code.py file. My favorites were Acode (Google Play Store), Jota+ (Google Play Store) and Editor (FDroid Store). All three were easy to navigate, had minimal to zero ads and were able to successfully save an update to the code.py file.
There is one caveat though: you'll want to open code.py thru your chosen text editor app, rather than opening the code.py file in a Files app and choosing an app to open it with. In my testing, when I chose the latter, I received a security error when trying to save, which was very frustrating.
So, you'll want to follow these steps when editing and updating code.py:
- Open your text editor app
- Select Open... from your text editor menu and navigate to your CIRCUITPY drive and select the code.py file
- Make your edits and save
I'll also note that it takes a little longer than you may be used to for the file to save and then reload on your device compared to using a desktop computer.
I asked our resident Android expert FoamyGuy for some advice on where to start to access the REPL. He suggested the Serial USB Terminal app (Google Play Store). The key feature for CircuitPython that this app has is the ability to create macros. With macros, you can setup CTRL+C and CTRL+D shortcuts that otherwise are impossible to do with the default Android keyboard.
To create the macros, you'll long press on the macro button. Select HEX as the edit mode and value 03 for CTRL+C. On a second macro, follow the same procedure and value 04 for CTRL+D.
To connect to your CIRCUITPY device, you'll press the serial cable icon at the top of the screen. You'll be asked to allow access to the CIRCUITPY device and you'll see "Connected to CDC device" appear in the terminal. You can press the CTRL+C macro to enter the REPL and interact with it as you would on your desktop computer.