Zoom/Microsoft Teams Mute Button using CircuitPython

I wanted to create a simple project using Adafruit’s new QT Py microcontroller and CircuitPython. I decided to make a simple mute button for video conference tools since I spend a lot of my work hours in meetings using either Microsoft Teams or Zoom. There have been many of these made since the start of the pandemic, including the PyRuler version featured in an Adafruit learn guide, but I wanted to make a smaller single button version that could work with multiple applications.

Parts

3D Printed SnapFit Enclosure

I followed Noé Ruiz (@ecken) Layer by Layer tutorial below to make a circular SnapFit case to hold my project (STL/Fusion360 Files). There are several things that could be improved in this design, but it is a start. The Fusion360 file has User Parameters if you want to change the diameter or the height of the enclosure. I printed my enclosure using semi transparent PETG to enable the user to easily see the color of the onboard neopixle. This is helpful for knowing what application/shortcut is active.

Wiring

The fritzing schematic is below. Please note that the button I used didn’t have a NC connector, but I couldn’t find a similar part in the fritzing library.

Code

Below is the code for this project. Modify the controller_buttons variable to add or remove applications and shortcuts. The current code is made to work using Microsoft Teams and Zoom on a Mac. The keycode for each application/shortcut would need to be modified if you are using Windows or Linux. The color updates the neopixle on the QT Py to allow the user to know which application/shortcut is active. I used purple for Teams and blue for zoom.

Please see Adafruit’s Primary Guide for setting up the QT Py with CircuitPython. You will need to copy the following CircuitPython library files over to your QT Py as well.

  • adafruit_hid/keyboard
  • adafruit_hid/keyboard_layout_us
  • adafruit_hid/keycode
  • neopixel

The strip_xattr.sh script is very helpful if you run into problems copying the required library files over to the QT Py on a Mac. For more information about this issue see the Adafruit Forum post from user aaaidan.

Use

  1. Plug it into your computer.
  2. Press the button to activate the active application’s keyboard shortcut
  3. In order to change the keyboard shortcut that is active, hold down the button until the onboard neopixel changes colors

Please note that the led on the arcade button is currently set to toggle every time it is pressed. It is up to the user to manually sync it to there current application if they want to use it as an indicator if they are currently muted or not. Comment out the every line that has button_led if you want to use a button that doesn’t have an LED on it. Also, the Teams or Zoom windows has to be in focus for the button to work.

All code and 3D models are available via the Github Repository: https://github.com/jfurcean/CircuitPython-MuteButton

Special Note About Cura

I noticed that my QT Py was constantly resetting/not working while I was working on this project. It turns out that Cura was trying to “talk” to the QT Py and this was preventing it from working. Everything worked as expected once I closed Cura and reset the QT Py. I found this Github issue related to other CircuitPython boards that were having this same issue.

Installing OctoPi-TFT using the OctoPi Image

This tutorial uses vi to edit files this can be replaced with nano or some other text editor.

Parts

Step 1: Connect the PiTFT to the Pi

You can connect the PiTFT before you start any of the other steps.

Step 2: Install and Configure OctoPrint

Follow the instructions form the OctoPrint website https://octoprint.org/download/

Step 3: Install Raspbian Desktop

sudo /home/pi/scripts/install-desktop

sudo reboot

Step 4: Install Dependencies

sudo apt-get install xinit
sudo apt-get install x11-xserver-utils
sudo apt-get install xserver-xorg-input-evdev

Step 5: Move 40-libinput.conf

sudo mv /usr/share/X11/xorg.conf.d/40-libinput.conf ~/

Step 6: Install PiTFT Drivers

Use the Easy Install method that Adafruit supplies

We’ve created a custom kernel package based of off Notro’s awesome framebuffer work, so you can install it over your existing Raspbian (or derivative) images in just a few commands. Our tutorial shows you how to install the software, as well as calibrate the touchscreen, display images such as from your PiCam and more!

Adafruit
cd ~
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
chmod +x adafruit-pitft.sh
sudo ./adafruit-pitft.sh
  • For the 3.5″ PiTFT select #4
  • If you want the HDMI port on top like I do select #3
  • Would you like the console to appear on the PiTFT display? No
  • Would you like the HDMI display to mirror to the PiTFT display? Yes

Step 7: Uninstall Lightdm window manager

sudo dpkg -r --force-depends lightdm

Step 8: Install OctoPi-TFT

cd ~
wget https://github.com/darksid3r/OctoPrint-TFT/releases/download/1.1/octoprint-tft_stretch_1.1.git91fa718-1_armhf.deb
sudo dpkg -i octoprint-tft_stretch_1.1.git91fa718-1_armhf.deb

Step 9: Edit OctoPi-TFT Configuration File

Edit you configuration file.

sudo vi /etc/octoprint-tft-environment

This is what mine looks like. You will need to change the OCTOPRINT_APIKEY to match yours. It can be found on the settings page in OctoPrint. I also removed the comments from here so it is easier to read.


OCTOPRINT_CONFIG_FILE=

OCTOPRINT_HOST=http://127.0.0.1:5000

OCTOPRINT_APIKEY=YOUR_APIKEY_GOES_HERE

OCTOPRINT_TFT_STYLE_PATH=/opt/octoprint-tft/styles/default/

OCTOPRINT_TFT_RESOLUTION=480x320

Step 10: Reboot & Test

sudo reboot

Step 11: Check /boot/config.txt

You can disregard this step if everything is working as expected. My display resolution wasn’t correct so I had to change the last line of the /boot/config.txt file from hdmi_cvt=720 480 60 1 0 0 0 to hdmi_cvt=480 320 60 1 0 0 0.

sudo vi /boot/config.txt
sudo reboot

Resources

I used these resources to put together this tutorial.