Automating lights with Computer Vision & NodeJS

A smart Computer Vision and NodeJS based solution that turns off the lights when not in use, and saves power.

Mudassir H
Dec 6, 2019 · 5 min read
Photo by Henry McIntosh on Unsplash

The Challenge

It is common to see visuals in homes and offices with illuminated spaces having few people or none in the near vicinity.

So how do we address this?

While there are a lot of smart control and automation solutions available in the market, most solutions require additional hardware to be set up at regular intervals and lead to additional maintenance costs.

Our response

The solution is to express our intention of saving energy through the eyes of a computer — through Computer Vision.

“Computer Vision, often abbreviated as CV, is defined as a field of study that seeks to develop techniques to help computers ‘see’ and understand the content of digital images such as photographs and videos.”

— Jason Brownlee, in his article on machine learning.

To illustrate, just like an eco-friendly person, who looks out for illuminated rooms or spaces, that are unoccupied, to turn off lights, our system will be programmed to do this automatically. The system will look into the incoming stream from the camera, which is essentially the field of vision of the camera. Each captured frame is divided into 4 quadrants. And if there are no people in a particular quadrant, the lights belonging to that quadrant will be turned off.

Steps to implement

  1. Import required libraries.
Since people are present in Quadrant 2, the system lights up only quadrant 2


This is one of the many examples to show how technology can be used for the betterment of the planet, by saving energy. You can also learn how to solve a common workplace challenge through this simple implementation.

Love as a Business Strategy

A modern lens on tech, workplace culture, and brand.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store