A New Kind of Instrument
Kravox has been created as part of a research project at Lund University (Sweden) with the aim to give digital musical instrument controllers the feeling of conventional, mechanical instruments.
Now Kravox shall be made accessible for everyone and serve as a musical experimentation platform, so this detailed tutorial has been created to enable as many people as possible to use this exciting new instrument!
How to Play Kravox
Playing Kravox is as quite straightforward. Just imagine you are playing around with an ordinary object like a broom and the way you touch and move it through space controls how sound is generated. See and hear how to play Kravox in this video.
What Is Kravox?
Kravox is a cross-platform compatible, open source digital musical instrument that consists of three components – controller/s, receiver and software.
Controller/s
Up to three wireless controller devices can be connected. Each controller processes orientation- and acceleration data from a digital MPU-6050 gyroscope and touch data from two MPR121 touch sensor boards connected to an Arduino Nano. The controller/s send/s the data to a receiver device via nRF24L01 radio transceiver/s.
If more than one controller shall be used, the second and third controller need to get individual addresses assigned. For more information about assigning the address see the info in the DECLARATIONS / NRF24L01 section of the controller code.
Receiver
The receiver passes the data received from the controller/s on via USB to a connected computer, together with data collected from several potentiometers. The provided receiver device code allows communication with up to three controllers, but will also work with only one or two without adjustments.
Software
The data from the receiver is processed in a programme written in Pure Data Vanilla that outputs sound.
What we will build in this Tutorial – Step-by-Step GuideThe beauty of Kravox is that it's shape, how it sounds and how it's played can be adjusted. This gave me the opportunity to design an easy-to-replicate Kravox version for this tutorial.
(In case you are curious: On my youtube-channel you can also find a timelapse of how I made the larger version of Kravox)
Both the video above and this tutorial will show you all necessary steps of how to build fully functional controllers and a receiver from easily available electric components and cardboard.
Part 1 – Gathering Components and ToolsYou will need the following components to build a Kravox controller + receiver station:
{1x} 50*24 hole (minimum size) Perfboard, {5x} 40-Pin female headers, {5x} 40-Pin male headers, {5x} 10 kilo-Ohm potentiometers and Knobs for them, {3x} Blue 5mm standard LEDs, {3x} 150 Ohm resistors, {2x} 10 micro-farad capacitors, {2x} 100 nano-farad capacitors, {2x} NRF24L01 radio transceivers, {2x} Arduino nanos, {3x} 220 Ohm resistors, {2x} MPR121 touch sensor boards, {1x} GY-521 MPU 6050 digital gyroscope, {2x} USB-A to USB-C cables, {1x} 4 meters (minimum) of 1 cm wide copper tape, {1x} powerbank, {2x} 7 meters (minimum) wire in many colors and optionally {1x} 0, 2 meters of ø=3mm shrinktube.
Moreover you need tools to assemble the components:
and later also some empty cardboard boxes or similar:
And glue, a glue gun, adhesive tape, one or more clamps and rubber bands to make the enclosures:
Next I will explain how to make the controller electronics step by step from the parts mentioned above
If in doubt, where to solder in a cable, you can always come back to the circuit diagram below and check, if the components will be connected right, once you attach the arduino and sensor-boards to the circuit board we are creating.
2.1
The first step is to cut the perfboard and female pin-headers to size and assemble them together with a small and a big capacitor that help increasing the reliability of the radio-transceiver:
Cut the perfboard with a utility knife:
Cut the female pin headers with ahacksaw (I put them on a book to level them from the tabletop):
Solder in the parts. You can already connect each pin-pair of the two long female headers that sit next to each other. For the remaining headers it is enough to simply attach them with a little solder – preferably the pins that will have according to the circuit diagram no connection later anyway. When soldering in the capacitors, pay attention to the polarity of the electrolytic 10-micro-farad capacitor (the bigger one of the two). One side will have a stripe and usually also a shorter leg. That side needs to be connected to ground. The smaller 100nano-farad-capacitor is not polarized and can be soldered in either way.
The result should look similar to this:
2.2
The second step is to solder in the two LEDs with their current limiting resistors.
Pay attention to the polarity of theLED: One side of it is flattened and will usually also have a shorter leg. That side needs to be connected to ground in step 2.3. The other side we will now connect with a cyan coloured cable to the jack where Arduino pin D3 will later sit when plugged in:
2.3
Next we add all the red and blue power supply cables. Red is for 3.3 Volts and blue for ground (GND)
The result should look similar to this:
2.4
In the fourth step it is already getting a little crowded on the board. The three sensor boards communicate via the I2C-protocol (inter-integrated circuit). That means that they can all be connected to the same two Arduino pins, so we solder in yellow and green cables between them and Arduino-pins A4 and A5. We also add a white cable for the gyroscope’s interrupt pin connection.
When this is done the board looks like this:
2.5
The radio transceiver communicates via the SPI-protocol instead (serial peripheral interface) that requires more connections than I2C, so we add black, grey, brown, purple and orange cables:
This is what you will get:
2.6
Now it’s time to prepare the components.
Apart from soldering on the male pin headers if they are not pre-soldered, pay special attention to the touch sensor boards! The cheap models from china have their address pin hardwired to ground without a pulldown-resistor in between, so you need to physically cut this connection on the bottom of the board with a utility knife. Cut between the two solder pads next to where ADD is written. I recommend to use a multimeter to check that no connection is left between the pads afterwards:
When all components have their pin headers soldered on and the touch sensor boards are prepared, you can plug the Arduino Nano, the gyroscope, the two touch sensor boards and the radio transceiver into the controller board:
The (maybe) finished controller board:
2.7
After double-checking, if everything is wired correctly, the next step is to upload the provided Kravox-Controller code (see attachments) to the Arduino nano, but before you can do so, you will need to install libraries for the gyroscope, the touch sensor boards and the radio transceiver. If you are new to Arduino-libraries, find out how to install them here.
- The MPU-6050 gyroscope requires the libraries "I2Cdev.h" and "MPU6050_6Axis_MotionApps20.h" by Jeff Rowberg that can be downloaded here.
- The MPR121 touch sensor boards need the "MPR121.h" library by Bare Conductive that can be found here. There exist at least two versions of the library. Make sure to install the version developed by Bare Conductive and not the one developed by Adafruit.
- The NRF24L01 radio transceiver board requires the libraries "nRF24L01.h" and "RF24.h" by TMRh20 that can be downloaded here. Please note: There also exist at least two versions of those libraries with identical names. Make sure to install those developed by TMRh20 and not the ones by maniacbug.
As soon as the libraries are installed you can upload the Kravox-Controller code. If you would already like to check, if ithe controller is working, you can let it output data from the touch sensors and the gyroscope via the Serial Monitor. For that you need to uncomment the last section of the receiver code before uploading:
by deleting the comment marks in the beginning ( /* ) and in the end ( */ ) of it so the code looks like this:
After uploading the code with that variation, open the Serial Monitor, and set it to a baudrate (data transfer speed) of 115200. Now you should be able to see data from the sensors that changes when you move the controller board and touch the pins of the MPR121-boards that are labeled from 0 to 11.
If nothing works or you get only zeros, check your wiring carefully and compare it to the circuit diagram above. If you get a funny output from the Serial Monitor, check if you have set it to the correct baudrate.
2.8
Connect your controller board to the powerbank you want to use with it.
If the board (or more precisely the powerbank) do not turn off automatically after some time, your controller board is finished and you can proceed to Part 3! Otherwise perform step 2.9
2.9
In principle the controller-board is done, but some powerbanks will automatically turn off after a few seconds when connected to the controller-board as it is right now because it consumes so little energy
As a dirty fix we can just add three 220 Ohm resistors in parallel between the 5V and GND pins of the Arduino. Those resistors will dissipate additional energy and transform them into heat, so the controller consumes enough for the power bank to stay on. Don’t worry: even with a small power bank it will still work for days non-stop without recharging
Remove the Arduino Nano and solder in the resistors like this:
So the board looks like this:
and after re-attaching the components the (definitely) finished controller board looks like that:
In this part of the tutorial I will show you how to make the receiver board. The process is pretty similar to making the controller board
If you want to check, where a certain cable should be connected, you can refer to this circuit diagram:
3.1
The first step is again to cut the perfboard and female pin-headers to size and assemble them together with a small and a big capacitor that help increasing the reliability of the radio-transceiver. The lowest female pin header is intentionally left longer than necessary, so you can potentially use it for other projects like an Arduino granular Synth later. You can compare this step with step 2.1 for more info
A photo of the board in the end of step 3.1:
3.2
Next we add all the red and blue power supply cables. Red is for 3.3 Volts and blue for ground (GND)
This is how it should look like:
3.3
Soldering in the Cables for SPI communication:
3.4
Attaching the components:
The receiver board is finished now, but before we can upload the Kravox-Receiver code from the attachments to the Arduino Nano, we first need to make an interface for the receiver
Part 4 – Making the Receiver InterfaceIn this part of the tutorial I show you how to make an interface with 4 potentiometers and an LED for the receiver. The interface is wired like this:
And will be plugged into the receiver board like that:
Proceed like this: First take a cable strand of 8 cables and solder 5 of them to the middle pins of the potentiometers. Preferably use the same colors to not get confused:
Next, cut a 2 * 17 hole wide perfboard and a 17 pin male pin header to size
Attach the cables and the pin header to the board. Pay attention to the circuit diagram above to make sure, that you connect the cables in the right places
Now connect one side of all the potentiometers with blue ground-connection-cables (and maybe use slightly longer cables than I did). Also add the blue LED with it's current limiting 150 Ohm resistor. Again pay attention to the LED's polarity (compare to step 2.2)
Next connect the other side of all potentiometers with green 5V-connection-cables (and maybe use slightly longer cables than I did).
The finished interface should look similar to this...
...and can be plugged into the receiver board like that:
Now you can also upload the Kravox Receiver code to the receiver's Arduino Nano.
If you want to see if it is working and receiving data from the controller, you again need to make a slight adjustment to the code before uploading. By default the Receiver will output it's data in a format that can be interpreted by pure data, but will not show useful information on the Serial Monitor. However you can change this behaviour in the code by commenting (adding // in front of) the line that says:
#define WRITE_AS_BYTES
and uncommenting (removing // in front of) the line that says:
// #define PRINT_VIA_SERIAL_MONITOR
So you turn this:
into that:
After uploading the altered code you will be able to see data from the controller and 4 of the potentiometers on the Serial Monitor as I demonstrate in this video:
Part 5 – Making the Controller Interface + EnclosureLike the receiver the controller also gets an interface – a touch interface that we will make from copper tape:
It will be connected to the controller board like this:
As we directly want to attach the touch interface to the controller's enclosure, you should already have the (non-conductive) material at hand that you want to make the enclosure from. I used empty boxes that cling film and plastic bags came in:
Start making the controller interface by marking where you want to attach the touch electrodes. Please note that they must not touch or overlap each other:
Next, cut the 24 copper electrodes to size...
...and attach them to the enclosure:
Now we can make the plug. For that cut a 2 * 24 hole wide perfboard and a 24 pin male header to size and solder 24 cables to it. The cables in the middle should be at least 10 cm long. To the outside add the width of your electrodes plus the spacing in between for each cable. If for example you use 1 cm wide copper tape and leave 3 mm between the electrodes, your cable length should increase by 1.3 cm like this 10 / 11.3 / 12.6 / 13.9 / 15.2...
and solder the other ends of the cables to the electrodes like this:
Finish the interface by covering the copper surface with non-conductive adhesive tape:
Next fold the interface into a box and glue it:
Glue a smaller box to the box we made in the previous step. It later will contain the powerbank:
Cover the back of the controller board with some leftover cardboard orother slightly thicker non-conductive material:
Cut out holes for the LEDs and glue them and the powerbank (yellow object in the picture) in place. Make sure to place the powerbank in a way that you can still plug in and remove the USB-cable because that is how you turn your controller on and off. Also connect the touch-interface to the controller board and put it in the box. Most likely it will not move much, so you do not need to glue it in.
Make a cut out for the USB-A to USB-C cable at the junction of the two boxes, pull it through and connect it to the Arduino Nano:
Now the Controller is done!
You can close it with some rubber bands. If you later have problems with the sensors recognizing touch when there is none, try to put some non-conductive material like clingfilm or the like between the touch sensitive enclosure and the board and meandering cables. Also make sure to connect the powerbank when the touch sensitive part of the enclosure does not touch your hands or anything else. See Part 7 for more info.
In part six we will make an enclosure for the receiver as well. You will need another cardboard box (I chose one that contained a bluetooth transceiver before – fitting huh?) and some knobs for the potentiometers
First cut out some circular holes for the potentiometers the LED. Also mak a cut out where you want to connect the USB-Cable to the Arduino Nano
Glue the Receiver board in. Make shure that the USB-C Jack of the Arduino Nano is aligned with the hole that you cut out for the cable connection in the step before.
Next glue in the LED and screw in all the potentiometers. The order how to put them in is the same as in the circuit diagram above:
Now you only need to attach the knobs....
...and the receiver is finished!
Now that all the hardware is finished, it's time to play some music with it! For that you need software that you can connect the hardware to. For Kravox that software is Pure Data Vanilla that you can download here for free
After installing Pure Data to your computer, start it and open the Kravox.pd file from the attachments. Please note that it needs to be saved on your computer in the same place as the drumsamples folder it comes with - otherwise Pure Data cannot find the samples
As soon as the Kravox.pd software interface has opened, look for a blue-info box and install the four so-called externals that are listed in the box. Installing them is straightforward: Just click on "help" in the Pure Data Menu, choose "Find additional objects on the internet" (might be phrased slightly different), search for "comport", "zexy", "freeverb" and "arraysize" one by one and install the most recent version. Now the four objects labeled, comport, repack, freeverb and arraysize should have a solid outline like in the picture below. You might need to restart Pure Data for that though
After installing the necessary externals you can connect the Receiver Box via USB. If you altered the code in Part 4 to use the Receiver with the Arduino Serial Monitor you need to undo this change first and upload the original code to the receiver's Arduino Nano before connecting and close the Arduino Serial Monitor, so the receiver is not busy trying to talk to it.
Now have a look at Pure Data's log / info window. If you see a rapidly updating data stream that's great because it means that pure data has already found the receiver, but most likely it will instead show you a red message like the one below that refreshes every other moment:
The red message might be a little different, but the result is the same: Pure Data did not yet succeed to connect to your receiver. That is because the program needs to be told, which USB port to listen to. USB-ports are sometimes a bit of a funny thing though: On a 2014 macbook Pro, Pure Data recognizes both USB ports as Serial Port 3, no matter to which you connect the receiver. In Milan I used Kravox with a Lenovo Yoga Pad with only one working USB-Port, that needed to be contacted as Serial Port 6, and recently installed it to another Windows Notebook with two USB-Ports, that wished to be addressed as Serial Ports 8 and 9... So my advice is just to try which number works with your USB-Port. For that I created a simple dialog as part of the Kravox.pd interface, where you can just click through the numbers until one works. You can also try the "Show available ports" and "Show connected USB-devices" buttons – Sometimes, but not very often that also provides useful information. However it takes a while until you get a response in the info window.
You will notice that you have found the right port number and that a connection has been established when the info window shows a data stream like this that updates rapidly:
Very good so far! Click save, so Pure Data will attempt to connect to this port the next time it opens automatically.
However we still need to turn the controller on. If you uncommented the last section of the Kravox Controller code in step 2.7 to connect the controller to the Serial Monitor you should upload the original Version again now.
Connect the controller board to the powerbank. When you do this, the touch-interface-enclosure around the the board should be closed and the touch sensitive part of the enclosure should not touch your hands or anything else, as the touch sensors sense their environment when powered up and assume it to be the untouched state
Congratulations – You are done!
Have much fun playing Kravox!
Comments