mirage_demo_compressed.mp4
Mirage Frame was inspired by the above tweets (it's not quite poster size, but it's also a lot cheaper than $4000!) and created to showcase both state-of-the-art AI models and the latest e-ink display technology. The full product includes the professionally built frame/display, an iOS/Android app to control it, and integration with our web server for image generation. Modes include the following, with more to come:
- Face Remix: see yourself and your loved ones in famous paintings
- Local Remix: see your local cityscape or natural scenery illustrated in different styles
- Freestyle: write prompts to generate your own AI images
- Direct Upload: upload any image
This Github repo will show you how to make a working prototype that can be controlled by your computer but will require you to bring your own API key/images for models you want to use (and set up all the hardware/software, of course). So if you prefer to skip all that, you can buy it here. Otherwise, let's get started!
- πΌοΈ E-ink display control with image upload and validation
- π System monitoring (CPU, memory, temperature, disk usage)
- π Service control (start/stop/restart)
- β‘ Power management (reboot/shutdown)
- π Prometheus metrics endpoint
- π Optional API authentication
- π Comprehensive logging
- Raspberry Pi Zero 2 W (works with any Pi version that has a 40 pin header)
- Inky Impressions 7.3" E-Ink Display
- SD card (32GB+ recommended) for Pi
- Power source compatible with your Pi model
- Enclosure (frame) materials; the prototype in the video uses this shadow box from Amazon, spacers made from cardboard, mounting tape, and a paper border cut out from an old picture frame
If you haven't already, install Raspberry Pi OS Lite 64-bit (or the appropriate OS for your Pi) using these instructions. Set up WiFi and SSH and make sure you enable SPI and I2C interfaces in system settings.
The screen is a hat for the Pi, so you can simply plug it in. Mount the screen + Pi inside your enclosure as you desire (you can see our hacky example below), connect the power source, and SSH into your Pi.
- Clone the repository:
git clone <repository-url>
cd mirage- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Configure the application:
# Optional: Set environment variables
export LOG_LEVEL=INFO
export METRICS_INTERVAL=300 # 5 minutes
export KEEP_IMAGES=5 # Number of images to retain
export API_TOKEN=your-secret-token # For API authenticationPOST /display- Upload and display an image- Accepts multipart/form-data with 'image' field
- Supports JPG and PNG formats
- Max file size: 5MB
GET /status- Get comprehensive system statusGET /metrics- Prometheus metrics endpointGET /system/temperature- Get CPU temperatureGET /system/service/status- Get service status
POST /system/service/<action>- Control service (start/stop/restart)POST /system/power/<action>- Control system power (reboot/shutdown)
Run the test suite:
source venv/bin/activate
PYTHONPATH=. pytest app/tests -vYour display should look like this:
Key configuration options in config.py:
# File upload settings
UPLOAD_FOLDER = Path('instance/images')
MAX_CONTENT_LENGTH = 5 * 1024 * 1024 # 5MB
KEEP_IMAGES = 5 # Number of images to retain
# Display settings
SUPPORTED_FORMATS = ['.png', '.jpg', '.jpeg']
METRICS_INTERVAL = 300 # 5 minutes
DISPLAY_STATUS_TIMEOUT = 30 # seconds
DISPLAY_UPDATE_TIMEOUT = 120 # seconds
# Logging settings
LOG_LEVEL = 'INFO'
LOG_FORMAT = '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
LOG_FILE = Path('logs/mirage.log')- Copy the service file to systemd:
sudo cp systemd/mirage.service /etc/systemd/system/- Enable and start the service:
sudo systemctl enable mirage
sudo systemctl start mirageThe application exposes Prometheus metrics at /metrics including:
- Display connection status
- Display update success/failure counts
- System resource utilization
- Image storage statistics
mirage/
βββ app/
β βββ hardware/ # Hardware interfaces
β βββ tests/ # Test suite
β βββ __init__.py # Application factory
β βββ controller.py # Main controller
β βββ metrics.py # Prometheus metrics
β βββ routes.py # API endpoints
β βββ utils.py # Utility functions
βββ config.py # Configuration
βββ requirements.txt # Dependencies
βββ wsgi.py # WSGI entry point
-
Display issues:
- Check display connection status via
/status - Review logs in
logs/mirage.log - Verify display permissions
- Check display connection status via
-
Service issues:
- Check service status:
systemctl status mirage - Review journal logs:
journalctl -u mirage
- Check service status:
-
Permission issues:
- Ensure proper file permissions for logs and uploads
- Verify GPIO access permissions

