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:

Tools

  • Soldering iron and solder
  • Wire cutters
  • Wire strippers

For the cutting 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 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

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

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.

Here's the lid after cutting out the windows on a laser cutter.

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.

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

Set the long slots in first, then add the shorter ones to form the boxes.

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. 

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 pins between the LiPoly charger and the Trinket.

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

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 0 and one LCD terminal (they are not polarized, so any one is fine).

Then, solder from Trinket GND 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.

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.

Solder a 6" length of green wire to Trinket pin and an 8" length of blue wire to pin 4.

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

Next, let's wire up 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 to the left (leg 1) (when looking at the "front" of the sensor)
  • Black to center (leg 2)
  • White to right (leg 3)

Here's how the Trinket will use the Hall 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).

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:

 

/*
 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 <= 0 || brightness >= 255) {
    fadeAmount = -fadeAmount;
  }
  // wait for 30 milliseconds to see the dimming effect
  delay(30);
}

 

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

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

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.

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

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.

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!

This guide was first published on Apr 01, 2017. It was last updated on Mar 30, 2017.