# Mystery Box: Shutterglass Chamber

## Overview

https://youtu.be/b9HwsPiEbyA

![](https://cdn-learn.adafruit.com/assets/assets/000/040/512/medium800/sensors_shutter_IMG_0571_2k.jpg?1490986037)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/511/medium800/sensors_shutter_IMG_0570_2k_b.jpg?1490986014)

When I saw the new LCD glass appear in the Adafruit shop, I thought it would be a great item to include in my next mystery box prop!

LCD shutter glass panels are seemingly magical when used to smoothly fade from opaque to transparent, revealing secret objects hidden inside this box's shadowbox chambers.

This guide will show you how to build the Shutterglass Chamber, a mystery box prop built for an interactive mystery performance.

You can also use this guide as a generalized technique for fading LCD panels up and down in any project you can imagine.

## Parts

To build the circuit you'll need:

- [LCD black out panel](https://www.adafruit.com/products/3330)&nbsp;x 3
- [Adafruit Trinket](https://www.adafruit.com/products/1501) 5V microcontroller
- [Micro Lipo USB charger](https://www.adafruit.com/products/1904) for LiPoly batteries
- [LiPoly 3.7v battery](https://www.adafruit.com/products/1317) (any smaller sized one that will fit your box, such as 150mAh to 350mAh)
- [SPST slide switch](https://www.adafruit.com/products/805)
- [Hall effect sensor](https://www.adafruit.com/products/158)
- [Magnet](https://www.adafruit.com/product/9)
- [10k resistor](https://www.adafruit.com/products/2784)
- [Stranded wire](https://www.adafruit.com/products/2051) in various colors
- [Heat shrink tubing](https://www.adafruit.com/products/1649)

## Tools

- Soldering iron and solder
- Wire cutters
- Wire strippers

For the cutting&nbsp;windows into the box lid, there are a number of tools you can use, such drill and coping saw, scroll saw, knife, CNC mill, laser cutter, box cutter and straight edge, and so on. Same is true for the shadow box compartments.

## Materials

- Box of rougly&nbsp;these dimensions: 22cm W x 13cm D x 5cm H
- Gaffer's tape or hot glue and a hot glue gun
- Black cardstock, cardboard, or plastic for the shadow box compartments

# Mystery Box: Shutterglass Chamber

## Assemble the Box

![](https://cdn-learn.adafruit.com/assets/assets/000/040/545/medium800/sensors_shutter_IMG_0410_2k.jpg?1490993252)

The box modifications will be fairly simple. First, unscrew the lid from the hinges if possible.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/546/medium800/sensors_shutter_IMG_0411_2k.jpg?1490993350)

If you're using hand tools, measure and mark windows slightly smaller than the LCD panels onto the box lid. Otherwise, if using CNC or laser cutter, load the CAD file into your software and let the robot do you work.

Either way, the template below may be helpful.

[shutterglass.svg](https://cdn-learn.adafruit.com/assets/assets/000/059/979/original/shutterglass.svg?1535143655)
Here's the lid after cutting out the windows on a laser cutter.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/550/medium800/sensors_shutter_IMG_0413_2k.jpg?1490993766)

To build the shadowbox chambers that sit below the windows, you can use similar techniques and tools to cut out the slots from any material you like. Darker materials will work best, such as black cardstock, painted cardboard, stained wood, or dark colored plastic. I used black acrylic.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/564/medium800/sensors_shutter_IMG_0560_2k.jpg?1490995113)

Again, here's a handy template! You may need to adjust depending on your box's dimensions.

[shadowBoxes.svg](https://cdn-learn.adafruit.com/assets/assets/000/059/981/original/shadowBoxes.svg?1535143707)
Set the long slots in first, then add the shorter ones to form the boxes.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/567/medium800/sensors_shutter_IMG_0561_2kb.jpg?1490995590)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/568/medium800/sensors_shutter_IMG_0563_2k.jpg?1490995672)

# Mystery Box: Shutterglass Chamber

## Build the Circuit

![](https://cdn-learn.adafruit.com/assets/assets/000/040/513/medium800/sensors_shutterfritz.png?1490986482)

LCD shutter panels work like this: when you apply voltage across the terminals of around 4V, the liquid crystals will arrange them selves in such a way as to become opaque. When the voltage drops down to around 1V the display will become transparent.&nbsp;

This can be done very simply by using a battery to darken the panel and then a resistor to drain the charge and go back to transparent. But for a smooth fading effect we'll use a microcontroller to ramp the voltage up and down.

The Trinket 5V is perfect for this task! It has three pins that can provide a PWM (pulse width modulation) signal, which is essentially a digital way to approximate a smooth analog signal. By sending a PWM value from 0 up to 255 to one of the panel's terminals over the course of a second, (with the opposite terminal across the longer dimension of the panel is connected to ground) the panel will gradually fade from transparent to opaque over the course of a second.

Start by soldering the **BAT&nbsp;** pins between the LiPoly charger and the Trinket.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/516/medium800/sensors_shutterSolder1.png?1490991462)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/520/medium800/sensors_shutterSolder2.jpg?1490992029)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/521/medium800/sensors_shutterSolder3.jpg?1490992049)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/522/medium800/sensors_shutterSolder4.jpg?1490992057)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/523/medium800/sensors_shutterSolder5.jpg?1490992068)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/524/medium800/sensors_shutterSolder6.jpg?1490992076)

Next, trim one of the outer legs from the switch, and then bend the two remaining legs to connect&nbsp;the switch onto the Trinket **GND** and one of the charger **GNDs,&nbsp;** then solder them in place.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/525/medium800/sensors_shutterSolder7.jpg?1490992163)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/526/medium800/sensors_shutterSolder8.jpg?1490992172)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/527/medium800/sensors_shutterSolder9.jpg?1490992183)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/528/medium800/sensors_shutterSolder10.jpg?1490992193)

Now, you can connect one of the panels. Measure out one length each of black and yellow wire long enough to run from the board to the panel in roughly the final spacing based upon your box dimensions -- abut 4" should do. Strip the ends of a bit of insulation and tin the wires.

Then, solder the yellow wire to Trinket pin&nbsp; **0** and one LCD terminal (they are not polarized, so any one is fine).

Then, solder from Trinket&nbsp; **GND&nbsp;** to one of the LCD terminals that is on the side farthest from your yellow wire's connection. See the diagrams and pictures for clarity.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/529/medium800/sensors_shutterSolder14.jpg?1490992426)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/530/medium800/sensors_shutterSolder13.jpg?1490992438)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/531/medium800/sensors_shutterSolder16.jpg?1490992455)

Plug in the battery and flip the switch -- you should see the Trinket's power LED light up, but the panel won't change yet until we program the Trinket.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/533/medium800/sensors_shutterSolder17.jpg?1490992592)

