Using An Old Smartphone In Place Of A Raspberry Pi

The Raspberry Pi was a fairly revolutionary computing device when it came on the scene around a decade ago. Enough processing power to run a full Linux desktop and plenty of GPIO meant almost certain success. In the past year, though, they’ve run into some issues with their chip supplier and it’s been difficult to find new Pis, which has led to some looking for alternatives to these handy devices. [David] was hoping to build a music streaming server and built it on an old smartphone instead of the ubiquitous single-board computer.

Most smartphones are single-board computers though, and at least the Android devices are fully capable of running Linux just like the Pi. The only problem tends to be getting around the carrier or manufacturer restrictions like a locked bootloader or lack of root access. For [David]’s first try getting this to work, he tried to install Navidrome on a Samsung phone but had difficulties with the lack of memory and had to build the software somewhere else and then load it on the phone. It did work, but the stock operating system kept killing the process for consuming too much memory.

Without root access, [David] decided to try LineageOS, a version of Android which, among other benefits, is typically much more configurable than the stock version of Android that is shipped with smartphones. This allowed him to disable or uninstall anything not needed for his music server to free up enough memory. After some issues with transcoding the actual music files he planned on streaming, his music server was successfully up and running on a phone that would have otherwise been relegated to the junk drawer. The specific steps he took to get this working can be found on his GitHub page as well.

[David] also mentioned looking at PostmarketOS for this job which is certainly a viable option for some, but the Linux distribution for phones is only supported on a few devices. Another viable alternative for a project like this if no Raspberry Pis are available might be any of a number of Pine64 devices that might also be sitting around gathering dust, like the versatile Linux-based Pinephone.

