I recently watched a video, linked below, from YouTuber Tom Scott, about ideas that he never got around to developing. One of these was for a system that guaranteed a watched pot would never boil - by having a camera that looks for faces, and turning off the pot if one is found looking its way.
It was after watching the video I uttered the most murphy-inducing words - "This should be easy!"
I decided to use a kettle, as I don't have a electronic hob kicking around. Should be easy enough right?
The switching and electronics side of things was simple - a remote control 433MHz outlet, an Arduino and a 433MHz transmitter. Combined with some code from a previous home automation project, I had the hardware taken care of. The program, running on a Raspberry Pi with connected camera, connects to the Arduino via USB serial, and simply tells it when to turn on and off the switch. The image processing is done on the much beefier Raspberry Pi 3.
The image processing itself is done with OpenCV and the default front facing facial recognition haar cascade. It grabs a 320x240 image from the Pi camera, converts it to greyscale, and then calls OpenCV on the result. I had originally used a much more complicated deep learning based library, which was more reliable but much slower at processing the images, making it less useful for this application.
After a few failed starts, it worked a treat! A video showing it in operation is at the end of this post. The entire thing was held together with Bluetak and a prayer, but it worked well enough to demonstrate the concept.
As always, code for this project can be found on my GitHub account, here