The aim of this project is to finally hack the smartphone. Smartphones are powerful, efficient, and highly integrated devices that can add tremendous value to an electronics prototype. Think of starting with a raspberry pi zero, $100 and lots of time later, you finally have your storage, TFT display, hardware inputs, power management, and cloud integration. But all of that is already integrated into the modern smartphone, so why can’t we just use them? Outdated smartphones are becoming faster and faster and are approaching a point where consumers are throwing out powerful computing devices; reusing smartphones opens up doors for AI data processing as hardware trends also point in that direction. Software is not lagging behind with simple python tools being developed such as tensorflow. With this combination of technology, we can bring advanced computational power to beginners and make hardware more financially accessible. Also this article explains the pain point we are solving: hackaday.com/2018/10/18/ask-hackaday-why-arent-we-hacking-cellphones/
What it does
In its current stage, the project provides the user with a functioning python IDE where scripts can be written for chaquopy. Python scripts act as stand-in functions for Java, so data processing still has to be handled with Java. On the hardware side, commands can be sent by Android to read a GPIO state and toggle another GPIO. This data can be piped to python and processed with full python capabilities, including pip.
How I built it
The only way to access hardware using android (without root) is through the USB-OTG. We decided to utilize the usb-serial-for-android because of its ability to interact with FTDI and Atmega devices. Firmware was written on the Arduino hardware using the Arduino IDE to relay GPIO data when commanded to through UART. The usb-serial-for-android library then processes and handles UART which we relay to the charquopy library where the user has access to 2 GPIOs for demonstration purposes. The IDE was built in Visual-Studio using C# and runs android sdk command line tools for building the code. Hardware was designed in Altium using open-source schematics for the FT232RL and the Atmega32u4.
Challenges I ran into
We initially tried creating the platform using BeeWare and the blinka python library. This did not work out because it relied on the libusb driver which required root to install (which may hinder beginner users); from this, we decided to pivot to Chaquopy. None of us were familiar with Android Development so we were figuring out the language as we were figuring out the code; this limited development to proof-of-concept rather than full functionality.
Also no time to write, but UART-Java is not functional right now. Adding this last minute.
Accomplishments that I'm proud of
I am proud of all the moments the testing worked. A lot of the coding was executing educated guesses on how certain components worked, so it was especially rewarding to see the physical manifestation of learning when the LEDs blinked or the terminal printed a response. Also, being able to create initial hardware designs in a few hours proves useful for rapid prototyping.
What I learned
A lot about Android Development. More importantly, this project shined light on the issues with software support that one faces with providing hardware expansion for a universal operating system that runs on proprietary hardware. Moving forwards on the project, I will use my knowledge about the USB-OTG drivers to perhaps write custom drivers with custom hardware, perhaps even with an FPGA.
What's next for Android Pi (android_dev_board)
Chaquopy only enables scripting functionality, while still requiring Java plumbing to be established with UART devices. Implement the ability to request/write GPIO states and even forwarding SPI,I2C data. However, we will likely move to different hardware solutions with more control over the firmware as that is the bottleneck of the project. As for the IDE, we see the future development platform as a VS Code extension, this would take advantage of the popular platform that beginners may be familiar with.