I built and automated something today!
IT professionals certainly do!
Mine has a cover but I sometimes forget to close it.
And, I have another problem with regards to the webcam⊠My workstation is by a wall, so my ceiling lights are all behind me.
That means my head looks like a dark blob, unless I turn on the four bright lights in front of me on the shelf.
So, what if I could automate things so that the lights come on automatically any time the webcam is on?
Iâve been looking for a way to detect programmatically if the webcam is on for a while. The only way I know is by looking up the device ID in device manager, and searching for it in Process Explorer. That shows what process is using it (if active) but itâs really a âsearchâ â CPU intensive and slow. Not good for continuous monitoring.
Finally, a couple of days ago, I realized thereâs another way to solve it. Why not just measure the power consumption of the webcam? Surely it uses more power when itâs active?
Time to get to work!
Thatâs an ESP8266 microcontroller (with wifi) and a ACS712 current sensor board.
Then, after some software magic:
Success! Lights turn on automatically whenever the webcam is on. So, now people can see me, and thereâs no need to cover the webcam anymore â if itâs on, Iâll know!
Updane: I had to make some revisions. At first, I was powering the ACS712 and the ESP8266 (NodeMCU) from the same USB 5V source as the webcam (before the current sensor, obviously). However the webcam caused enough of a current draw for the value to read negative when the webcam was activated. I modified the design to take power from a separate USB connection, so that the webcam no longer affects the power supply of the circuit, and now it works much better. Iâm also now reporting the actual power consumption in milliamps too.
Man I love this stuff.