When the coronavirus pandemic starts, many companies around the world sent their collaborators to work from home and many of us were not prepared for that.
I had never make so many meetings like now. As we cannot call someone close to do something together, or just say something to team, I am using lot of my time in meetings, syncing the work with my team, or discussing with other people to improve our solutions.
I am a software engineer and I have a small boy that runs all home and scream me at some moments. How could I avoid switch manually the mic on meeting app to answer my son, or my wife? Most of time I was getting confused if the mic was open or not. It should be simple, but was getting me crazy.
So I remind I have an old racing wheel with pedals and I think, why not get a cool usage for that?
I opened the pedal and I noticed that the electronic was very simple. It was just a variable resistor, when you push the pedal, it increases the resistance. Just it!
Using an arduino nano, I could be able to read this, right? Well, not exactly. The arduino is not able to read resistance, so I need to convert the resistance variability to voltage variability, then I can read it on arduino using the analogic ports. It is simple to do, we just need to make a small circuit with a resistor.
At this moment I am sending a 3.3v signal on a cable to pedal and reading the result on the other cable. The arduino converts the voltage signal to a value that varies between 0 and 1024.
As I have two pedals, I did the same for both (left and right) and pushed the converted values to serial, but only when one of the values change.
On my linux, I created a python script that reads the serial port and convert the values on commands.
This is the expected behavior:
- The mic starts mute
- When a push the right pedal to end, the mic is opened
- When I remove my foot from right pedal, the mic is mute again
- When I remove my foot from right pedal with the left pedal pushed to end, the mic continues open, to mute again is just push and pull the foot on right pedal.
Now I can use any kind of mic during meetings… a headset, a bluetooth headphone or the laptop’s integrated mic, All of them work with this logic.
It was awesome! Simplified my life! But I got another requirement. How could I trust if it was really working? How could I get a visual information if mic was open or mute?
So, as I am using an extremelly customizable window manager on my linux ( i3wm) and using a customizable application bar called polybar. It was easy to get the linux mic status and show on screen.