How we got to here. A brief history.

A project log for Android Circuit Python Editor

Use a USB OTG cable with Android devices for Serial, REPL, and a basic code editor for use withCircuit Python Boards.

foamyguyfoamyguy 12/09/2018 at 04:040 Comments

For a project at work I recently deployed a few hundred Circuit Python boards that were embedded as one component within a larger system.

As part of planning for this we thought about the question: "What if we find a problem with the python code after the boards are already deployed?" We started looking into ways to update the code on the board. Our system includes an Android device that the Circuit Python board is plugged in to. For a while we assumed USB Storage would work, but once we got around to testing it out we realized that it didn't. As those pesky real-world projects tend to this one came with a tight deadline, so we had to drop it and move on to other things to get that project completed. 

Once we got everything shipped out and things slowed down a bit I got to tinkering with the Circuit Python boards a bit more. I played around with the serial connection and REPL a bit and starting thinking maybe this was a better avenue to interact with the board on Android.

The first real world test was USB Terminal program from the Play Store. I loaded it up and was able to see print() outputs from a Circuit Playground Express. Next up was testing the CTRL keys, which is no trivial task on a mobile phone. It turns out there are also keyboards that include CTRL keys on the Play Store so I got one of those installed/enabled/set as my keyboard. Sure enough sending CTRL-D and CTRL-C worked correctly when I sent them via the terminal program using the special keyboard. As the final proof of concept test I used the terminal program to enter the REPL and save hello world to After a quick detour figuring out the storage mounting it was working perfectly. At this point I knew what I wanted to do was possible I just needed to bring it all together into my own app. The idea gets shelved for a bit here waiting to get pulled out again next time we have a bunch of boards getting shipped out.

Around the holidays though I got to thinking about using this idea for something outside of the work deployment. I was looking for a way to bring Circuit Playground boards with me to family gatherings and show them to the kids and teach them about the board and how to make it do neat things. I could bring a laptop but then I've got to lug that around and get it out plus pack it away after, I didn't want the hassle. I could use a battery pack, but then I can't really show the code or change it to do much different stuff especially things that the person being shown suggests. So the thought is maybe I can use the USB Serial idea from before but make the app into more of a basic IDE that can edit and run code and use the REPL. 

I did not quite get it working in time, but there are more holidays right around the corner so I'll be ready for those. Plus I can use my phone to reprogram the Circuit Playground ornament hanging on the Christmas tree.