Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!

This CircuitPython-Powered Smart Lamp Uses TinyML to Spot Faces, Match Colors

A DFRobot Huskylens smart camera and a Raspberry Pi Pico power this artificially intelligent RGB desk accessory.

Mononymous human-centered engineering student Leonard has put together a guide to building a CircuitPython-powered desk lamp with a difference: it features on-device artificial intelligence (AI) to vary its output when it detects a face.

"This project is the final project for a class at Boston College called 'Physical Computing' with Prof. [John] Gallaugher," Leonard explains of his creation. "In this project, you will be making a smart lamp using [a DFRobot] Huskylens AI and a Raspberry Pi Pico running CircuitPython."

This CircuitPython-powered "smart lamp" runs facial recognition and color classification models on-device. (📹: Leonard)

The 3D-printed lamp uses three key components: a Raspberry Pi Pico RP2040-based microcontroller development board, running the CircuitPython firmware, a DFRobot Huskylens smart vision sensor based on the Kendryte K210 system-on-chip with integrated neural processing unit (NPU), and a strip of Adafruit NeoPixel RGB LEDs. The idea: a lamp that can alter its colors based on the output of a tiny machine learning (tinyML) model.

Once assembled and flashed with Leonard's CircuitPython program, the Huskylens starts searching for faces through a hole in the lamp's lid. Once a face is detected using a computer vision algorithm running on the Huskylens, an idle animation on the RGB LEDs is interrupted for a smooth fade to white — then swapped out for a color-block classification algorithm, which fades between detected colors.

The project is documented in full, complete with source code, on Leonard's Instructables page.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles