Reusing An Old Android Phone For GPIO With External USB Devices

Each year millions of old smartphones are either tossed as e-waste or are condemned to lie unloved in dusty drawers, despite the hardware in them usually being still perfectly fine. Reusing these little computers for another purpose once the phone’s manufacturer drops support is made hard by a range of hardware and software (driver) issues. One possible way to do so is suggested by [Doctor Volt] in a video where a Samsung Galaxy S4 is combined with a USB-connected FT232R board to add external GPIO.

The idea is pretty simple: the serial adapter is recognized by the existing Android OS and within the standard Android development environment this module can be used. Within this demonstrator it’s merely used to blink some LEDs and react to inputs, but it shows how to reuse one of these phones in a non-destructive manner. Even better is that the phone’s existing sensors and cameras can still be used as normal in this way, too, which opens a whole range of (cheap) DIY projects that can be programmed either in Java/Kotlin or in C or C++ via the Native Development Kit.

The only wrinkle is that while the phone is connected like this, charging is not possible. For the S4 it’s easy to solve as it has a removable battery, so an external power input was wired in with a dummy battery-sized bit of perfboard. With modern phones without removable batteries simultaneous USB/audio dongle and charging usage via the USB-C connector is claimed to be possible, but this is something to check beforehand.

24 thoughts on “Reusing An Old Android Phone For GPIO With External USB Devices

  1. I really wish there were a nice looking, flush wall mount with a bezel for some of these older devices. They would make great HA control panels, and would even have enough processor to run a SLM voice assistant, or at least provide the audio interface for a LLM.

    That was the kind of application I was really hoping for when Samsung announced their now-defunct upcycling program years ago.

    1. i made a (crappy) wall mount for my nexus 7 tablet and used it as an alarmclock for several years until it became too slow to be used as an alarmclock. it would take multiple whole seconds to acknowledge the ‘swipe right’ to turn off the alarm. tens of seconds to access the clock app UI if you wanted to change your alarms. unfathomable.

      then i made a (crappy) wall mount for my moto x and used it as an alarmclock for several more years and its battery ballooned so i replaced it and then the new battery ballooned and obliterated some of the ribbon cables as it did so.

      i’m back to my 1990 sony dream machine. i’m a little discouraged by wall mount android. but i did get years out of those on the wall, in addition to the regular service life of the device.

    1. They are inexpensive on Amazon etc and often advertised for use with fire stick or other streaming devices.
      Definitely works.

      You can also get with Ethernet and POE for even better solutions.

      R

  2. when i needed to do gpio from a phone, i used a pic12 with the world’s simplest demodulator… diode to R / C to NPN. my android app produced uh a binary amplitude-shift keying modulated tone. just like a 1kHz carrier wave that was gated on/off at about 250Hz (4 cycles per bit), or something in that vein. obviously extremely limited but it was sufficient for that hack.

    if i had to do it again, i’d probably use an rp2040 pico with usb otg. really, i still love pic12 but the pile of chips and programmers has experienced some rot. if i’m buying new stuff, it’s hard to jump back into the ICSP struggle — prying a chip out of a socket, fighting against other uses of the programming pins, booting windows to run icprog (???) — when having a USB programming connection is so cheap these days.

    hah i do resent the need to hold down the little button on the pico while plugging it in in order to force it into firmware mode. but man that’s a lot easier than anything that came before in my life!

    1. Hehe, I was about to write something like this too. Some phones don’t have USB OTG, like the iPhones. But specifically the old iPhones with the 30-pin dock connector, have audio in and out on the connector. You could quite easily implement an FSK protocol to talk to peripherals.

      With the new iPhones it’s harder, they don’t have analog in and out anymore, lightning is all digital and you need an Apple-provided chip to authenticate your peripheral, or the iPhone will immediately ban it.

      You could actually still go the ‘acoustic coupler’ way, using a phone’s speaker and microphone. But I guess the screeching sounds would annoy anyone, including yourself, within a few seconds.

      Maybe you could modulate data on top of an audio stream. E.g. use modulated Amiga mod music to transfer data, so you can listen to Amiga mods when controlling your peripheral. ;)

    2. But ok. Realistically? We live in 2024. Just buy an ESP32 for a few dollars and use Bluetooth Serial Port Profile or BLE.

      Or WiFi, why not? Those old phones all support WiFi. You can put your whole app in the ESP32 as a web-based application and use your old phone’s web browser to control your peripheral. As long as you only use basic HTML, any old browser on any old phone is going to work.

      And then you also have the connector free for charging.

  3. My fav use for an old ´droid is Octoprint : just slap in on a 3D printer, and use an OTG cable to the printer with derivated power !

    Since all phones have a touchscreen, camera, Wifi it is quite ideal. Just need a custom 3D printer holder for it.

    You might even want to tap into the 3D printer mainboard power connector to put a simple DC/DC supply with 5V out to power the old Android phone.

    It´s here: https://github.com/feelfreelinux/octo4a

  4. The cameras in these binned phones seem like a gold mine to me. I hate that I purchase big clunky and not very good ip cameras, while that bin of old cell phones on the shelf has amazing tiny cameras in every one. I can convert the entire phone into a pretty good ip camera via an app, but would love to see the an approachable path to extricating those tiny high res cameras for application as ip cameras for use in other places. ( with some form of programmable controller of course)

  5. I reuse my old phones as security cameras with the Alfred Camera app.
    I would also like to do the opposite: use the smartphone as a sensor platform for an Arduino or RPi project.

  6. The problem with cell phones is the proprietary and poorly documented hardware. If you had access to a dozen identical old phones it might be worth the effort but building a whole project around a single 10 year old phone is a fools journey. The best you can do is turn it into a webcam (they can all do that). But you can also use an ESP32-CAM with lower resolution but tons of tutorials and documentation.

  7. “With modern phones without removable batteries simultaneous USB/audio dongle and charging usage via the USB-C connector is claimed to be possible, but this is something to check beforehand.”

    I’m reasonably sure this would work. I have tested plugging a usb c hub into my galaxy s 22 so I can use DeX on an external monitor and have a physical keyboard and mouse and still charge it.

  8. I remember a cheap tablet I got, I wanted a serial terminal to monitor GRBL commands on laser machine, so I opnened and put some wires to the debug serial port, installed an app to mimic the console and I was ready to interface the machine, no adapter needed.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.