Android phone as octoprint server

Hello Octoprint fans,

I have question to you - is someone using Android phone as octoprint host?

I have some old android phone so I wanted to try it. I have installed Debian Jessie and working octoprint server but communication between phone and printer is not working, octoprint don't find any port, I can choose only auto and its not working.

Cable connection is OK because I can control printer from android app (move axis for example).

I don't have much experiences with Linux but according some tutorials I found some log which shows that usb device was connected

Thank you for any reply

In android I can control the printer throught app Reprap control, there I have it connected on port like on the screen but when I type this address manually in octoprint and save then I have still only port auto in the drop down list. So maybe I need to link it somewhere in the Linux but I'm only fresh beginer so I don't know how to do it.

Any tips?

Thank you

Phones are optimized to extend battery life. Most of them out-of-the-box will try to sleep if left idle for more than a few moments. As a result of this, I think a phone would be a poor platform for trying to host OctoPrint since it needs to remain on throughout the duration of the print.

You can 100% disable features like Screen timeout and Optimize for battery.

If I had to guess, I would say your application doesn't have permissions to save the configuration file at the intended directory. You would need to investigate where configuration files are stored and check the permissions with:

ls -la

Personally, I think that's an awesome idea to upcycle the computational power of an Android phone!

Very recently, the Termux project (Linux on Android) implemented libusb support.

This allows us to run octoprint under Termux and to connect to serial line over USB OTG, though we are not there yet: We would have to write a Python plugin to implement serial over USB using the libusb API.


Thank you for reply, in meantime I bought orange pi lite and I'm running octoprint on it.

I would really like this!!!!! Used Android phones go for $20 on ebay. Throw in a OTG cable for $5. Okay, now you have an octoprint server for $25, big deal?

Maybe a huge deal!!! Recycling old phones is a huge help to society. Plus, these 3d Printer boards are getting cheaper and cheaper. I just bought one the other day for $9. Can you imagine all the "smart" devices you could control and make, from all the old Androids you have lying around?

Android phones are so small too! And they have a screen, wifi module, all included. They are objectively way better pieces of machinery than Rpi, and they're just being thrown away!!!

How would someone go about doing this? I bet it wouldn't be as hard as it looks

For the record, I have tried the debian install, and it was a lot of work!!! Using it through an app would be better.

Edit: I will look into this briefly and try to provide some insight
Phone: Samsung S7 Active

  1. Found USB OTG cable. Try to get one with two tails like this. You might try to connect the charger to the USB OTG cable then to your phone, and see your phone is charging, then connect the printer board for your phone to charge during this process. On some phones like my samsung, this doesnt really work. But because octoprint can be run with the screen off, it may still be charging in the background
  2. Android setup: Download a) Termux b) Termux:API. These are two android apps on the Play Store that you need. Record IP address by going to Connections and clicking on the Wifi name - will use this to connect to octoprint server later. c) You should also download 'Hackers Keyboard' so you can have a keyboard with CTRL keys, the Termux keyboard gets glitchy. d) You should also download 'BootControl' to launch Termux at boot. Open boot control and a 2 second delay then add Termux. I needed a 2 second delay for Termux to start.

Inside Termux terminal app:

  1. Installed python with pkg install python
  2. Installed octoprint with pip install octoprint. This is taking a while!!!
  3. Test with octoprint. It loads
  4. If you want the octoprint server to start on boot you can add octoprint & to .bashrc as well, but do this last
  5. With USB OTG connected, /dev/ttyACM0 is detected, but there is no permission to access it. If your phone is rooted you can change this permission to be +777 with chmod +777 /dev/ttyACM0 and add this line to .bashrc to happen every time. But rooting is hard...
  6. If not rooted, from termux terminal, try: pkg install termux-api libusb clang
  7. termux-usb -l should give an array of things. this worked for me if i quit the terminal, replugged in the printer board, then opened a new terminal. Otherwise it either hangs ( > 10 seconds) or prints an empty array.
    10 . termux-usb -r /dev/bus/usb/001/011 was needed to access USB port

For development, it is really useful to install SSH server on termux.

  1. pkg install openssh -y will install openssh
  2. sshd will start the openssh server. passwd is needed to set a password the first time. adding sshd to a file called .bashrc is a really good idea.
  3. ssh-copy-id -p 8022 -i ~/.ssh/id_rsa $TERMUX_IP this will copy your id from your linux machine to termux allowing for auto remote login
  4. ssh -p 8022 $TERMUX_IP gives you the ability to login!!!! This gives you the Termux terminal on your laptop.

