home cmama

prototyping microcontrollers with p5js

updated Feb 28, 2022

Last June (2021), I started getting interested in exploring physical computing after abuot 2-3 years of pure p5js fun! I didn't have a full sense of where to start, but was drawn to the Raspberry Pi Pico, a new microcontroller launched at the time. It's form and cost were important factors in choosing Pico over the Arduino line of boards.

It was any interesting start, as it was also my first attempt at soldering! Soldering is awesome and liberating.

I started the project by roughly soldering some wires to these keyboard switches which were an impulse buy! I learnt later that macropad enthusiasts are a league of their own and there are some extremely beautiful pieces out there!

A video log introducing my switches and the raspberry pi pico.

With the help of some amazing documentation on the Adafruit Learn Section, I was able to use the pico and the switches with Circuitpython. Of course, I decided to attempt some form ideas by reusing some packaging material I found at home.

I realised that Pico and Ciruitpython allows you access to the HID (Keyboard and Mouse) events on any computer with buttons, joysticks and even potentiometers. HID basically refers to any device that 'humans'/people use to connect with the computer like a mouse, keyboard, or even a game controller. So I jumped into this head first applying the HID commands to my existing projects in p5js with keypressed and mouse events. The project in the video is a generative text randomizer.

I started imagining my p5js sketches in full screen on large projectors but with these small buttons and peripherals, instead of the entire keyboard or mouse present at the installation!

With some digging around, it seemed apparent that HID works well with joysticks! Thumb joysticks are suprisingly inexpensive about Rs. 70 (a dollar or so). Once I was able to control the mouse with the joystick, I tested it with a sketch that had voice recognition. I find that its nicer to test voice with an essay or an article over just shouting "hello hello". I was reading this wonderful piece at the time and I recommend this others too.

Eventually I've progressed the prototype form to a small macropad case (although this wasnt my original intention), its easy to be swayed by the beautiful cases on the internet and build your own.

A cardsheet prototype for the faceplate

Thinking of a basic layout for the macropad

A 3d print that failed

A somewhat final case!! The hole is for the potentiometer

I had to 3d print an extra piece to add height for the components

some thoughts and texts here