Solder a 6" length of green wire to Trinket pin&nbsp; **1&nbsp;** and an 8" length of blue wire to pin&nbsp; **4**.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/534/medium800/sensors_shutter_IMG_0373_2k.jpg?1490992720)

Solder the green and yellow wires to the two remaining LCD panels respectively. Then, solder short black wires between grounds of the LCD panels.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/535/medium800/sensors_shutter_IMG_0416-Edit_2k.jpg?1490992786)

Next, let's wire up&nbsp;the hall sensor to detect our magnet. Use 10" lengths of red, black and white wire for this.

Strip and tin the wires, then slip short lengths of heat shrink tubing over them to isolate the sensor legs.

Solder the resistor between the outer legs of the sensor, and then solder the wires to the sensor legs like this:

- Red&nbsp;to the left (leg&nbsp;1) (when looking at the "front" of the sensor)
- Black to center (leg 2)
- White&nbsp;to right (leg&nbsp;3)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/551/medium800/sensors_shutter_IMG_0437b.jpg?1490994235)

Here's how the Trinket will use the Hall&nbsp;effect sensor:

Connect power to pin 1 (all the way to the left), ground to pin 2 (middle) and then a 10K pull up resistor from pin 3 to power. Then listen on pin 3, when the south pole of a magnet is near the front of the sensor, pin 3 will go down to 0V. Otherwise it will stay at whatever the pullup resistor is connected to, in this case we'll use Trinket pin 2. Nothing occurs if a magnet's north pole is nearby (unipolar).

