Hello everybody,
I just set up my MM software on a Raspberry Pi Zero W. You might ask why such an old device in 2023… well there are several reasons for that:
1st I just had some laying around from past projects and 2nd ( and most important ) the low power draw of the Zero W was just perfect to power it off a USB connection on my monitor, so I did not have to fiddle around with buck converters to power the pi.
I ran into several problems while installing it, and I just want to share the solutions I found for them.
¿RaspberryOS light or full?
Well, the easiest way is to opt for a full flegded OS, but since the Zero W has so limited capability, I opted for a Light install. So I had to adapt my installation mixing several ( outdated ) installation tutorials I found. In the end, I installed Xorg and openbox manually and start them from my .profile
with autologin. After that, I start the browser from whithin my /etc/xdg/openbox/autostart
Which lightweight browser can I use on the Zero W?
The quick and easy answer is none. Chromium is not supported anymore on the Zero W ( legacy build is an option though, but segfaults frequently due to the limited amount of ram ); Midory works ok, but I was not able to remove the direction bar from the top, so that did not work either. So in the end, I opted to write a simple “browser” myself with Python Webkit2 bindings. I had to install de following software:
sudo apt-get install gir1.2-webkit2-4.0 libgtk-3-dev libwebkit2gtk-4.0-dev python3-gi
After that, the following file did the trick:
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("WebKit2", "4.0")
from gi.repository import Gtk, WebKit2
class Minibrowser(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="MagicMirror²")
# The size doesn't actually matter since on the bottom we are going to maximize the window
self.set_default_size(800, 600)
web_view = WebKit2.WebView()
web_view.load_uri("http://localhost:8080")
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(web_view)
self.add(scrolled_window)
self.fullscreen()
if __name__ == "__main__":
win = Minibrowser()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()
¡The boot process is ugly!
Yes it is and I installed plymouth to make it more attractive. In the end it doen’t actually matter and it even delays de boot for a few seconds, but I like it!
I installed the plymouth spinfinity theme and made it all black. After that I added splash quiet
to the /boot/cmdline.txt
file and that was it.
I hope that this helps a few fellow tinkerers who wish to repurpose their old Zeros.
Best regards
Merlin