Project tutorial

Kravox! Wireless, Motion and Touch-Sensing Instrument © GPL3+

Musical instrument for multiple users – with Arduino, nRF24L01, MPR121 and MPU6050 connected to Pure Data Vanilla.

  • 5,149 views
  • 2 comments
  • 24 respects

Components and supplies

Ard nano
Arduino Nano R3
About 3$ / piece. from china (year 2018). Make sure to find an offer that comes with a cable (see next entry)
×2
Adafruit industries ada260 image 90px
USB-A to Mini-USB Cable
Those cables are for connecting the Arduinos to the powerbank and the Computer. They can often be bought in a bundle with an Arduino nano. Mini-USB is also called USB-C.
×2
GY-521 MPU-6050 3 Axis Gyroscope + Accelerometer Module For Arduino
MPU6050 Gyroscopes can be ordered from china for about 1$ / piece (year 2018)
×1
MPR121 Touch Sensor Board
The MPR121 is not sold by sparkfun anymore, BUT cheap copies from china can be ordered for about 2$ / piece (year 2018)
×2
nRF24L01+ radio transceiver
nrf24L01+ radio transceivers are often sold on ebay or elsewhere in quantities of 3, 5 or 10 pieces. They cost about 1$ / piece (year 2018) and it's advisable to buy about 5 and up as one out of ten might not work perfectly (and once you have built something functional with them you will want to have more!)
×2
Panasonic eca1hm2r2
Capacitor 10 µF
×2
Kemet c320c104k5r5ta image
Capacitor 100 nF
×2
40-pin female pin header
40-pin female pin headers can be ordered for about 1$ / 10 pieces (year 2018) from china.
×5
Te connectivity 4 103741 0 image 75px
Male Header 40 Position 1 Row (0.1")
×2
cable, preferably in several colors like in ribbon cable
The amount of wire that you need depends on what you want to build (=how far the touch sensor electrodes shall be away from the sensor board. This can quickly add up because there are 24 touch electrodes in a controller – so if you estimate to use approx. 15 cm per electrode, you will already need more than 3,5 meters for them only. For the three broom-shaped controllers that I built for the Milan Design fair I used about 70m to wire the electrodes). For wiring the rest (female pin headers, LEDs, potentiometers, etc.) you will need about 3 meters, so I would suggest to get at least 7-10 meters of cable – if you find a meter of 10-wire-ribbon-cable you are fine.
×2
09590 01
LED (generic)
You need three blue 5mm-standard-LEDs. Of course you could also use other colors. (For standard LEDs the matching resistors are green LED: 220 Ohm, blue LED: 120 Ohm, white LED: 56 Ohm. However we will use 150 Ohm resistors for the blue LEDs to limit the current flowing through them)
×3
10k Potentiometer
×5
150 Ohm resistor (1/4 Watt)
Used to limit the current flowing through the LEDs
×3
220 Ohm resistor (1/4 Watt)
These resistors are optional. You need them in case the powerbank you use with the controller automatically turns off because it assumes that no device is connected due to low power consumption. If that happens, you can solder those three resistors in parallel between +5 and GND of the Arduino – just to make it consume more power
×3
Perf board (min 50 holes)
To get the same pcb-layout as me, you will need perf-boards that have at least 50 holes on the longest side. For the controller you need to cut a perf-board of minimum 9 * 50 holes. The receiver module's perf-board needs to be 31 * 8 holes wide. For convenience you will also like to cut two small boards to attach the male pin headers to. For that you need two more boards of 2 * 24 and 2 * 17 holes. Assuming that one row will be cut away by each cutting of the perf-board, you will need at least a perfboard, that is 50 * 24 holes wide.
×1
small box / food container or similar
To put the components for the master-device inside. The container should be made from a material that can be drilled and/or cut well. Preferably not a metal box as that might affect the radio transceiver's ability to communicate with the controller(s)
×1
powerbank
You can use any USB-powerbank, preferably a small one, as it will be part of the handheld controller
×1
Old boxes of household items or something else...
This is the part to be creative: For the design fair in Milan I used water pipes as a housing for the controllers. In this tutorial I use boxes that cling-film and plastic bags came in. What will you use?
×1
Solder
×1
Copper tape
Used to make the touch electrodes. you can also use other conductive objects as electrodes – preferably from copper as it can be soldered well. If you want to use a cling-film box as enclosure like in this tutorial you need a bit less than 4 meters copper tape (1cm wide)
×1
Glue
×1
super glue
Super glue is optional. You can use it to glue the single-row female pin headers together to get double-row female pin headers. Of course you can also use standard glue or your glue gun.
×1
Rubber bands
×1

Necessary tools and machines

09507 01
Soldering iron (generic)
Of course a soldering station is nicer, but a simple soldering iron will do
Drill driver + M7 drill bit
Utility knife
Small saw
Steel ruler
Wire stripper
Small pliers
Hy gluegun
Hot glue gun (generic)
Clamp
Can be useful when glueing the boxes together

Apps and online services

About this project

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.

Build Kravox – Step-by-Step Guide

This written tutorial is accompanied by a video tutorial.

Part 1 – Gathering Components and Tools

You 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:

Part 2 – Making the Controller Board

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 MPU6050 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:

Part 3 – Making the Receiver Board

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 Interface

In 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 + Enclosure

Like 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.

Part 6 – Making the Receiver Enclosure

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!

Part 7 – Connecting the Receiver to Pure Data

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!

Code

Kravox Code for Arduino and Pure Data
Under this link you can download a Zip-File that contains the Arduino Code for the Kravox controller and the Kravox receiver, the Kravox.pd-file for Pure Data and the necessary drumsamples for the instrument. Please refer to the tutorial for instructions how to use the files.

Schematics

Kravox Receiver and Interface circuit
Rc vdgsihijp2
Kravox Controller Circuit
Cc addr  zkctwlm4dh

Comments

Similar projects you might like

PENXZYL: Arduino 3-Axis Brush Plotter

Project showcase by Guiye Perez Bongiovanni

  • 3,180 views
  • 1 comment
  • 13 respects

MyRiver

Project tutorial by Andrei Florian

  • 7,969 views
  • 2 comments
  • 33 respects

Detecting Heart Rate with a Photoresistor

Project tutorial by 3 developers

  • 6,405 views
  • 3 comments
  • 15 respects

Weather Forecast Clock Using Old Alarm and Arduino

Project showcase by LenkaDesign

  • 4,006 views
  • 10 comments
  • 21 respects

Photoresistor Characterization

by 3 developers

  • 2,123 views
  • 4 comments
  • 5 respects

u-blox LEA-6H 02 GPS Module with Arduino and Python

Project tutorial by Harshgosar

  • 1,312 views
  • 7 comments
  • 5 respects
Add projectSign up / Login