Facial Recognition Candy Dispenser Only Gives Out Treats to a Chosen Few
This ESP32 project is a sweet way to explore AI!
Vladimir Janjiš found a candy dispenser on Aliexpress, which features contactless hand detection via an IR emitter/receiver. While a neat device, this wasn’t quite good enough for Janjiš, who augmented the dispenser with an ESP32-CAM board for facial recognition.
The device's new ESP32-CAM module and OV2640 camera monitors people as they approach the dispenser, using a neural network to pick out familiar faces. If it sees the correct person, candy dispensing is enabled by a relay, and when a hand is placed in position it then spits out treats. There's also a small OLED display for feedback, and it can even interact with home assistant via MQTT.
The hand proximity detection is kept largely intact for this build. Importantly, this circuitry includes an LED that lights up when the motor is activated. This light is sensed through an LDR that's part of the add-on circuitry, providing a form of opto-isolation between new and stock electronics.
With the device’s newfound intelligence, it doesn't have to simply dispense for known persons, but can set up more granular rules. For example person A may get 5 candies a day, while person B might only get 1. Although this might seem like an interesting and/or cruel social experiment, the lid can also be opened by simply untwisting it if needed!