Skip to content

Raspberry Pi Magic Mirror project, fully customized with AI, voice and scrapping features

Notifications You must be signed in to change notification settings

jean553/magic-mirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Magic Mirror

Raspberry Pi Magic Mirror project, fully customized with:

  • AI images generation through voice recognition (OpenAI Whisper),
  • bank account balance (scrapping and tesseract-ocr),
  • best flight prices (scrapping),
  • full screen pictures and videos,
  • Hacker News feed stream,
  • subway live timetable,
  • usual stuffs (weather, time, events...)

image

Table of content

Hardware

image

Components:

  • Raspberry Pi 4 (2GB RAM version)
  • LCD monitor
  • Two way mirror plate ("spying mirror") with dimensions that fit the monitor (custom made by glazier craftsman)
  • USB microphone

Note there is no need for actually sticking or screwing the mirror plate on the screen: in my version, the plate simply leans against the monitor; just be sure it won't slip;

There is also no need for unmounting the monitor, neither it is necessary to take out only the LCD plate; as long as the screen is flat, the fact of being an actual monitor remains unoticed;

Basics

image

Features:

  • date and time,
  • upcoming national, international and personal events,
  • weather,
  • news feed (Y Combinator Hacker News),
  • random compliments and love messages 💕

Setup in basic configuration file

AI images generation with voice

image

Generate an AI image based on a voice text.

Required tools

  • USB microphone,
  • arecord and sox Linux tools,

How it works ?

  • a script continuously records audio input on the Raspberry Pi, making a new sound file of the recorded content every 5 seconds,
  • every 5 seconds, the content of the audio file is checked. especially if there is some sound volume in the file, indicating the user has actually said something (usually "Hello" to make the mirror start listening for more complex content),
  • if the audio file contains enough stuffs, then the mirror displays "Listening"; the script is now listening longer (15 seconds) for more content; the user can now pronounce the sentence he wants;
  • the audio file is sent through HTTP to a remote server of mine running both nginx on front and an Open AI Whisper model (those models need a lot of resources to run, the Raspberry Pi is not able to handle such computing tasks, hence why the model is running remotely on a machine with enough resources),
  • the text is extracted from the audio file and sent back as the HTTP response,
  • the text content is now sent to OpenAI Image Generation API,
  • some images are returned and displayed on the mirror

Local script for audio input listening

AI image generation script

Bank account balance

Display the current bank account balance.

How it works ?

  • basic scrapping (scrapping script not included in this repository),
  • tesseract-ocr to automatically handle bank login visual random digicode,

Recommendation for such external integrations: Woob

Best flight prices

image

List daily best flight prices in the upcoming weeks for some preferred destinations.

How it works ?

  • basic scrapping (scrapping script not included in this repository),
  • PHP command to extract the best flight price for each destination,
  • building of a final Magic Mirror module file

Example of automatically generated JS module

Example of extracting command for the scrapped data

About

Raspberry Pi Magic Mirror project, fully customized with AI, voice and scrapping features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published