gogsbread / yulegen

GenAI animations in LED Matrix for Holiday

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yulegen

πŸŽ„ Light up your holidays with GenAI magic! 🌟

Add a festive twist to your Christmas tree with randomly generated GenAI images on a 32x32 LED Matrix. This cheerful display, powered by Raspberry Pi 4, Adafruit RGB Matrix HAT, 32x32 LED Matrix and creatively framed with Lego blocks. Get ready for a bright and merry season! πŸŽ…βœ¨"

Matrix Setup

Hardware

Tutorial has all the instructions to setup LED Matrix with HAT. rpi-rgb-led-matrix provides all the libraries and low level functions.

Setup

  • Both Raspberry Pi and Matrix is driven by Aukey Wall Chargers each powered from a USB port. The Aukey chargers drive sufficient current and voltage for the matrix. Always do the math and add some buffer to avoid flickering.
  • I did not connect the terminal block in HAT to the matrix. This was because my HAT's terminal block was busted and wouldn't drive voltate to the matrix. Instead, I directly connected the spade connector from the matrix to the USB charger. The HAT was driven by whatever power was provided by the Pi which was sufficient. Power Setup
  • I soldered a jumper wire from GPIO4 and GPIO18 for smooth rendering. This comes at the cost of disabling the audio drivers in the Pi. I did not use RTC(figured it wasn't needed for my 32x32).
  • Hide all the nasty stuff behind the tree and have a nice Lego facade πŸ˜€ Appearance

Software

  • The display starts with some bootstrapped images--bootstrap-imgs-path(also genAi). However, these images have been prompt engineered to perfection.
  • At defined speed, --genimgs-per-hour, it downloads images from openAi Image generation Apis. I wanted to run a model locally in the Pi, but as of 2023, this is not a good idea.
  • OpenAi api key is injected as environment variable. Can also be provided with --openai-api-key
  • The generated images are convereted and scaled using ImageMagick and double buffered to the matrix for display. I want to add some animation, but didn't happen.
  • All code is in yulegen.cpp. The daemon can run as systemd service starting at defined time in yulegen-start.timer and stopping at yulegen-stop.timer. Frame rate can be controlled with --animation-duration-ms.

Pre-Installation

# for rendering and scaling
apt install libgraphicsmagick++-dev libwebp-dev
# for httplib to handshake tls
apt install libssl-dev

Installation

make
sudo make install

# cleanup
make clean
sudo make uninstall

About

GenAI animations in LED Matrix for Holiday

License:MIT License


Languages

Language:C++ 88.0%Language:Makefile 12.0%