Mystery Box build guide

Today I will present build details behind the Mystery Box. To recap, the Mystery Box is a big cardboard box with large question marks on four sides that glow white when the box is closed. Once the box is opened, the question marks and the inside of the box flash red. Watching the build timelapse can be helpful to follow along.

Box construction

The Mystery Box starts with a 18x18x16 inches cardboard box. A question mark outline is printed and cut to make a mask which is used to trace a question mark on four sides of the box. The four question marks are then cut using a utility knife. The top flaps of the box are also removed since a custom box cover will be used.

Cheap white spray paint is used to paint the inside of the box and as a base coat on the outside. The interior is painted white to improve light reflection. A final red coat of spray paint is applied on the outside. Then, a sheet of decal paper is glued over each question mark holes from the inside.

The box cover is made using white poster cardboard. The cardboard is cut, folded and glued to create borders of about 2 inches. Finally, the top flaps from the original cardboard box are glued under the cover to solidify it.

Then, the electronic components are installed inside the box. The main components are a snap action switch, four LED modules, batteries and an Arduino with a custom shield. The Arduino and the batteries are placed at the bottom of the box in a corner and fixed in place with double sided tape. Each LED module is placed behind a question mark, making sure no part of the module or the connecting wire are masking the translucent question marks. Double sided tape is again used to fix the modules. The switch is placed at the edge of the box to detect when the cover is removed. The weight of the cover was not enough to securely close the switch, so a toothpick is glued using hot glue to the switch’s lever to increase leverage. The switch is glued to the box wall using hot glue. Finally, all the wires are routed and taped inside the box to avoid overlapping a translucent question mark.

Electronics

An Arduino is used as the main controller. It is overkill for the project, but is easy to use and I had one laying around. A custom “shield” is built to connect the LEDs and the snap action switch.

The circuit is quite simple. The only input is the normally open snap action switch to detect when the cover is removed. For the output, there are two “channels”, one for each LED color. A unique Arduino PWM output is used for each channel. The PWM allows to control the intensity of the light emitted by changing the duty cycling.

Instead of driving directly the LEDs with the Arduino, a MOSFET is used for each LED channel. This is to prevent driving too much current through the Arduino pins.

The circuit runs on two different voltages. First, 9V to power the Arduino. Then, 4.5V to drive the LEDs. The 9V comes from a 9V battery. The 4.5V is generated using three AA batteries in series. No regulator is used on the 4.5V supply since it only drives the LEDs and having constant light output was not a necessity.

Finally, a switch was added to the white LED channel to be able to switch on or off the white channel without the use of the Arduino. I have never used this feature in practice.

The components used with their Digi-Key part number is listed below.

[table]

Component, Digi-Key part number
White LED, C535A-WJN-CS0V0231-ND
Red LED, C4SMF-RJS-CT0W0BB2CT-ND
N-Channel MOSFET, IRLB8721PBF-ND
Snap action switch, EG4541-ND
[/table]

Software

All the source code is available in a GitHub repository. The Arduino logic is very simple. If the lid switch is closed, then the box is closed and the white LED need to pulse. Otherwise, the red LED need to flash.

The white LED pulse deserve more detailed explanations because the light output used is not linear. Since the human perception of light is not linear, if the LED pulse ramp is linear, it looks like the light increases rapidly at first, then slows down during a pulse. To give the perception of a linear increase in light, we use a gamma correction curve to control the LED output. This is not a real model of the human light perception, but it gives a visibly acceptable result.To avoid computing this power function at each iteration, a lookup table of all the 256 possible values is precomputed using a Python script. After some experiments, a gamma value of 2.0 was finally used.

 

Possible improvements

First, I would use a grey base coat for the outside surface of the box. Two coats of white and a coat of red paint were not enough to cover the existing markings on the box an they still show through the red.

I would use proper connectors to connect all the wires from the LED modules and the switch to the custom shield. Placing the solid core wires directly inside the connectors worked, but it is very unreliable. Each time I want to use the box, I have to fix a wire that has come loose.

Finally, I would use brighter white LEDs. If the ambient light is too strong, it is hard to see the pulsing white light through the question marks.

Files