If IP address keeps changing on your android:
Set static IP address on router so you always connect to the right thing. Or with much greater difficulty, you can connect your android to a VPN

If screen going out is causing problems:
Set screen timeout to "10 minutes" so the Termux terminal won't get interrupted by the screen going off. Set developer options to "Screen never sleeps when charging" so screen never sleeps when charging. I didn't have these problems on Samsung S7 active but i thought i would.


Hello! Thank you very much for taking these steps, I have successfully installed octoprint. I have even connected by usb and in termux it appears "access granted"
but when I try to connect to the printer, in octoprint web, it says " State: Error: Failed to autodetect serial port, please set it manually.". I have tried to assign manually, Serial Connection > General > Additional serial ports: /deb/bus/usb/001/003 and /deb/bus/usb/* but with no success. Any idea? thanks!!!

I could not get octoprint to work.
There are some apps for 3D printers already, "GCode Printer". It was $4.49
With the right USB OTG cable, these may work for you.
There is "limited octoprint support". It asked for my octoprint hostname and API key, but i never saw what it was really capable of with that.
It did not work for my really cheap printerboard because it was missing a driver for it I think
I wound up taking some open source code, called SimpleUSBTerminal, and creating an android app that suited my needs.
I may make the code open source eventually
It would have been really nice to have octoprint work, but making it yourself also had advantages

I tried to follow your guide but I still have a problem with my serial port connection. I can see ACM0 but i can't use it. My device is rooted but also using chmod command to change the state nothing happened. Have you got an idea to solve it? ( i used linux deploy and termux on my Galaxy S5 but there is no difference).

It is not an easy process:

  • compile new kernel with printer driver
  • solder a usb otg cable with charging capability(like audio dock etc.)
  • use linuxdeploy application to install linux
  • use venv inside linux to install latest version of python etc.

but I tried to document it all for my old samsung galaxy s3

Also have a look at somekev's website: (i think he did it without compiling a new kernel for the phone)

1 Like

Maybe the name of the serial devices isn't matching.

There are patterns used for filtering the devices in /dev to get usable serial ports. AFAIK the default is /dev/USB*. You can enter additional pattern in a text-box in the serial configuration.

As it seems problematical to charge most phones or tablets while using OTG - couldn't we use a bluetooth serial adapter (about 3-4$ on aliexpress) paired to the android device? Many printer boards (like the popular Bigtreetech ones) have a serial port...
So you would use USB for power the android device and BT-serial for communicating to the printer. Some android devices even automaticly boot when beeing connected to power (f.e. Amazon fire tablets), So using an Fire 7 (5th or 7th gen) with Linage OS, Tasker (to automaticly start browser with octoprint as homepage and to shut down tablet when power is shut down) and powering the tablet by a step-down-converter connected to the printers power supply (so tablet/phone automaticly boots then printer is powered on and shut down, when printer is powered off) seems like a interesting way ...

How do we get someone to do this - "Implement serial over USB using the libusb API"

I was able to connect a short wave transceiver over USB to an Android phone in Termux environment. The source code is a short piece of C++.

So the low level libusb access from C/C++ to a USB device works. Therefore it should work to compile something like

to access various USB to serial port converters on Android.

To make it work for Octoprint would mean to bundle the above mentioned library as a Python package with an interface similar to the standard python serial port package, and to ask Gina to integrate it. It should be doable, though it would likely not be a single evening job.

I checked the hutorny/usbuart project. I will likely test it the following weekend. There is a test project examples/uartcat.cpp, which streams the serial port to/from standard input. I will try to work with the Termux authors to integrate the usbuart library and the uartcat tool to Termux, so that OctoPrint could just spawn the uartcat tool to get access to the serial port. That may be the least invasive approach for OctoPrint to integrate on Android.

There was someone on the OctoPrint discord back in June I think, who had packed this up into an app that worked really well. Not seen him around since, but it is definitely possible.

There was someone on the OctoPrint discord back in June I think, who had packed this up into an app that worked really well. Not seen him around since, but it is definitely possible.

It is trivial if you have your phone rooted and your kernel supports USB OTG with serial ports. I personally feel extremely uncomfortable having to root and swap kernels. It is risky and quite time consuming.

No root, just an app with a Linux kernel I believe. Worked quite well in my tests.

Would you mind finding the name of the app if you remember? Or maybe find it in googleplay apps history? I really need this.