From my benchmark and the official Octoprint account, we know that the recently released Raspberry Pi Zero 2 W is fast enough to run an Octoprint server for your 3D printer. It’s all great, but with limited I/O (read as a single USB port) I have more questions: Can I share the USB port with a webcam, 3D printer and a USB Ethernet adapter. Is WiFi fast enough to support a 1080p stream… is 512 RAM enough for all plugins I use… and so on.
(Benchy)marking Octorprint on Raspberry Pi Zero 2 W
Raspberry Pi Zero 2 W is an awesome and inexpensive upgrade to any Raspberry Pi Zero project. It’s quick enough for Octoprint and many other tasks, it has enough RAM (512MB) to support the processor, but with a single USB port options for using it as an Octoprint server are limited.
By default, you will be forced to use a Raspberry Pi Camera, that connects to the camera header on the board, as the only micro USB port will be used for connecting to a 3D printer. With Raspberry Pi Camera priced £25 and HQ version over £70 (with a lens), this could be a much more expensive option than picking up a Raspberry Pi 4 and using a spare webcam laying around. So I thought it would be a good idea to see how Octoprint on Raspberry Pi Zero 2 W fairs in different configurations and how stressed you should be about your prints.
For each scenario, I will run my Ender 3 printer, test the performance of the board by looking up stats in the resource manager, and run a timelapse. This should determine the best/most reliable configuration for running Octoprint on Raspberry Pi Zero 2 W.
I will also experiment with USB hubs and connecting Raspberry Pi Zero 2 W to the internet via USB-Ethernet adapter, as my benchmarks verified this to be the fastest way to access the server. I will monitor CPU performance and temperatures in the resource monitor and highlight the most important metrics.
Lastly, as the default, Octoprint stream settings are set to 480p, I will crank these up and see how things perform. Covering these scenarios should put your worry to rest.
- Octoprint on Raspberry Pi Zero 2 W (performance benchmark)
- Octoprint on Raspberry Pi Zero 2 W with Raspberry Pi Cameras (480p/1080p)
- Octoprint on Raspberry Pi Zero 2 W with USB hub an USB camera (480p/1080p)
- Octoprint on Raspberry Pi Zero 2 W with USB Ethernet and different cameras
- Octoprint on Raspberry Pi Zero 2 W – all in, printing, timelapsing
As I don’t need another 10 benchies on my shelf, I will run my test dry (without filament), identify the most taxing scenario and complete the print to prove that running Octoprint on Raspberry Pi Zero 2 W was a good idea indeed.
My Octoprint instance is the latest version (1.7.2) with the following plugin installed:
- Bed Visualizer
- Resource Monitor
- Spool Manger
It’s a mix of probably the most common plugins and it will add a bit of strain to the system’s performance. It will represent a typical Octoprint installation with some modifications.
1. Octoprint on Raspberry Pi Zero 2 W
Since the Raspberry Pi Zero 2 W is officially approved for the Octoprint, I know I shouldn’t have any problems running it directly. Since I left the webcam (and Pi Cameras) out of the equation, the Octoprint is sailing smoothly.
With the CPU use peaking at 25%, and over 190 MB of RAM available, I don’t expect any print issues caused by the Raspberry Pi board. Bear in mind, that I had the web interface open for my mock print.
Overall, things are looking promising with plenty of CPU and RAM to manage your prints and plugins. Let’s start adding stuff to the configuration
2. Octoprint on Raspberry Pi Zero 2 W with Raspberry Pi Cameras
One of the advantages of the Octoprint is the ability to enable webstream, to monitor your print. By default, web streams are enabled in 480p quality. Good enough to check on a print from time to time, but far from perfect if you are interested in Octolapses.
Interestingly, enabling 480p stream for both Raspberry Pi Cameras wasn’t that tasking. It had a minimal impact on the system especially when the stream tab was closed. For my benchmarks (which would otherwise look like the ones from the 1st scenario) I opened the URL stream in another tab, to keep the stream active.
Cranking the resolution in Octoprint config to 1080p, and things are getting toasty. If you are not actively streaming, the system is idling at around 6-10% but as soon as the stream is active, it takes a toll on the system:
RAM usage goes up by 20MB and the temperature rises by 10-15℃. Also, the network is significantly impacted. If you are going this route, you should probably consider a USB Ethernet adapter. I should also mention that the 1080p stream introduced 2-3 sec latency. I will check if this is present when I’m streaming the data over a wired connection.
3. Octoprint on Raspberry Pi Zero 2 W with USB camera & hub
If you don’t have a Raspberry Pi Cameras but you have a spare USB hub, and a webcam, you can make it work too. In theory USB 2.0 has more than enough bandwidth (480Mbps) to support the USB stream. In my tests, the performance of the USB camera (Logitech C920) was similar to what I observed while using Raspberry Pi cameras.
Performance graphs from both tests (480p, 1080p) matched what I already knew. You shouldn’t worry about using USB hubs to connect the printer and the webcam.
As I checked more than one USB camera, I observed a crash on the model that required a higher current to operate. Consider using a powered USB hub if your webcam has LED lights, as this can cause the camera to fail at best and at worst ruin your print. You can also modify the cable that connects to the 3D printer and remove the power rails (you can cover lanes 1 & 4 with tape) to save on the current draw.
4. Octoprint on Raspberry Pi Zero 2 W with USB camera, hub & Ethernet adapter
Up until now, almost everything was working great. The only thing that bothered me was a small stream delay in 1080p mode and occasional interface delay (print not affected) caused by the bandwidth used by the 1080p stream. It’s not optimal, and the best way to prevent it is to use a USB to Ethernet adapter. My benchmarks already confirmed this to be the fastest way to connect to the Raspberry Pi Zero 2W.
Using the USB Ethernet adapter increased the RAM usage by another 10MB, but with 170MB+ to spare, I had no problem with that. Especially, that I received a 1Gpps link in exchange.
Looking at the stats in this scenario, I have the impression that using a webcam was more friendly to the Raspberry Pi Zero 2 W than using the Raspberry PI HQ camera. While the resolution of the stream was the same, I’m not sure if my observations are unfounded, or higher quality stream from the Raspberry Pi HQ Camera resulted in a higher bitrate stream to be encoded. I’m also under the impression, that thanks to better bandwidth via Ethernet, the processor didn’t struggle as much.
5. Octoprint on Raspberry Pi Zero 2 W – all in, printing, timelapsing
Now that we have the most demanding scenario identified, it’s time to run it for real. Simulations only show that we have a spare CPU, some RAM left and we are not melting the board in the process, but to prove the point, let’s run the bench print, make a timelapse out of it in the most taxing scenario.
As the Raspberry Pi HQ Camera in 1080p was probably the most taxing, I will make my final print with the timelapse enabled, using an Ethernet adapter and unpowered USB hub.
As you can clearly see spikes when timelapse pictures are taken. The CPU usage drops significantly when the stream isn’t actively viewed, but other than impressive looking charts, the board handles the process like a champ.
Running Octoprint on Raspberry Pi Zero 2 W is an excellent idea. The board is made for this purpose and anyone postponing this upgrade should jump the gun as soon as they have an opportunity.
More than one 3D printer?
Considering the CPU use and the RAM felt, I think the Raspberry Pi Zero 2 W would be capable of running 2 prints at the same time, even with cameras set to 1080p.
I’m not going to test it, as I know from my experience that running 2 webcams using a USB hub is never a trouble-free affair. If you are happy with a single stream, then the Raspberry Pi Zero 2 W should be able to serve 2 printers at the same time.
Now, that you are convinced, here are some suggestions to consider. Decide where and how you are going to mount your Raspberry Pi Zero 2 W, then make your life easier and pick a nice hub, or a custom micro USB to micro USB cable. You saved the money getting inexpensive board, so don’t cheap out now.
If you are tempted to hide the board inside a case, or motherboard enclosure, consider WiFi range or using an Ethernet adapter. Lastly, you can convert the Raspberry Pi Zero 2 W into a USBerry – a stick alike concept that gets power directly from the USB port.
Consider a heatsink to keep the board a little less toasty, especially when rendering time-lapses and a powered USB hub if your camera gives you headaches.
Coming relatively soon
RaspberryPi Zero 2 W came out just in time! I’m in the middle of the design process of the modular 3D printer enclosure that is not like the other (even though it looks like bog-standard IKEA Lack table driven design). If you are thinking of moving your printer away and sticking it in less favourable conditions or just want to save some space and noise, you probably want to follow me.
As running Octoprint on Raspberry Pi Zero 2 W is proven a viable option hardware-wise, I expect a lot of makers to make the jump, especially that designating Raspberry Pi 4 to do the same wasn’t really cost-effective. I can’t wait to see clever enclosures designated to host Octoprint and attach the board to the 3D printer. If you have got any questions, or cool ideas, feel free to share them in this Reddit thread.