Raspberry Pi Mood Light Changes Color by Detecting Your Emotions

Raspberry Pi
(Image credit: Mohammad Reza Sharifi)

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.

Ash Hill
Freelance News and Features Writer

Ash Hill is a Freelance News and Features Writer with a wealth of experience in the hobby electronics, 3D printing and PCs. She manages the Pi projects of the month and much of our daily Raspberry Pi reporting while also finding the best coupons and deals on all tech.

  • bit_user
    I tend to have a poker face, most of the time, so it probably wouldn't work on me.

    It would be better, if it could sniff neurotransmitters in your vicinity. I don't know if this is even possible, but just maybe? Otherwise, perhaps it could use things like pulse, breathing, body temperature, and perspiration as cues.

    BTW, the parts list says nothing of what's required on the PC, but presumably it's got a web cam and needs a CPU or GPU of a certain capability to analyze your face. I'm somewhat disappointed that all the Pi is apparently doing is changing the light color.
    Reply
  • einheriar
    Mine will mainly show different shades of red from anger. sometimes clearing up with shades of laughter..
    Reply