Blog - Sketching with Hardware

The MysteryBox

Published on: | Author: Lukas Rambold | Categories: 2016b, Projects

Zeichnung3

Idea

The MysteryBox is a wooden chest which opens only if you play the correct melody on it. But how are you ever able to play a melody on a ordinary box, you might ask. Well, the MysteryBox has an integrated distance sensor in its lid which detects your hand if you hover over the box. The higher the distance between your hand and the lid the higher the frequency the box emits.  If you moved your hand in the right manner, the box reveals its interior: a lollipop beautifully set into the right light by three LED beneath the presentation plate and one from top.

The Box

The exterior was made out of simple wood. Using a laser cutter we were able to weld the wood around the corners to get a more unique look. After the cutting we had to wetten the wood to make it more elastic and prevent damage.

The Instrument

To get the distance sensor and the sound replay working, we experimented with different approaches. First we tried to detect a person whistling a melody using a microphone which involved some low level operations. As a next step we took a shot at distance sensors: First with a Sharpp IR Sensor, which we ditched very quickly for an Ultrasonic sensor, because outdoor usage is only possible with the latter.

IMG_20160801_175809 13867081_10157264499465173_1979173774_n 13933012_10157264499720173_237465790_n

A major challenge was to get stable values or sounds with very messy sensor data. To solve this we first mapped the value range of the sensor to the range of our playable notes (0-4). The algorithm implemented on the Arduino UNO reads a new note value and compares it with the currently playing one. If it matches there’s nothing to do, if they don’t the new value is cached and a failCounter is incremented. The next time a new note value comes in, and it matches to the currently playing note, the failCounter is retested because it con firmes that the current note is the correct one whatsoever. But if not and it matches the previously read note the failCounter is incremented once more.

When the failCounter reaches a certain threshold, the new note replaces the current note, since there’s sufficient evidence that the position of the user’s hand had actually changed.

The procedure is not depended on the kind of sensor your using, only the mapping and the threshold has to be adjusted.

The Door Opener

Using a Servo Motor and a sophisticated door opening mechanism – a piece of wood basically the box can open its door on its own. A magnet hold the door in place and gives a more satisfying sound when the user closes the door again after retrieving his/her prize. The servo motor however causes a major problem in conjunction with our LEDs. The standard implementation of servo control on the Arduino board used interrupts pretty frequently. This prevents the communication to our LED strips since this depends heavily on timing.

The LEDs

Last but not least: some sugar in form of LEDs. We’re using NeoPixel-compatible LEDs which already have a driver chip integrated and can be serialized. They come into play on three party of the MysteryBox:

  1. under the presentation plate as back light of the laser-cutted glass disc
  2. on the top of the interior as standard diffuse room lighting
  3. as status LEDs to indicate if the player already has gotten one part of the melody right and when the game has ended

Combing these tops of the clean look of the MysterBox and makes it interesting to interact with.

The Code

can be found as a GitHub Gist.

 

image3344

 

 

linked categories 2016b, Projects

|

Write a comment

Comment