Activity

Alec

Shipped this project!

Hours: 25.43
Cookies: 🍪 711
Multiplier: 27.97 cookies/hr

I’ve built my own Pi-powered homelab! Super happy with how it came out - it’s really been beneficial for my workflow. I highly recommend watching the demo video the whole way through - there’s more to this project than meets the eye (I mostly devlogged the display program but I’ve spent countless non-tracked hours building the AQI sensor’s ESP32 program in Arduino & 3D modelling the Pi’s case). By far the most challenging part of this project was the initial technical hurdle - there’s very little i2c, gpio and spi documentation for NixOS and even less for the Pi Zero 2W. Figuring out all the super technical dtb stuff (with a little help from AI) so I could move on to the fun part (coding the display program) was a must.

Forgot to mention but I’m reusing the image from the last devlog as this project’s banner. The demo is a video given that most users won’t have a spare Pi Zero 2W and a Waveshare HAT lying around. If you do, I’ve detailed the entire setup and how to run and build this on your own Pi in the project README.

Alec

Overview implementation, cleanup & ship

And it’s complete! I’ve just placed the device on my shelf to be left online indefinitely. I’m extremely confident in the homelab’s self-sustainability given that all my scripts autostart on fail and are completely managed by systemd. Speaking of such scripts, I fixed both the display and AQI webserver programs to work without needing to be restarted after boot. They now work flawlessly and my AQI program I wrote in Arduino a while back continues to work. And of course: I cleaned up the non-display code one last time.

The overview page has been implemented entirely and now shows a percentage rather than GBs used (I realized that larger drives will cause display rendering issues!) and the Network is no longer a placeholder icon.

I recorded the device in action earlier today and ran into a few issues. That’s why the recent Git history is a bunch of small changes. I just finished publishing the demo video for this project where you can see everything in action.

Attachment
3

Comments

hack.clubber
hack.clubber about 1 month ago

That’s so cool bro

parbarvaliya4811
parbarvaliya4811 about 1 month ago

🔥FIRE🔥

sebastiaolina1
sebastiaolina1 about 1 month ago

Melhor projeto que eu vi hoje e na vida

Alec

Overview page, autostart & scripting

I’ve implemented custom checkmark/x-mark icons for overview statistics like syncing and network connection. Storage usage text is now show but know that all of this stuff is placeholder for now - only the sync status is working fully. I also refactored literally the entire LCD & drawing library. It’s been optimized and cleaned to the fullest of my abilities and I’ve noticed a significant uptick in build performance and speed. Overall feeling super happy about where the codebase is right now.

Also did some scripting work and the program now runs as a systemd service when the device powers on. It boots fast and feels completely native. And if I need to run the binary again from my user, it’s as easy as just stopping the systemd service. Hoping that the next devlog will be my last until ship seeing as everything is almost complete.

Attachment
3

Comments

aloyak
aloyak about 2 months ago

you’re cooking so hard lol, good job!

Alec
Alec about 2 months ago

Thank you!

sebastiaolina1
sebastiaolina1 about 1 month ago

você é dono do master chef?

Alec

Logging, button actions

The logging feature now reads from the logs.txt file in the user’s home folder. I’ve integrated my scripts with this log such that any fail or success will write to this log. It’s drawn dynamically on the display. I’ve also implemented button actions - holding any button will trigger code. For example, holding key 3 will actually turn the device off, holding key 2 will wipe the logs, and holding key 1 will refresh information. Holding the sleep button won’t cause an infinite sleep/awake loop. I’m extremely close to finishing this project and all that’s remaining is the simple autostart of this program and the implementation of the overview page (which should be easy enough). Expect a demo video and ship later this weekend! :D

Attachment
0
Alec

Menu switching

I’ve integrated menus. You can now select between all three menus using the 3 right buttons. It also works perfectly with sleep mode - clicking on any menu while in sleep will wake the screen and take you to the proper menu. The layout is finished so now I’ve got to fill in the content (logs & states) to make it actually useful. I’ve still got to figure out how to make hold actions like to clear the logs or to power off the device, but I wont worry about that right now. I realized while planning these menus that the joystick is kind of useless and is only currently used for sleeping the device. Maybe I’ll find another use for the three right side buttons (actions?) and turn the joystick into menu movement (with animations??) but I’ll leave that to another ship.

0
Alec

Working on integrating the buttons with the program. Clicking the joystick down will turn off the display entirely. The goal is to draw near zero power to the HAT when in sleep so that I can leave the display off (and ensure the device/display longevity) when I’m not using it. It took a lot of tinkering around to get the sleep and backlight to work properly but I’m proud of how fast it can sleep & wake up. In the video you’ll see that the backlight (right underneath that screen but above the HAT pcb) can also be toggled for near zero power draw. Also you’ll notice that I redesigned the overview page - I figured out how to change the background color (it’s really jank, will probably have to do more touch ups on the drawing backend). Will focus on getting the rest of the pages complete.

0
Alec

The demo program is an absolute mess. I’m new to C but even I can tell bad code apart. Although it was pretty well documented, it was clearly made with low effort. So, of course - I had to clean it up and refactor most of it. The result is another (smaller) mess and my first prototype stats page. Still have to find a way to fill in the info and make the background color actually work. This is the heart of the project right here and I’ll be putting my best foot forward to making this experience and UI super polished, even when I’m not given the prettiest of tools (if you care to take a look at the code (this is my first C project) you’ll know what I mean). Anyways, feeling pretty good about the future of this project and hopefully I’m able to now dedicate some more time to making this thing actually work.

