Chris Ball: Projects

Freelance Creative Technologist

Spherical Range Detector

SAM_1725Hi all! It’s been a while – but I’ve been busy with a few more midi projects. With this year’s Manchester Mini Maker Faire approaching, I decided to begin making more devices that will be fun to use, visually as well as physically.

This project started when I saw these stainless steel spheres for sale in a local shop – they may not be something I’d put in the garden, but I was sure there was a way to make them into an interesting MIDI device.

After a little research into capacitive sensing (there’s excellent explanations here and here) I decided to make a device that would detect proximity and send MIDI CC messages accordingly. After a short struggle getting the CapSense library to work on the Arduino Due or Olimexino, I decided to write my own code for sensing the capacitance, which was surprisingly easy and I would recommend that you have a go as a learning exercise. Some schematics & pseudocode:

That’s all it is! Most of the work is done by the code.

-Start a microsecond timer

-Set the Send Pin to HIGH

-While the Receive Pin is LOW, increment the timer

The timer will take longer and longer as capacitance increases. It’s a very narrow margin though, as the longest timer values I get are on the scale of 4 milliseconds or less. You should also be aware that there’s a lot of noise going on, especially at the threshold of detection. The little Olimexino is completely devoted to averaging out and rescaling the very messy signal we get, and the response is still far from predictable.

Capacitive sensors like these are also notoriously fussy about their surroundings; for example, the exact position of the sphere on my desk in the video is about the only place I’ve tried yet where I can get a useful range of 6-10 inches. Move it anywhere else nearby and it drops to 2 inches or less.

That’s enough introduction. Here’s some video![youtube]In this video, the detected range controls a resonant filter effect on an audio track – this is one of the simplest (but most fun) applications I’ve tried.


In the above video a threshold value has been set, above which a midi message will be triggered. This is combined with a delay effect controlled by the detected range.

As usual, get in touch at if you want help with making your own. That said, there are many arduino tutorials devoted to this subject, so just google “Arduino Capacitive Sensor”.

Next Post

Previous Post

© 2024 Chris Ball: Projects

Theme by Anders Norén