62 thoughts on “Using An Old Smartphone In Place Of A Raspberry Pi

  1. It seems like He doesn’t remove the battery of android phone
    so battery might become fat some day, and break back cover or front panel
    If He remove the battery, He need bypass the android battery monitor
    (Some ODM vendor would check battery, if battery low or battery abnormal, then shutdown the phone)
    That’s why I’m not consider using old smart phone act as a server

      1. Not only feed 4v into the phone actually, it might need measure old battery and attach a resistor as a fake thermal resistor (Battery temperature monitor), otherwise the phone would assume battery abnormal, might cause suddenly shutdown

        It is depend on the phone design (depend on ODM manufacture)
        consider lot factor ( battery, storage remain life, storage not replaceable, easy install)
        so I’ll say a SBC would be much better solution than old phone

        1. A lot of android phones have micro SD card slots so the storage is expandable. Also most android phones support USB OTG so you can plug usb sticks or even usb hard drives or usb hubs into them, the storage is no worse than that on a raspberry pi, in fact it is probably better because it uses a more robust storage device than a micro SD card.

          1. Yep, lot android phone support microsd card actually
            maybe I spent less money on my phone , I was always using entry level phone before ( for example, 2GB or 4GB internal storage)
            when the phone retired, I was trying to set the phone as some kind server same as this article
            But I’ve met a issue, the internal storage ran out of life
            because nand flash or eMMC has life issue, when the storage ran out of life, the system would become very unstable, always report something goes wrong
            the solution is replace a new one storage, and you need get a mass production tools
            and mass production firmware, to flash empty storage
            only if the storage work, then it able to flash the 3rd party firmware

            I have not to read any article to demonstrate, install a 3rd party firmware and custom u-boot into a total empty phone yet
            (maybe it is possible to find those resource from china forum, but it still hard to find)
            Also, I have not to see anyone successful to boot their phone from OTG usb disk or external sd card
            (yep, it is possible, but you’ll need the SOC datasheet, or reference manual, or modify hw strip pin, or flash the SOC to modify the boot order)

            so according those concern, I give up this idea anymore
            But sure, if your phone still work, battery work, storage work, just retired, it definitely great to have another purpose, at least better then e-waste :)

        2. WenChih is right, a sense resistor is often needed. Also a good idea to put a 10,000uF electrolytic soldered to the battery contacts, then you can use a shonky 4V power supply.

          I’ve worked on phones and basestations for years and we used to have banks of them powered like this for testing.

          Advantage of the phone over an SBC is you get a free display and touchscreen input! And audio in/out too.

        3. I had an old HTC Evo w/ removable battery. I took the cell out of its case, I was left with a slim pcb with the battery contacts and circuit on it. I simply soldiered a USB to the tabs the cell was connected to and powered up without any issues. Simply put a block of wood in place of the removed cell and reinstalled in the phone. I was making an alarm clock with news,weather and photo gallery. All was incased in a custom folding chassis made from wood.

          1. Wood is an insulator, not a conductor, but I understand what you’re saying regarding heat. A small amount of voltage/current isn’t going to create enough for concern.

    1. No, keep the battery and you have an integrated UPS !

      I don’t know if li-ion batteries are shelf stable, but when the phone battery is full and the phone is plugged, the battery won’t be used at all, except to compensate the auto-discharge.

      Maybe there is a way to limit the max battery percentage and hence preserving even more the battery. Can probably be done as root.

      1. That depends on the phone, USB-PD could be connected to the charging circuit only and then the phone won’t be able to bypass the battery and power itself from the charger. And that seems to be a cheaper way of doing things.

      2. In theory, ideal battery could be a integrated UPS, I agree with that.
        But when I using old phone as surveillance camera ( same as some one said, install alfred camera)
        some day when I trying check the camera, the phone is not online
        and I found that screen totally popping cause battery swelling
        I would not consider using old phone as other purpose for a long term

        Due to set old phone as server or some kind purpose like that
        it must attach usb cable always charging, and it would leave in somewhere with no people
        but when the battery is old, the battery voltage or anything else might not act as specification
        so we assume a normal battery have a normal voltage
        But if the battery swelling, I’m not sure that charger IC would stop charging or not.

        so if you’re trying reuse your old phone with some longterm purpose
        it’s better remove the battery

      3. Lithium batteries prefer to be stored long term at 50% state of charge. Storing at above 90% will damage the battery. While 50% is preferred, anything 30-80% is fine.

      4. Hello,
        Batteries kept at full charge also degrade. The issue here is that the degradation is escalated by heat, the degradation causes shorts to form, and this increases current flow to “charge” the battery as it fails.

        Please check Li-Ion batteries regularly, or swap to LiFePO4 chemistry which is happier in this service.

      5. On newer phones, you can limit the charge to only 80% capacity to preserve the battery. That’s really all this need to do. You could create a tasker script to pause changing at a specific charge level or battery voltage level.

    2. Exactly. I had no idea about this battery bloat thing and I was using an old samsung phone for a security camera. I kept losing connectivity and when I went to check on it, the back was popped off. On me for being dumb, but a valid concern nonetheless.

    1. Indeed, just be nice if they actually put enough info out there or actually mainlined the device specific bits on these things so it is not as much work to stay updated enough to be functionally secure. The whole device is generally e-waste even if you don’t want it to be simply because the perfectly good hardware is shackled to terrible software support for its hardware.

    1. Can you run Linux or your own software on old iPhones? If not then it really isn’t as useful. Apple is generally very closed and doesn’t allow any kind of modification or your own software.

    1. Pros and cons compared to Android phones :

      Pros :
      Far cheaper when new
      Better wired connectivity
      No battery problems
      Easier to flash and root

      Cons :
      Poor wireless connectivity (sometimes no Wifi, bluetooth, and never LTE)
      More expensive for the processing power if you buy it used
      No “integrated UPS”
      Not very powerful for general-purpose computing

      I think these top boxes are better suited for media applications (smart mirrors, streaming servers), while phones are better suited for general-purpose servers and for robotics.

      TL:DR In David’s case, Android set-top boxes are in practice the best solution, but hacking is also about doing with what you have.

    2. Works very well. I’m using an old V88 tv box als Linux Server with Armbian running docker with home assist,pihole and so on. I tried running Linux on an Galaxy s3 with Postmarket Os. But I think V88 box will consume less power. The box need 2W.

  2. For those in need of a RPi substitute, has some interesting boards at a fraction of the RPi price. Most of them are LTS and in stock. They’re however less powerful than the RPi 4 and mostly aimed at IoT/industrial/server uses, rather than for example as video players. For that use case, any reflashed Chromebox could work much better than the RPi4.

  3. The power management on mobile devices isn’t setup in a way to stay plugged in 24/7. Keeping the battery constantly at 100% results in expansion to the point that the screen and/or rear panel bulges or even separates.

    If you have a removable back or a device you can open, the best choice is to power the device directly using a voltage between 3.7v and 4.2v. You may get a temperature warning, but typically that prevents you from charging and since we’re not using the usb power input should be fine.

    Also, I see you hackaday, using a picture of a Note 7 in an article for a project where the phone is always plugged in…

  4. As for the program closing in the background, I think they are being extremely charitable to say that the Samsung ROM is closing the app because of memory usage. Samsung has a history of closing apps you aren’t actively interacting with seemingly just for the hell of it.

    Check out – they are the top of the shit list for this behaviour.

  5. I have also tried once to use an old Android phone as OctoPrint server. It worked but after a while the battery swelled. I was guessing that maybe the high resource usage of the poorly optimized Python code caused some issue with the charging management and it overcharged the battery but after reading the comments it seems this will happen of you keep charging your phone anyway. So the charger+timer solution seems a good workaround.

  6. This idea sounded like it might have been a good way to get a nice platform for camera based projects but after the comments here, that doesn’t seem like the best idea.

    I’ve seen lots of articles about RasPi alternatives since they are still pretty much unobtanium, but I haven’t seen anything about alternatives with solid camera support.
    Would anyone be willing to suggest a solid alternatives for camera based projects to explore MotionEye or even MotionEye OS (or a fork of it)?

  7. I think the android phones with a numerical keyboards would be a nice alternative to a RPI. I expect the numerical keyboard would expose at least some GPIOs.
    Searching for “android smartphone with keyboard” on your favorite imported goods website should point you to a 1 GB RAM android phone with 8 GB flash for ~26€. And you’ll have all the previously mentioned perks: screen,GPS, battery, audio in/out, speakers, camera,FM radio, etc.

  8. I wonder if one day we will have a framework be able to buy the parts to hookup a rechargeable battery to an opensource embedded device, add a small touch screen, 3D print a case for it, and install a Linux OS for touch screens.

    |–[ battery ]
    |–[ charging interface ]
    |–[ ]
    |–[ ]
    |–[ ]

  9. I recently had to dump an 1.8V serial flash chip. I used a Samsung Galaxy A3 with broken display I had sitting around, removed the screen and added some perfboard. I then installed postmarketOS, looked up the schematics for the phone (you can find a huge archive for all Samsung smartphones online) and patched the devicetree so I can use some pins of the display and touchscreen as GPIOs.
    Using flashrom I was then able to dump the flash. Worked like a charm, and I can imagine quite a few other usecases recycling old smartphones.

  10. One thing I’ve been wondering in regards to running devices that originally are designed to have a battery without one is what if we, instead, used a capacitor? This should show the charge and discharge that the design expects as well as allowing for momentary power disruptions but capacitors are a lot more tolerant of conditions — including aging (within limits of course.) Of course they don’t hold much by way of actual capacity, but it might at least be sufficient for things like what we’re talking about here.

    I had been wondering in the past about the idea of using a capacitor in, for example, a Nintendo Switch dedicated to only sitting in a dock. (It’s essentially a Nvidia Shield tablet just slightly customized, so for all intents and purposes the same thing we’re talking about here in fact.) I don’t have the means to actually test it yet though.

    1. My buddy did this on a tablet but ran into a capacity limitation. The phone will occasionally test the battery by only running from battery power for a few seconds. Now he has a tiny 150mah battery in parallel with caps. So the tiny battery might swell eventually but it’s dirt cheap. Supercaps might work if you can fit enough power inside your device

    1. A phone really doesn’t compare at all on those fronts – if you can live without a screen and have the device tree info you can probably get more than just USB OTG for expansion using the I2C/SPI the screen would usually use. But that is not going to be easy to do for all devices, actually getting hold of the ‘source’ to tinker for phones can be next to impossible and even if you have them its going to be alot of work if you don’t already know exactly what you are doing.

      More modern phones that really make use of the USB-C spec you might get more IO options, certainly can get faster USB data speeds for expansion and maybe even the possibility of adding PCI devices – though again you run into the software problems in making that device work most likely.

      With a Pi or better still their Compute modules you get all the IO directly and well supported software wise – its almost trivial (for most things it even is trivial, but you will run into trouble sometimes – like the nutters trying to get external GPU to function properly on a CM4). And the Pi’s are for now at least much more modular than a phone – on the whole the exact same functionality, external hardware and bootable image will run on all models and do whatever you set it up to do. Phones are generally quite model specific, sometimes even model number within the same model specific.

  11. If anything the epic failure of the Raspberry Pi Foundation has taught us over the years, it’s how to get by WITHOUT a Raspberry Pi – unless you are a rich company of course!

    1. That seems rather unfair to me. Yes they have managed to make rather fewer of them available to the general consumer than we would like over the last few years, so scalpers have been making hay. But as even giant tech companies have in that time period done almost entirely paper launches with no product at all I’d say the RPI folks did pretty well getting anything made and shipped…

      1. Wondering that no one mentioned the one and only deal breaker yet: Android doze mode keeps kicking apps constantly since Android 6 – no matter if screen always on, keep app alive in background and so on… Tried almost everything, even adb doze mode off. Nothing helps keeping apps alive for a longer period… :-/

      2. Agree 100%. That’s a sophomoric view regarding Raspberry Pi. Demand is currently higher than supply. I wouldn’t consider anything they’ve done as a failure. Particularly throwing the misuse of “epic” in the same sentence.

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.