Attachment
1

Comments

Ez
Ez about 2 months ago

DAMN

Alec

GPIO buttons now work!! Had to fiddle around with the config.txt of the Pi and got lost with dtb stuff but all is now working. Lots of progress made towards the display application side of things and I’m now modifying the original demo program to provide a solid foundation for my system management program. Honestly the lack of documentation is really rough since it feels like the Pi Zero 2W just isn’t as supported on NixOS or even in the kernel as the Pi 4 or Pi 5. I have all these hacky dtb overlays in my Nix config which is really annoying. I’m trying to clean the system up and remove things that won’t break the screen but the lack of self-rebuilding is making the process very painful. I made a quick devshell which has a program to automatically deploy the built binary to the device so hopefully I can develop faster. Enjoy this quick video of me using the demo program to showcase the now working buttons!

0
Alec

Finally got the proper i2c/gpio dts for the Pi Zero 2W working and now I have a fully working display on NixOS!!!! (first image is the demo program, second image is fastfetch on the Pi on NixOS!!)
The buttons still don’t work yet (I honestly dont know why) so that’ll be what I focus on next, and then I can go on to actually making the program for the display.

Attachment
Attachment
1

Comments

chefpenguino
chefpenguino about 2 months ago

W nixos

Alec

So I went ahead and tried running the example code for this Waveshare display on NixOS and to nobody’s surprise: it didn’t work. So many errors and issues. I don’t even know where to start with fixing it. I installed Raspbian and ran the test program and it worked, so at least I can’t attribute it to my faulty soldering job (I soldered the header on before starting Flavortown). I’m going to investigate this further and try to get the display working on NixOS so I can use my flake.
I found a Nix flake for Pi hardware support so I tried giving that a go but I realized it doesn’t support the wireless Zero 2 model so I might just steal the flake expressions instead. Also I got the Spotify download script working so my music backup service works now.

Attachment
Attachment
0
Alec

I cleaned up the flake but ended up deleting the wireless firmware by accident. I had to reinstall the flake but I ended up with a much smaller & optimized system. My focus is getting the two backup scripts and webserver services working flawlessly. I’ve successfully managed to get the Github backup service working with my Github PAT (I came up with a really clever solution to store my keys that don’t require local key protecting rebuilds - I just store the file and call that file directly from the code rather than pulling from an environment variable) so all my Git repositories are pulled and saved on the USB drive and accessible through the NAS. Attached screenshot is the terminal running the git fetch scripts which dynamically includes my private repos as well
I tried to get the Spotify download service running but it seems like Spotify has recently implemented aggressive rate limiting policies which break spotdl. They even block new developer apps so its impossible to use authentication to get better rate limits. For now, I’ll just focus on getting the webserver service running reliably (it seems to crash or stop responding and its service breaks on restart)
I’ve also been preparing the Pi’s config for spi & i2c control so that I can properly interface with my display HAT. I haven’t yet tested the display so that’ll probably be my next task.

Attachment
0
Alec

I’ve implemented complete drive automounting with Nix. Unplugging/plugging in a new drive will make the drive available on the Samba NAS share (top right of the screenshot). Scripts and the webserver will not run if there is no drive attached (because thats where the database and stuff is stored)
I’ll begin working on making the Github and Spotify backups work with the automounted drive. My hope is to make them all available through the NAS drive hosted by the Pi.

Attachment
0
Alec

I’ve rebuilt the image twice because I forgot to set a password within the flake. Second time I corrupted the image but the third time’s the charm and now I’ve got a fully working Zero 2W flake. SSH works so I’ll be using the device headless from now on. I’ve also made some documentation updates.
First image is working flake + SSH, second image is the fastfetch and 3rd image is the corrupted image.

Attachment
Attachment
Attachment
4

Comments

101zh
101zh 2 months ago

Let’s goooooo! ᕙ(⇀‸↼‶)ᕗ

Alec
Alec 2 months ago

hi hunter!!!!

Alec
Alec 2 months ago

oh btw funny thing this is the same Pi kit that I got from daydream seattle!!! do u remember the labryinth game 101zh?

101zh
101zh 2 months ago

Yep, I remember it! I’m glad that you’re putting the kit to use. I can’t wait to see where you go from here.

Alec

Hackatime will be tracking just the flake/software side of this project. However, I’ve spent hours already designing and modeling a case for my Raspberry Pi (see image) and getting the Nova PM sensor working. I’m using a Pi Zero 2W kit I got as a prize from Daydream Seattle. I also have a Waveshare display HAT I got a few years back (never ended up using it). I’ve configured the basics of the Nix flake and as I’m writing this I’m building the custom NixOS ISO image to flash to the SD card. This image will allow me to boot NixOS on the Pi and rebuild it from my main laptop.

Attachment
Attachment
Attachment
0
Alec

Currently working on a large-scale Minecraft survival server themed around a snowy tundra. I’ve recently hit a few milestones in its development - from finishing the building and raiding system to the custom block system. This is what I have so far (this entire structure was built with a building tool and blocks were crafted from a custom UI - more about this soon!)

Attachment
0