RGB lighting is cool, but choosing a color can be challenging. Why not let AI decide if you’re having trouble settling on a color? That’s precisely what maker and developer Mohammad Reza Sharifi has done with his latest Raspberry Pi project. In this case, Sharifi is using AI to detect emotions and change the color of an RGB light based on the detected emotion.
The processing starts on a separate PC running Microsoft VS Code and handles the AI processing using OpenCV and Deepface library. Sharifi uses a video slideshow with pictures of different emotions to demonstrate the project. The PC determines what emotion is likely being conveyed and then sends a command to the Pico to change the color of the light.
This is one of many projects put together by Sharifi that we’ve had the pleasure of featuring. He has plenty of experience working with the Pico, like in this Pico surveillance robot project, and with OpenCV. He recently created a project that recognizes hand gestures to control a light. Given his history, it’s no surprise he created the clever project we have today.
This project doesn’t require much hardware to duplicate. You’ll need an RGB light of some sort. Sharifi uses a WS2812 5050 Adafruit NeoPixel Ring, but any RGB light will do in its place. A separate PC is necessary for the AI processing side of the project, and a Pico W is used to control the RGB lights. In this case, a Pico W is chosen for its network support.
The primary language used to program this project is Python. He’s using a custom Python script to operate OpenCV alongside the Deepface library. The Pico W communicates with the PC and RGB LEDs using MicroPython. All of the code used in this project has been shared to Hackster by Sharifi for anyone who wants to check it out for themselves.
To see this Raspberry Pi project in action, you can check out a demo video shared by Sharifi on YouTube. You can also explore the project in greater detail over at Hackster to see more details about how it goes together.