logo

gertjanassies.dev


ramblings of a chaotic mind

All those online meetings - part 1

on 2021-06-19 by Gertjan Assies reading time 0 min, viewed 27 times, read 0 times, liked 0 times

All those online meetings - part 1

Or how to find an excuse to play with a Raspberry Pico.

While on a not particularly interesting online meeting, my eye fell on the Raspberry Pico that I ordered and had just arrived that morning.
After more than a year working from home, I got into the habit to mute my audio when I’m not speaking and in large meetings or perceived bandwidth issues, I disable my video. enabling both again when I need to speak.

Now, what if I could add a couple of buttons to the Pico to make those tasks a little easier.

Add another button to switch between hangouts/zoom/teams and I should be good to go. thus making the pico into a 3 button keyboard.

The Pico or more specifically the RP2040 is a $4 microcontroller board that features a dual-core Arm Cortex-M0+ processor with 264KB internal RAM and support for up to 16MB of off-chip Flash. I2C, SPI, and programmable I/O. making it more than suitable for this small project.

RP2040 pinlayout

A quick search on the internet revealed an AdaFruit library that would turn the Pico into an HID (Human Interface Device) which would make it a keyboard when plugged in the USB port. that library also came with a tutorial for a 21-key keyboard, which I used extensively in this little project. (no point in inventing the wheel again)

The tutorial also contains custom parts for the RP2040 and the Cherry MX buttons to be used in Fritzing, a simple tool to create schematics and PCB’s.

Hardware

Schematic

So simply adding 3 switches to 3 GPIO ports, in the software, we can define them as input with the internal pull-up resistor which will make them work correctly.

Switching to the PCB view in Fritzing, placing the components and routing the switches to the pico and creating a copper fill for the ground connections resulted in the following PCB:

PCB

Fritzing also supports exporting to Gerber files. which u can use to create your PCB’s or order them online. this process could not be easier, upload the Gerber files, visually check them online and press the order button.

I used OSHPark for the first batch (you need to order a minimum of 3 PCB’s), they deliver a great product, but it takes around a month to manufacture and ship from the US to the Netherlands, costs were around $25 which is not bad.
For the second batch, I’m trying out Aisler, which originates in Germany, and is cheaper (12 euro for 3 boards) and should be here in less than 2 weeks.

To program the Pico with Micropython, it always consists of resetting it with the bootsel button pressed which will make it show up as a removable drive on your system then copy/drag over the necessary files and that it, details are in the adafruit tutorial I’ve linked above and in the references.

Software

All the software, design files can be found here:
https://gitlab.com/gertjana/conference-buttons

I’m using Mu Editor, it’s not the best editor, but it supports the Pico board and the circuit python bootloader to directly program on the Pico.

One thing in the code I want to highlight to show the versatility of the Pico:
to be able to use the GPIO’s as seen in the schematic, they need to be set up as inputs with pull-up resistors

This allows you to program almost every pin, as digital in or out, analog, PWM, I2C, SPI, UART, making it very versatile to many use cases.

The rest of the code just loops forever, scanning the keys 10x a second and when pressed lookup the correct keyboard shortcut to send over the USB connection.

Conclusion

This approach demonstrated here (with the help of the good people at Adafruit) lends itself to creating custom keyboards for all kinds of situations, up to complete cockpits for flight simulators or other game-specific keyboards.

The Raspberry Pi Foundation clearly has a winner here, a very cheap versatile microcontroller with the power of the dual-core Arm M0 and good support from a lot of manufacturers like Adafruit and others making it an in my eyes one of the best options out there for small DIY projects and education purposes.
I can’t wait to have my niece and nephew solder one together for their online school lessons, as I have still 2 of the 3 boards left.

Continued in Part 2: All those online meetings - part 2

References

Opinions expressed here are my own and not the views of my employer or anyone else, (re)use is free, but quoting the source is appreciated.
This blog is licensed under a Creative Commons Attribution 4.0 International License. © 2023 by Gertjan Assies