WhatsApp-controlled LEDs

Fifteen-year-old Ali Edis likes to tinker with Raspberry Pi to learn more about machine learning and artificial intelligence. He’s using WhatsApp to control some of his builds.

How does it work?

Ali’s Python code opens WhatsApp in a browser and waits for the user’s login confirmation. Once the user has logged in, it kicks into gear. The software captures the last message in the chat selected by the user, and generates its own replies based on what it reads in the message.

It works similarly to customer service chatbots, by guessing what the most appropriate answer is. So if the user types “Hello,” they’ll get a WhatsApp message back saying, “Hi, how can I help you?”

whatsapp controlled LEDs

The LED portion of the build is also controlled by WhatsApp messages. The software can control each individual LED, and it turns the lights on and off based on the commands the user types into WhatsApp. You can ask the software to turn them all on or off, or you can specify whether each individual LED should be on or off by typing a string of zeroes and ones, where each character represents the state of one of the LEDs.

whatsapp controlled LEDs
Hi Ali!

Ali made some WhatsApp-controlled fridge magic too

This is another cool project we liked from Ali. Here, WhatsApp controls another Python machine learning application to identify different foods in your fridge and tell you how many calories they contain.

Ali has done a lot of projects like this. Subscribe to his YouTube channel to go down a machine learning rabbit hole.

Want to have a go at machine learning?

It’s not as hard as it looks. You could get started as a complete beginner with the Raspberry Pi Foundation‘s free FutureLearn course, Introduction to Machine Learning and AI.

If you think you have the basics down and you’re ready to really get going, you could try Adafruit’s BrainCraft HAT which was developed specially to be used with Microsoft’s Lobe tool on Raspberry Pi. Read about how the HAT and Lobe work together here.

adafruit lobe kit
The full Microsoft Machine Learning Kit for Lobe with Raspberry Pi 4


G Hughes avatar

Yes, I’m using Telegram as a bot (on a Pi) to control/monitor a few home automation things wherever I may be. Works really well.

Supra avatar

I’m gonna to try it. Thank!

Supra avatar

Btw, Can u show us how to get scan the code?

Comments are closed