This Raspberry Pi-Powered Light Control System Uses Computer Vision to Adjust a Desk Lamp

Rather than a simple photoresistor, this lighting control setup uses a camera module and the user's choice of PIL or OpenCV.

Pseudonymous maker "Sindhu" has put together an ambient lighting control system, dubbed Sirius, powered by a Raspberry Pi 4 with an Arducam camera module attached — and supporting both standard and dimmable lamps.

"The purpose of Sirius is to adjust ambient lighting," Sindhu explains. "Sirius controls lighting by periodically taking a photo and calculating levels of brightness in the image. Then the lamp near my desk is turned on if the ambient brightness drops. The lamp is also turned off when the brightness hits the max threshold. Why is this important to me, you ask… because I prefer working in a well lit (mostly bright) environment."

This smart lighting setup leans on camera image analysis via PIL or OpenCV. (📹: Sindhu)

While a Raspberry Pi and a camera module might seem overkill for an ambient light monitoring project — "I first started with photoresistors," Sindhu explains, "but I really wanted to use a mini cam[era]" — it's undeniably effective: Still images captured from the camera module are analyzed, using either the Python Image Library (PIL) or OpenCV, for brightness levels, which are then used to drive a connected lamp.

On the lighting side, two versions were built. The first uses a standard, non-dimmable lamp connected to a TP-Link Kasa smart plug and addressed using the python-kasa library; the second uses a dimmable Mi smart LED lamp and the python-miio library, allowing for direct control over brightness rather than a simple on-off binary.

The system also works with smart lamps, offering finer-grained control beyond simply on-and-off. (📹: Sindhu)

"I started off using our existing lamp which was connected to the outlet via a smart plug," Sindhu explains. "But then I realized that I wanted to also try the same approach with a dimmable lamp. Luckily I already had one — and by I, I mean my husband had one. Much to his dismay, I ended up using it for this project."

Full details on the Sirius project are available on Sindhu's build log.

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