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
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.
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:
Personally, I think that's an awesome idea to upcycle the computational power of an Android phone!
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.
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
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
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:
Installed python with pkg install python
Installed octoprint with pip install octoprint. This is taking a while!!!
Test with octoprint. It loads
If you want the octoprint server to start on boot you can add octoprint & to .bashrc as well, but do this last
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...
If not rooted, from termux terminal, try: pkg install termux-api libusb clang
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.
pkg install openssh -y will install openssh
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.
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
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).
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 ...
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.
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.