THUNDER VISION: A SMART ELECTRICITY MANAGEMENT PROJECT THAT HELPS MITIGATE REDUNDANT ELECTRICITY USAGE USING COMPUTER VISION IN CCTV CAMERAS

 This is a project I built with my friend: Abhishek Jha as a part of an internship in under the AI/ML community in my university. The problem statement was that of reducing redundant electricity usage in classrooms and other office spaces in the university. For this, came to our aid, an already running project called Vision Insights that runs head-count on the CCTV cameras of the rooms. It uses a fine tuned YOLO model for the purpose of human detection. The model was trained on the images extracted from the camera footages. This runs on the RTX-4090 server situated in the makerspace of our university. 


The Electricity System 

So, we only needed to develop a system to remotely control the power supply to that room. To that end, I met the person in-charge of the electricity in our uni. And got to know some stuff about the MCBs of the classrooms. One thing was clear, we needed to use a device called contactor to toggle the supply on or off without even touching the MCB. 

A contactor

To control the contactor based on logic decisions, we needed a relay switch and we chose to use an SSR(Solid State Relay) as we found it suitable for our requirement. Further, we used a relay module to relay our signals to the SSR from the esp32. 

Solid State Relay

Relay Module

For the processor, we used an ESP32 because it can connect to network(more on that later). To optimize the size, we used the ESP12-E module. The whole system was to be powered though the main line, but as for the ESP, because we found the task of stepping down 220V daunting we, at first, thought of powering it with a combination of batteries and a buck converter module. But the thought of having to change the batteries in every 3 days! and that too of 2-3 circuits on every floor!! and 7-8 floors in every building💀💀 and 3-4 buildings ☠️☠️.... thankfully forced us to change our plans. We needed to power it through the main line itself, but for that- we needed to busk down 220V AC to 3-4V DC 🤡🤡. One way, was to get ourselves a half-wave rectifier, a small transformer, small resistor, and make ourselves a circuit that does this. OR.......... Break open a phone charger that does all of that for us.... So that's what we did 👻👻. We used the circuit of a phone charger adapter to take in the mains, and convert it to 5V DC, then use a buck converter to convert it to 3-4V DC. 
And at the end, this is the circuit we prepared: 
Circuits soldered by Abhishek bhai 🫡🫡

Circuit fit beside the room's MCB board


The Remote Control

To send the signal remotely, we create a code that mapped the rooms to GPIO pins with a dictionary. these GPIOs controlled the relay switches. We further developed an API URL which toggled the electricity supply when hit with the right parameters, that is: 

  • API Key(for authorization)
  • Room No. 
  • State: ON or OFF

In Our case, we integrated this API calling functionality in the head-count code that was already running on our RTX-4090 based server. The logic is simply- If head count != 0: Electricity supply ON, else: OFF.

And Voila! Here we had it. Within a span of 2 months of problem solving, we'd created a system to save electricity when not in use and accomplished a real-world problem too🤗🤗. Here are some clips of us testing it: 


An edited video of Us testing the system 

P.S. The complete code for the ESP32 side and the API Documentation is provided here.

Peace ✌️✌️


Comments

Popular posts from this blog

Lines of Code, Miles of Autonomy: The Autonomous car Project - Phase I

Capture the Flag (CTF) - The legendary event that never happened

Someone Else's sunlight