Digits: a Microbit Bluetooth MIDI Controller Glove for IOS
by stmc6816 in Circuits > Microcontrollers
1010 Views, 2 Favorites, 0 Comments
Digits: a Microbit Bluetooth MIDI Controller Glove for IOS
This project will walk you through the process of building a Microbit/flex-sensor based Bluetooth MIDI controller glove for controlling iOS devices. The equipment and time needed to assemble this project is fairly minimal, and as you will see it is easy to add/extend this device with other kinds of input/sensors.
Supplies
- A Microbit microcontroller
- 4 wires
- 2 flex-sensors
- 1 battery-pack
- 1 glove
- 1 roll electrical tape
- 1 iOS device
Not Pictured:
- 1 soldering iron/flux (optional)
- 1 computer with an internet connection
- 1 USB cable PC->Microbit
Get the Code
Let's take a look at the code we will be running on our Microbit.
- Point your browser at the MakeCode page for this project and hit the Download button. This will download a microbit-MIDI_Controller_V2.hex file to your downloads folder.
Connect Your Microbit to Your Mac/PC and Flash
- Use a USB cable to connect your Microbit to your Mac or PC. Depending on your plaform you will see the MICROBIT mount to either your desktop (Mac) or My Computer (PC).
- Drag and drop the microbit-MIDI_Controller_V2.hex file on to the MICROBIT to flash it.
- You will see the yellow LED on the back of the Microbit flashing while the data is being written. It will be a solid yellow color when completed.
See the official Microbit page for more information about flashing your Microbit.
Set-up Your IOS Device and Pair It With Your Microbit
See the video above for instructions on how to pair your Microbit with your iOS device.
TROUBLESHOOTING: If you have issues getting your Microbit to connect to your iOS device after restarting it:
- Go to the Settings app on your device.
- Go to the Bluetooth section.
- Touch the (i) icon next to your Microbit.
- Press "Forget this device".
- Go to the Microbit app.
- Select "Choose Microbit".
- Touch the red trashcan icon next to your Microbit to forget it.
- Repeat the pairing process from the video.
Attaching the Flex Sensors to the Microbit: Part I
First, ensure your Microbit is disconnected from its power source and completely off.
- Solder or clip/tape 4-5" wires to each of the 2 leads on your flex sensors.
Attaching the Flex Sensors to the Microbit: Part II
Solder, clip, or otherwise attach the other ends of the wires to your Microbit as indicated in the photo. Make sure the orientation of the wires is correct before making any solders or your flex sensors will not work properly!
With the striped sides of the flex sensors facing up and the prongs at the top, solder the wires as follows:
- From the left prong of the first flex sensor to the 3V pad on the Microbit (red wire).
- From the right prong of the first flex sensor to the 0 pad on the Microbit (black wire).
- From the left prong of the second flex sensor to the 3V pad on the Microbit (white wire).
- From the right prong of the second flex sensor to the 1 pad on the Microbit (green wire).
NOTE: If soldering make sure no solder is flowing off of one pad or wire onto another pad or wire. This can cause the signals to be sent places we don't want them to go!
Attaching the Microbit to Your Glove
- Affix the flex sensors to the desired fingers of your glove with the striped sides facing up. Electrical tape is a great temporarily solution. If you're handy with a needle and thread you may consider a more permanent solution.
- Attach the Microbit itself and a battery pack (if desired) to the back of the glove.
- Once the glove is assembled, power the Microbit on, pair it with your iOS device and ensure the device is working as intended.
Setting Up the Glove to Work With Your Software
Every piece of iOS music software is different. Many of them allow for MIDI CC messages to be sent to control various parameters within the program. For this demo I chose the Korg iMS20 which is a software recreation of the legendary analog synthesizer from the 1970s.
Generally music software either has fixed MIDI CC channels for each control within the program or allows you to assign your own. You should find out which CC channel number you want to control and make note of it. The glove in its current configuration can control two CC channels at the same time.
Once you have figured out which channels you want to control (assuming they are different than the defaults that I have provided) make note of them and open the code.
Edit the Code
As you can see in the image above, there are a series of "let" statements followed a variable name, an equals sign, and a number. The numbers are for you to change in order to change the functionality of the glove.
- ch1: change this to change the CC channel that the first flex sensor is sent to.
- ch2: change this to change the CC channel that the second flex sensor is sent to.
- pin0scale: change this value to adjust the sensitivity of the first flex sensor. Larger numbers are more sensitive.
- pin1scale: change this value to adjust the sensitivity of the second flex sensor. Larger numbers are more sensitive.
- smoothing_range: If the flex sensors are too "jittery" try making this number slightly larger. If they are too sluggish or unresponsive, try making this number slightly smaller.
Once you have changed these values, repeat the steps necessary to re-flash and re-pair your Microbit with your iOS device.
Have Fun!
If you want to hold down a note so that you can test the flex sensors without having to hold down a key (on a virtual synthesizer), the A button on your microbit will hold down middle-C so that you can focus on other things.
Have fun with your MIDI glove! You can hook up the flex sensors to things like the filter cutoff or ring-modulation amount on your synthesizer to add a lot of expression to a boring patch. Experiment and have fun!