A handheld device with OLED display and tactile buttons running multiple apps including weather, notes, Spotify control, timer, and classic games like Snake and Dino Runner.
- Raspberry Pi Zero 2W
- 128x32 pixel 0.96" SSD1306 OLED display
- 4x Gikfun 3mm tactical button switches
- Jumper wires for connections
- Button Up: GPIO 17
- Button Down: GPIO 27
- Button Select: GPIO 22
- Button Back: GPIO 23
- OLED: I2C (SDA/SCL)
-
Clone the repository:
git clone https://github.com/siddmoondhra/desktop-gadget.git cd desktop-gadget -
Run setup script:
chmod +x setup.sh ./setup.sh
-
Configure API keys:
cp .env.template .env nano .env
-
Run the project:
./scripts/run.sh
./scripts/install_service.sh
sudo systemctl start oled-device- Weather: Current conditions with OpenWeatherMap API (scrollable display, auto-refresh)
- Sweet Notes: Cycling through custom messages and encouragement
- Spotify: Music control (play/pause/next/previous) with track display
- Timer: Countdown timer with presets (1, 5, 10, 30, 60 minutes)
- Snake: Classic snake game
- Dino Runner: Chrome-inspired side-scrolling obstacle avoidance game
- Up/Down/Select/Back: Move in absolute directions (up=up, select=right, back=left)
- Double-tap Back: Exit game
- Snake cannot reverse into itself
- Select: Jump
- Down: Fast-fall (while jumping)
- Up: Turbo boost
- Back: Exit game
Once installed as a service, control it with:
# Start/stop/restart
sudo systemctl {start|stop|restart} oled-device
# Check status
sudo systemctl status oled-device
# View live logs
journalctl -u oled-device -f# Stop service for development
sudo systemctl stop oled-device
# Run manually for testing
./scripts/run.sh
# Restart service when done
sudo systemctl start oled-device- Create app file in
apps/directory withrun()method - Add import to
apps/__init__.py - Add to app list in
main.py - Restart service
- OpenWeatherMap API key for weather
- Spotify app credentials for music control
See .env.template for configuration details.
- Display not working: Check I2C is enabled (
sudo raspi-config) - Service won't start: Check logs with
journalctl -u oled-device -n 50 - Virtual environment issues: Re-run
./setup.sh - Git corruption: Backup files, fresh clone, restore
venv/and.env
# Check I2C connection
sudo i2cdetect -y 1 # Should show 0x3C
# Test manual run first
source venv/bin/activate
python main.py