Programming

The TV listens to you and thanks to Raspberry Pi it generates quality images

The TV listens to you and thanks to Raspberry Pi it generates quality images

The cards Raspberry Pi they certainly need no introduction: they are small, low-cost devices that have found applications in a wide range of sectors. They are ideal for projects prototyping and for electronics enthusiasts who want to create custom devices, such as home servers, weather stations, automation systems and much more. THE single-board computer Raspberries go far beyond educational uses: they can be used to host desktop applications, web servers and are widely used in the world of the Internet of Things (IoT).

They are excellent tools to assist in the creation of smart devices and interconnected, such as monitoring sensors, security cameras and solutions for smart home. Thanks to their ability to video playback high definition, Raspberry Pis are often used to create multimedia devices such as media centers or streaming systems for playing audio and video content.

Lumina: the TV listens and understands the user’s speech by displaying the images generated on the Raspberry Pi board

Among the projects that arouse the greatest wonder is the new one Light AI Art Generator. This is an experiment that combines the potential of a Raspberry Pi 4 board with the generative model DALL-E 3 by Microsoft and OpenAI.

By connecting the Raspberry Pi to a television via the HDMI port and saying a “magic word” aloud (in this case it is “Lumina“), it is possible to request the image generation of quality, starting from the accurate vocal description provided. Take a look at this video posted on YouTube: it shows what you can achieve by making your own project.

Image generation with AI and Raspberry Pi

Yes, because the Lumina team has published all the information on GitHub to carry out the project on your own: in addition to the Raspberry Pi board, it is sufficient to equip yourself with economical components such as a USB-C 5.1V 3A power supply, a compact omnidirectional USB mini microphone and finally a micro HDMI to HDMI cable to connect the single-board computer with the television.

If you prefer to use a normal HDMI cableto connect one end to the Raspberry Pi you can use a micro HDMI to HDMI adapter like this one.

Finally, the authors of Lumina suggest applying a heat sink over the SoC Broadcom that stands out on the Raspberry Pi: in this way it is possible to avoid any phenomena of thermal throttling in case of particularly demanding workloads.

Il Vocal recognition it is managed using the Picovoice open source project. Differently than the digital assistants that we all know, like Alexa, Google Assistant and Siri, Picovoice it can also work locally, without exchanging any data on the cloud.

Lumina with OpenAI and Picovoice

How to set up Raspberry Pi for speech recognition and image generation

After having equipped yourself with all the hardware equipment required, you can move on to creating an OpenAI user account (click Login top right) and an account on Picovoice. In both cases, you need to get and write down the secret key which will be used to communicate with both platforms.

The next step is to install the operating system Raspberry Pi OS 64 bit, with Raspberry Pi Imager software. The Lumina team recommends selection Raspberry Pi OS (other) Therefore Raspberry Pi OS (Legacy, 64-bit). At the moment, in fact, Raspberry Pi OS Bookworm is not perfectly compatible with the project.

At this point, simply follow the instructions in the Lumina guide (PDF format).

As a first step, Lumina modifies the contents of the file ~/.bashrc to specify one environment variable (PATH) useful for indicating where the operating system and Python should look for executables and configuration files.

The software steps to set up your Raspberry Pi device and activate its “ears”

Next, you need to enter a series of instructions to manage the software dependencies essential for the project and proceed with installing the Python packages on the Raspberry operating system. The various commands are responsible for updating the Python package manager (pip) to the latest version, enable Microsoft TrueType fonts, enable the X server management utility (graphics system), provide support for Tkinter within the images processed by Python Imaging Library (PIL), they install the Python package pyaudio (provides a Python interface for PortAudioallowing the use of audio).

The subsequent activities involve the installation of pvrecorder come voice recorderOf pvporcupine for the Vocal recognition of the activation command (“wake word“), Of pvcobra, pvleopard and the Python package schedulewhich provides scheduling functionality for executing commands on a periodic basis.

In the end, pip3 install --upgrade openai update the package Python OpenAI to the most recent version, ensuring the use of the latest features integrated into the library.

AI voice command generation

Cloning the GitHub repository and starting speech recognition

After some minor changes (the guide explains how to hide the mouse pointer on the screen, after a period of inactivity: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart and adding the line @unclutter -idle 5), it’s finally possible clone the repository Lumina GitHub (git clone https://github.com/DevMiser/Lumina.git) then add your OpenAI and Picovoice secret keys inside the script Lumina.py.

Lumina’s GitHub repository also contains the models in format STL to 3D print the case to be used to insert the Raspberry Pi board and create a real living room device, intelligent and governed by AI.

Once the Raspberry Pi board has rebooted, running the script (python3 Lumina.py), the. should appear on the TV logo Lumina and the system should listen for the “magic word”.

At this point you can start create magnificent works of art through voice control, viewing them on any television with an HDMI input.

The images published in the article are taken from the video shared by Lumina.

Leave a Reply

Your email address will not be published. Required fields are marked *