Control the microphone on your next call with a Starfleet issue combadge.
The Genesis of the idea ;)
I've long loved Star Trek, from Kirk and co boldly going around the quadrants, to the latest iteration in Star Trek Picard (I've not seen Lower Decks yet). I am fascinated with the technologies and science that make up this rich universe. The most interesting of which is the communicator.
Yeah, from a flip out communicator used in The Original Series, to the combadges worn in future series. The communicator is used to talk to the ship, locate lost crew members and as a gambling chip in historic America.
Where are you going with this?
I collect combadges, I have done since I was a kid. My latest badge is from Picard and it is all metal.
Right now we are all talking over video. Google Meet, Jitsi, Discord, Slack and we all need to remember to mute and unmute our mics. What if we could do that The Starfleet way?
To use my combadge to control the microphone on my webcam during a Google Meet call. To do this I will use an Adafruit Circuit Playground Express, a great little board to hack around with.
For the project you will need
- A Circuit Playground Express
- A croc clip
- A Starfleet issue combadge (all metal) or make your own with foil and card.
- A computer
- Nicholas Tollervey's Mu editor
The circuit for this is super simple. Using the crocodile clip we connect one of the metal pins to A1 on the Circuit Playground Express.
Setup your Circuit Playground Express
The Circuit Playground Express works with Circuit Python but it needs an update to make it work. Follow the guidance on Adafruit's site before moving on.
All of the code for this project is written in CircuitPython, a fork of MicroPython which is Python for micro controllers.
I used Nicholas Tollervey's Mu editor to write the code as it works beautifully and detects CircuitPython devices as standard. Plug in your Circuit Playground Express and Mu will ask if you would like to switch to Adafruit CircuitPython mode. Click yes and it will open a file called code.py which is on the board.
The first few lines import a series of modules. The first treat the Circuit Playground Express as if it were a USB Human Interface Device (HID), then we import the time module to add a means to pause the code, then we import a library to interact with the Circuit Playground Express and rename it to cpx.
import usb_hid import time from adafruit_circuitplayground.express import cpx
From the HID module we import classes to emulate a keyboard and special keys.
from adafruit_hid.keyboard import Keyboard from adafruit_hid.keycode import Keycode
Next we create a keyboard object that we shall use to send the keyboard input.
kbd = Keyboard(usb_hid.devices)
On to the fun part! Here we use a loop to constantly check if the combadge has been pressed. If it has, the capacitive touch sensor of the Circuit Playrground Express will detect the touch and report that it has been touched. A pause of 0.1 seconds prevents accidental double presses.
while True: time.sleep(0.1) if cpx.touch_A1:
When the combadge is pressed, it will press two keys on the "keyboard" CTRL + D which is the hotkey to mute a microphone in a Google Meet.
The last two lines of code will check for the user pressing the combage. If they are still touching the badge then the code will continue on and ignore any other touches until it receives a signal to say that all is clear.
while cpx.touch_A1: pass
Complete Code Listing
import usb_hid import time from adafruit_circuitplayground.express import cpx from adafruit_hid.keyboard import Keyboard from adafruit_hid.keycode import Keycode kbd = Keyboard(usb_hid.devices) while True: time.sleep(0.1) if cpx.touch_A1: kbd.send(Keycode.CONTROL, Keycode.D) while cpx.touch_A1: pass
Save the code
Click on Save to save the code to your Circuit Playground Express. Unplug the Circuit Playground Express from your computer, put the badge on and then start a call on Google Meet. Plug in the Circuit Playground Express and tap your combadge to mute / unmute your call.