Back in the 90’s, the 1990’s, I used to be a late-night radio show host on Froggy. I was known as Jeremiah Bullfrog. When I left the radio business to start my own software company, Troy, the head engineer, gave me a parting gift – an ‘On Air’ light. Our company had remodeled and consolidated studios and lots of surplus gear had accumulated. I had the On Air light on my office shelf for over 20 years. With the recent events, I came up with a project to put the On Air light to use.
Along with the rest of the world, I have been working at home for the past couple of weeks. All of my meetings are now online/virtual ones and we use Microsoft Teams and Zoom. We also use video to better facilitate a connection and help us focus on the meeting. The camera that I have doesn’t have a light indicator showing whether it is in use. So, I put two and two together and come up with a remote controllable ‘On Air’ light for online meetings. It was the perfect project to entertain my three-year-old for a few hours. He was delighted every time the light turned on.
George and I ripped apart a Sunbeam Touch Light that I got for $1 in a surplus sale. This light had a strip of LEDs, a controller, and a power supply. I just added an ESP8266 module and connected it to ThingSpeak using my tutorial that I published a few years ago. I wrote a little Visual Basic.NET script based on a project that I found on CodeGuru to detect whether or not the webcam was in use or not. If it’s in use, the script sends a signal to ThingSpeak to turn on the light.
I have been getting requests for the code to detect my webcam usage. I did have a cobbled together Visual Basic script that detected if my camera is in use or not and set the state of my On Air light accordingly. This approach was not very accessible, so I rewrote this in Python using OpenCV. Just run this code on a periodic basis to track the state of your webcam.
The code to track my webcam state and upload the state to ThingSpeak is now available on GitHub.
Most of the magic is here:
def returnWebcamStatus(webcamIndex): webcam = cv2.VideoCapture(webcamIndex, cv2.CAP_DSHOW) if webcam.isOpened(): webcam.release() return True #Webcam not in use else: return False #Webcam in use