![](https://cdn-learn.adafruit.com/assets/assets/000/040/552/medium800/sensors_shutter_IMG_0433_2k.jpg?1490994392)

# Mystery Box: Shutterglass Chamber

## Code It

The Arduino sketch for this is straightforward. If you want to test out the effect, open the Arduino **File \> Examples \> Basics \> Fade** sketch. Change the int led variable to pin 0 (since that's one of the pins controlling one of our LCD panels) like this:

&nbsp;

```
/*
 Fade

 This example shows how to fade an LED on pin 9
 using the analogWrite() function.

 The analogWrite() function uses PWM, so if
 you want to change the pin you're using, be
 sure to use another PWM capable pin. On most
 Arduino, the PWM pins are identified with 
 a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.

 This example code is in the public domain.
 */

int led = 0;           // the PWM pin the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // set the brightness of pin 9:
  analogWrite(led, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness &lt;= 0 || brightness &gt;= 255) {
    fadeAmount = -fadeAmount;
  }
  // wait for 30 milliseconds to see the dimming effect
  delay(30);
}
```

&nbsp;

Then, plug your Trinket into your computer over USB, select your Trinket (either Trinket 16Mhz or 8Mhz) from the Arduino **Tools \> Boards** menu, pick the USB port, and upload. After the program is done uploading you'll see the LCD opacity fading up and down!

We'll extend this code to include our other two panels, as well as checking the Hall effect sensor for the presence of a magnet. Copy the code below, create a new Arduino sketch, paste the code, save the file, and then upload to your Trinket.

```
//Shutterglass Chamber
//by John Park
//uses analogWrite() PWM function to fade between dark and light states 
//on LCD welders glass panels

/*
 Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal
 20K-ohm resistor is pulled to 5V. This configuration causes the input to
 read HIGH when the switch is open, and LOW when it is closed.


Wiring is left (pin 1) to Vin, middle to GND, right to analog voltage output, such as A1 on Uno
  place 10K resistor between voltage in Pin 1 and voltage out Pin 3
  _______
 |\_____/|  
 | |   | |
 | |   | |
  -------
  /  |  \
 |   |   |
 |   |   |
 |   |   |
 |   |   |
 +  GND  Output
 |   |   |
 |       |
 \-[|||]-/ 10k resistor

 
 */

int panelState = 0; //0 is transparent, 1 is dark

int paneA = 0;           //  PWM pin controlling panel on Trinket
int paneB = 1;           
int paneC = 4;    
int onSwitch = 2;   

void setup() {

  //declare switch pin as input_pullup to use internal resistor
  //pinMode(onSwitch, INPUT_PULLUP);
  //digital hall sensor (A3144 402 type) acts as on/off switch
  pinMode(onSwitch, INPUT);

  // declare pins as  output
  pinMode(paneA, OUTPUT);
  pinMode(paneB, OUTPUT);
  pinMode(paneC, OUTPUT);


  digitalWrite(paneA, HIGH); //darken the panel at start
  digitalWrite(paneB, HIGH);
  digitalWrite(paneC, HIGH); 
}

void loop() {
  //read the pushbutton value into a variable
  int sensorVal = digitalRead(onSwitch);

  // Keep in mind the pullup means the pushbutton's
  // logic is inverted. It goes HIGH when it's open,
  // and LOW when it's pressed. Turn on pin 13 when the
  // button's pressed, and off when it's not:
  
  if (sensorVal == HIGH) { //the button has been pressed/switch has been closed
    //while the switch is closed, make the led go off and the panel transparent
     if(panelState==1){
      
      fadePanel(0,20);
      panelState=0;//flip the counter
      
     }
    } 
  
  else if (sensorVal == LOW){
     if(panelState==0){
    
      //digitalWrite(paneA,HIGH);
      //digitalWrite(paneB,HIGH);
      //digitalWrite(paneC,HIGH);
      fadePanel(1,20);
      panelState=1;
     }
  } 
  
}

void fadePanel(int fadeDir, int delayTime){ 
//fades a pin 
  if (fadeDir==0){ //fade it down to transparent
    for(int i=140; i&gt;=0; i-=5){ //140 is a nice value for i, but should it be darker?
     // analogWrite(panelPin, i);
      analogWrite(0, i);
      analogWrite(1, i);
      analogWrite(4, i);
      delay(delayTime);
    }
  }
  if (fadeDir==1){ //fade it up to dark
    for(int i=0; i&lt;=255; i+=5){ //140?
      analogWrite(4, i);
      analogWrite(1, i);
      analogWrite(0, i);
      delay(delayTime); 
    }

  }
}

 
```

Now, when you pass the correct pole of the magnet past the proper face of your Hall effect sensor, the LCD panels will fade to opaque. Remove the magnet and they fade back to transparent.

# Mystery Box: Shutterglass Chamber

## Use the Shutterglass Chamber

![](https://cdn-learn.adafruit.com/assets/assets/000/040/571/medium800/sensors_shutter_IMG_0571_2k.jpg?1490995790)

Peel the protective film off of both sides of each panel.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/569/medium800/sensors_shutter_IMG_0415_2k.jpg?1490995720)

Now, lay each panel into place inside the lid. You can use tape or hot glue to secure them once they are lined up properly. Check from the top of the lid to make sure there aren't any spaces on the sides through which to peek.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/573/medium800/sensors_shutter_IMG_0508_2k.jpg?1490995900)

Place the Hall effect sensor into a corner of the lid and secure it with tape. Make sure point the face&nbsp;of the sensor that reacts to the magnet outward.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/574/medium800/sensors_shutter_IMG_0438_2k.jpg?1490995988)

Now, use gaffer's tape to secure the wiring, battery, and the Trinket/charger combo in place. You can leave enough slack so that you can plug in a USB cable to charge the battery.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/576/medium800/sensors_IMG_0580.jpg?1490997191)

And now, your Shutterglass Chamber is complete! Screw the lid back onto the hinges, fill the chambers with artifacts and clues, and then use the magnet for the dramatic reveal!

![](https://cdn-learn.adafruit.com/assets/assets/000/040/578/medium800/sensors_shutter_IMG_0564.jpg?1490997378)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/580/medium800/sensors_shutter_IMG_0566.jpg?1490997486)

![](https://cdn-learn.adafruit.com/assets/assets/000/040/577/medium800thumb/sensors_shutterAnim.jpg?1490997322)


## Featured Products

### Large Liquid Crystal Light Valve - Controllable Shutter Glass

[Large Liquid Crystal Light Valve - Controllable Shutter Glass](https://www.adafruit.com/product/3330)
What do you get when you power a layer of liquid crystal material sandwiched between two sheets of glass? A **&nbsp;Liquid Crystal Light Valve** (a.k.a a LCD Controllable Black-out Panel)!&nbsp;They're&nbsp;often used for electric welding helmets&nbsp;because...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3330)
[Related Guides to the Product](https://learn.adafruit.com/products/3330/guides)
### Adafruit Trinket - Mini Microcontroller - 5V Logic

[Adafruit Trinket - Mini Microcontroller - 5V Logic](https://www.adafruit.com/product/1501)
 **Deprecation Warning: The Trinket bit-bang USB technique it uses doesn't work as well as it did in 2014, many modern computers won't work well. So while we still carry the Trinket so that people can maintain some older projects, we no longer recommend it.** <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1501)
[Related Guides to the Product](https://learn.adafruit.com/products/1501/guides)
### Adafruit Micro-Lipo Charger for LiPo/LiIon Batt w/MicroUSB Jack

[Adafruit Micro-Lipo Charger for LiPo/LiIon Batt w/MicroUSB Jack](https://www.adafruit.com/product/1904)
Oh so handy, this little lipo charger is so small and easy to use you can keep it on your desk or mount it easily into any project! Simply plug it via any MicroUSB cable into a USB port and a 3.7V/4.2V lithium polymer or lithium ion rechargeable battery into the JST plug on the other end....

In Stock
[Buy Now](https://www.adafruit.com/product/1904)
[Related Guides to the Product](https://learn.adafruit.com/products/1904/guides)
### Lithium Ion Polymer Battery - 3.7V 350mAh

[Lithium Ion Polymer Battery - 3.7V 350mAh](https://www.adafruit.com/product/2750)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 350mAh for a total of about 1.3 Wh. If you need a larger (or smaller!) battery, <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/2750)
[Related Guides to the Product](https://learn.adafruit.com/products/2750/guides)
### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

In Stock
[Buy Now](https://www.adafruit.com/product/805)
[Related Guides to the Product](https://learn.adafruit.com/products/805/guides)
### Hall effect sensor

[Hall effect sensor](https://www.adafruit.com/product/158)
Hall effect sensors detect whether a magnet is near. Useful for non-contact/waterproof type switches, position sensors, rotary/shaft encoders. I tried dozens of different hall effect sensors to see which one would work best for the SpokePOV kit (to determine the wheel location) and this one...

In Stock
[Buy Now](https://www.adafruit.com/product/158)
[Related Guides to the Product](https://learn.adafruit.com/products/158/guides)
### Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2784)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 10K Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2784)
[Related Guides to the Product](https://learn.adafruit.com/products/2784/guides)
### Silicone Cover Stranded-Core Wire - 30AWG in Various Colors

[Silicone Cover Stranded-Core Wire - 30AWG in Various Colors](https://www.adafruit.com/product/2051)
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire for being extremely supple and flexible, so it is great for wearables or projects where the wire-harness has to...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2051)
[Related Guides to the Product](https://learn.adafruit.com/products/2051/guides)

## Related Guides

- [Pocket Galaxy](https://learn.adafruit.com/pocket-galaxy.md)
- [Glowing LED Team Badge for Pokemon Go](https://learn.adafruit.com/glowing-led-team-badge-for-pokemon-go.md)
- [Trinket / Gemma IR Control](https://learn.adafruit.com/trinket-gemma-ir-remote-control.md)
- [Free-Wired 3x3x3 NeoPixel Cube](https://learn.adafruit.com/free-wire-3x3x3-neopixel-cube.md)
- [Adding Third Party Boards to the Arduino v1.6.4+ IDE](https://learn.adafruit.com/add-boards-arduino-v164.md)
- [3D Printed Camera LED Ring](https://learn.adafruit.com/3d-printed-camera-led-ring.md)
- [NeoPixel Arcade Buttons](https://learn.adafruit.com/neopixel-arcade-button.md)
- [n3rfgun](https://learn.adafruit.com/n3rfgun.md)
- [Ultrasonic Ruler](https://learn.adafruit.com/ultrasonic-ruler.md)
- [Tap Tempo Trinket](https://learn.adafruit.com/tap-tempo-trinket.md)
- [Introducing Trinket](https://learn.adafruit.com/introducing-trinket.md)
- [Trinket Powered Analog Meter Clock](https://learn.adafruit.com/trinket-powered-analog-meter-clock.md)
- [NeoPixel 60 Ring Wall Clock](https://learn.adafruit.com/neopixel-60-ring-clock.md)
- [Color Mixing QT Py Cuff Bracelet](https://learn.adafruit.com/color-mixing-qt-py-cuff.md)
- [Circuit Playground Bike Glove](https://learn.adafruit.com/circuit-playground-bike-glove.md)
