I recently sifted through my bits and pieces of electronic things and thought about the last electronic project I made a year ago or so (a basic chord device). I started thinking about more projects I could possibly do and then it happened;
I saw a video by Benn Jordan, a musician and content creator. His video is about 6 Amazing Instruments from the Guthman Awards. I was so inspired and while obviously I couldn’t match the expertise and engineering years that have gone into the development of those instruments, it spurred the old idea machine in my head.
I was perhaps too rigid in my thinking for using microcontrollers for music. After seeing the video I had a couple of ideas (one of which is an art installation of all things). The idea I chose to pursue this time is a midi controller that sends CC values based on information gathered from a gyroscope.
The experience I’m aiming for is somewhat of either a bracelet or palm device thats strapped to your hand, and while the user is performing, they can switch on or press a button to send MIDI CC values like the filter cutoff and maybe like the release value of whatever synth chosen.
First things first, I decided on what device to use, I have a spare Raspberry Pi Zero and some Pi Pico’s as well but I ended up ripping out a teensy from a long failed project (a midifighter clone) and using that.
Wiring up the 5-pin midi out
Another reason I chose the Teensy is because they had pretty clear instructions on how to wire 5-PIN MIDI out up with a simple example code on their website. Finding something like that was a quest for the PICO and while I am still planning on using the picos, it was very much appreciated that the documentation was easily there. No hunting around for the right libraries for anything. It just worked.
I used veroboard to wire up the midi-out jack because (at least for me) plugging in a 5-pin midi jack is like one of the toughest things to plug in, there’s just a lot of resistance and I know that if I plug and unplug enough it might cause the pins to come loose and maybe do some damage to whatever synth I have hooked up. So, soldered that socket in and now there’s considerably less anxiety for me.
Hooking up the gyroscope/accelerometer and also thermometer apparently?
For the gyroscope I ordered a couple of the closest/cheapest ones I could find. My searches led me to the MPU6050. A low-cost gyroscope/accelerometer/thermometer. It combines the gyro and accelo to give accurate readings (I’m working on the accurate readings part).
After soldering the MPU6050 onto the header pins it came with and attaching it to the breadboard with the Teensy and hooking it all up I ran through the example scripts given with the library. Sure enough the example scripts were easy peasy to get working and in about 10 minutes I was receiving data from the MPU6050.
Speedbumps and the like so far;
So obviously, any endeavor worth doing isn’t going to be a walk in the park, I got the midi out working, as well as the gyroscope. A beginner maker such as I would assume ok, just, normalize a specific reading, like pitch and turn it into a basic integer number that will consistently be updating a CC value variable to be sent to the synth.
Well… so the readings from the MPU6050 are shaky, even with rounding the numbers and me doing my best to hack something of an error filter. All in all, the device works in a sense but it’s so nasty. I set the CC value to send to start at 70 (they’re usually 1-127) and from there update the CC value to send to the synth. It works but every now and then a random reading comes in from the sensor that’s just way off and sends the CC Value to either 0 or 127 creating these huge jumps in whatever I’m trying to modulate with my hand.
I am not an engineer or programmer. I forget that the sensor isn’t magic and uses physics and reality isn’t so clear cut. After some digging, I found this article about the sensor written by someone who truly knows what they’re talking about.
I’ve only skimmed it but in the article is example code that uses formulas that cross-references the readings of the sensor on each other to receive much cleaner and precise readings. Now that I think about it, the reason this sensor is supposed to be precise is because it uses boththe Gyro and Accelerometer to be more precise. I kind of thought it did itself but I really should not expect electronic stuff to be so plug-n-play.
So that’s where I am at with this MIDI-CC bracelet-thing. I need to study up and learn what I can for smoothing out readings. Until next time!
Leave a Reply