# Mad Science Test Tube Rack

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/036/535/medium800/projects_ttBT-1.jpg?1476396876)

https://youtu.be/Y2p1OapkTNM

A proper mad science laboratory requires mysterious potion-filled test tubes lit with eerie colors to flicker in thier rack. Build this display for maximum creepy effect!

Flourescent pigments mixed with&nbsp;water make for a creepy-cool&nbsp;luminescent potion when lit with ultraviolet light, especially as they flicker and blink based on a microcontroller pattern you design.

You can use this technique to make test tubes glow in a standard test tube rack, or build your own from black iron pipe fittings and laser-cut acrylic for some next level spookiness!

![](https://cdn-learn.adafruit.com/assets/assets/000/036/523/medium800/projects_ttBT_full-1.jpg?1476392790)

Here's a very nice user-submitted [Menorah version](https://youtu.be/N2-Ei_FJrfg).

Info: 

# Lighted Test Tube Parts

- Adafruit [Feather 32u4 Basic Proto](https://www.adafruit.com/products/2771) or [Feather M0 Basic Proto](https://www.adafruit.com/products/2772)
- [Terminal Block FeatherWing&nbsp;](https://www.adafruit.com/products/2926)
- [UV/UVA 400nm LEDs](https://www.adafruit.com/products/1793)&nbsp;1 per test tube
- [USB cable A/micro B](https://www.adafruit.com/products/2008)
- [Power supply](https://www.adafruit.com/products/501)
- [Test tube&nbsp;rack](https://www.amazon.com/Eisco-Premium-Wooden-Holes-16-75/dp/B00I13ZOUO/)&nbsp;or build your own as detailed&nbsp;later in this guide

&nbsp;

- [Pyrex test tubes](https://www.amazon.com/gp/product/B001DBF60O/) and matching [stoppers with holes](https://www.amazon.com/gp/product/B00UDMUHYE/)
- [Stranded wire](https://www.adafruit.com/products/2976)&nbsp;or jumper wire or&nbsp;[cloth covered wire](http://www.sundialwire.com/22-gauge.aspx)&nbsp;(for style points)&nbsp;
- [Fluorescent UV pigment](https://www.amazon.com/gp/product/B00FPRFUMQ/)&nbsp;or tonic water
- [Wire housings](https://www.adafruit.com/products/3145) (1x2 size) optional for LED wiring
- [Heat shrink tubing](https://www.adafruit.com/products/344)

![projects_tubes.jpg](https://cdn-learn.adafruit.com/assets/assets/000/036/487/medium640/projects_tubes.jpg?1476367383)

![projects_pigment-1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/036/488/medium640/projects_pigment-1.jpg?1476367415)

![projects_cat_gauge_22.jpg](https://cdn-learn.adafruit.com/assets/assets/000/036/489/medium640/projects_cat_gauge_22.jpg?1476367564)

# Materials and Tools

- Soldering iron
- Solder
- Wire strippers
- Heat shrink tubing

# Optional Test Tube Rack Parts

- 3/16" thick black acrylic sheet 12"x16"
- Wooden base, roughly 20"x9"x1-1/2"
- 8 ea. #12 x 1-1/4" wood screws
- 4ea. [nylon M3 hex spacers and screws](https://www.amazon.com/gp/product/B01DC1AE7W/)

- 2 ea. 1/2" threaded pipe nipple, 6" length
- 4 ea. 1/2" threaded pipe nipple, 8" length
- 2 ea. 1/2" threaded pipe fitting, 90 degree elbow
- 3 ea. 1/2" threaded pipe fitting, coupling
- 4 ea. 1/2" threaded pipe fitting, locknut
- 2 ea. 1/2" threaded pipe floor flange

![projects_pipeRackParts1.png](https://cdn-learn.adafruit.com/assets/assets/000/036/321/medium640/projects_pipeRackParts1.png?1476211481)

![projects_pipeRackParts2.png](https://cdn-learn.adafruit.com/assets/assets/000/036/322/medium640/projects_pipeRackParts2.png?1476211499)

![projects_pipeRackParts3.png](https://cdn-learn.adafruit.com/assets/assets/000/036/324/medium640/projects_pipeRackParts3.png?1476211535)

![projects_pipeRackParts4.png](https://cdn-learn.adafruit.com/assets/assets/000/036/326/medium640/projects_pipeRackParts4.png?1476211547)

![projects_pipeRackParts5.png](https://cdn-learn.adafruit.com/assets/assets/000/036/327/medium640/projects_pipeRackParts5.png?1476211563)

![projects_pipeRackParts6.png](https://cdn-learn.adafruit.com/assets/assets/000/036/328/medium640/projects_pipeRackParts6.png?1476211577)

# Optional Tools

- Drill with 1/8" bit for pilot hole
- Screwdriver

# Mad Science Test Tube Rack

## Wire the Feather

![](https://cdn-learn.adafruit.com/assets/assets/000/036/537/medium800/projects_ttBT_moody-1.jpg?1476397647)

You'll use the Feather microcontroller to drive up to thirteen purple UV LEDs. Ultraviolet light causes the special pigments to fluoresce, or emit light of a longer wavelength when lit. This is the same effect you may have seen on a blacklight poster.

Info: 

Assemble the TerminalBlock FeatherWing according to [these instructions](../../../../adafruit-terminal-block-prototyping-breakout-featherwing), then fit the Feather Basic Proto onto it. You'll use the screw terminals to make the wiring easy and secure.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/355/medium800/projects_2926-00.jpg?1476221305)

Connect the Feather via USB to your computer and upload the code via Arduino IDE.

```auto
// ---------------------------------------------------------------------------
//Mad Science Test Tube Rack
// John Park
// for Adafruit Industries
//
// Blinks thirteen LEDs, each in their own timing pattern.
// Designed for use with the Adafruit Feather 32u4 and Feather M0, 
// but will work with most Arduino boards.
// MIT license, check LICENSE for more information
// ---------------------------------------------------------------------------

//****************************************************************************
//Output pins
byte LED_PINS[13] = {A0, A1, A2, A3, A4, A5, 5, 6, 9, 10, 11, 12, 13};
//****************************************************************************

//****************************************************************************
//Timing patterns: 
//Each row in is the timing in millis of a single LED
//Adjust these to tune the timing
//****************************************************************************
unsigned int TIMING[][13] = {
  {random(4500, 8500), 6000, 12000, random(4000, 6000), random (10000, 20000)},
  {3500, random (1000, 5000), 14000, 500, 6500, 800, 4000},
  {5850, 800, 3500, random (3000, 10000)},
  {random(500, 3000), random (1000,3000), 700, 2000, 9000},
  {6500, 600, 3000, random (3000, 7000), 7000, 30000},
  {4000, random(1000, 7000), 4000, 5000, 4500},
  {7000, 800, 5000, random(2000, 4000)},
  {random(5000, 8000), 500, random(7000, 25000), 200, random(1000, 8000), 3000, 500, random(5000, 9000)},
  {random(300, 1000), random (1000, 7000), 1400, 500, 3500},
  {random (2500, 3500), 800, 18050, random(1000, 20000)},
  {13000, 1000, random (300, 2000), 2000, random (500, 4000)},
  {15000, random (500, 7000), random(1000, 4000), 5000, random (1000, 1500)},
  {random(2000, 6000), 800, 3500, random (500, 2500), 1000, 300, 400, 500, random (200, 18000)}
};

// Keep track of timing sequence
unsigned long last_change[sizeof(LED_PINS)/sizeof(LED_PINS[0])];
byte timing_i[sizeof(LED_PINS)/sizeof(LED_PINS[0])];

void setup() {
  //Set all 13 pins to output mode and turn on
  for (byte i = 0; i < sizeof(LED_PINS)/sizeof(LED_PINS[0]); i++) {
    pinMode(LED_PINS[i], OUTPUT);
    digitalWrite(LED_PINS[i], HIGH);
  }
}

void loop() {
  unsigned long now = millis(); // Current time

  // Keep track of pattern for each LED
  for (byte i = 0; i < sizeof(LED_PINS)/sizeof(LED_PINS[0]); i++) {
    if (now - last_change[i] >= TIMING[i][timing_i[i]]) {
      digitalWrite(LED_PINS[i], !digitalRead(LED_PINS[i]));
      timing_i[i]++;
      timing_i[i] %= sizeof(TIMING[i])/sizeof(TIMING[i][0]); // Repeat pattern when done
      last_change[i] = now;
    }
  }
}
```

![](https://cdn-learn.adafruit.com/assets/assets/000/036/428/medium800/projects_testTubeBreadBoard.png?1476299537)

Next, you'll wire the LEDs to the TerminalBlock FeatherWing. Depending on the number of test tubes you use, the wiring may vary, but this scheme allows for one LED per output pin on the Feather (a total of thirteen) and uses the four GND terminals to best effect.

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/036/409/medium800/projects_wiringB-1.jpg?1476292986)

Prep your wires by cutting pairs of wires for each test tube LED you plan to use, approximately 10" in length each. In the version made for this&nbsp;guide there are thirteen of them. We can use one Feather output pin per LED, but we don't have thirteen GND pins, so we'll create a few short wire splices to accomodate.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/410/medium800/projects_wiringB-2.jpg?1476293011)

Strip the ends of each wire, and trim the cloth if using a fabric covered wire. You may also use&nbsp;short lengths of heat shrink tubing to keep the cloth&nbsp;from fraying or wires from shorting.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/411/medium800/projects_wiringB-3.jpg?1476293029)

Slip a bit of heat shrink tubing over the end of each wire and then push the LEDs through a 1x2 jumper houseing (this is optional, it just keeps the legs from shorting and looks neat) solder a wire to each leg of the LEDs. Be sure to keep track of polarity -- you can use a multimeter's continuity testing mode to be certain -- and then screw each&nbsp;anode (long leg, +) wire into an output pin on the TerminalBlock FeatherWing. The thirteen output pins we'll use are&nbsp;5, 6, 9-13, and&nbsp;A0-A5.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/408/medium800/projects_wiring-1.jpg?1476292672)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/412/medium800/projects_wiring-3.jpg?1476293157)

Next, create the ground cables to share among the LEDs. Solder two short wires&nbsp;(optionally with 1x1 female jumper sockets on one end) to the ground wire.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/413/medium800/projects_wiring-4.jpg?1476293183)

Solder this ground splitter to the cathode (short) leg of one LED, then you will be able to share this ground with the two short leads to two other LEDs.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/414/medium800/projects_wiring-5.jpg?1476293211)

Place a length of heat shrink tubing over the positive wire before soldering to the anode (longer) leg of the LED. Solder the wire to the leg, then slide the heat shrink tubing over it and heat it to shrink.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/415/medium800/projects_wiring-6.jpg?1476293234)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/417/medium800/projects_wiringX.jpg?1476294040)

# Mad Science Test Tube Rack

## Assemble the Rack

![](https://cdn-learn.adafruit.com/assets/assets/000/036/354/medium800/projects_ttRack-12.jpg?1476221136)

Black iron gas pipe and fittings are relatively inexpensive, strong, and modular, which can make them ideal for fabricating sturdy props and mounts. The parts are readily available at any hardware store.

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/036/498/medium800/projects_pipeIllo02_bp.jpg?1476378409)

This rack is optional -- you may use a normal test tube rack if you like -- but either way, it helps to have a rack before you begin mixing your potion and filling the test tubes!

![](https://cdn-learn.adafruit.com/assets/assets/000/036/499/medium800/projects_pipeIllo02_x_bp.jpg?1476378420)

Screw two of the 8" pipe nipples into the floor flanges.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/339/medium800/projects_ttRack-1.jpg?1476216515)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/340/medium800/projects_ttRack-2.jpg?1476216536)

Screw two of the pipe couplings onto the two pipe nipples that have been screwed into the flanges.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/341/medium800/projects_ttRack-3.jpg?1476216580)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/342/medium800/projects_ttRack-4.jpg?1476216646)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/307/medium800/projects_cadTestTube.png?1476210713)

Use the CAD file linked below to laser cut the acrylic rack shelves and support. Alternately, you may print the file and use it as a template to cut the rack with a scroll saw.

[testTubeRack.zip](https://cdn-learn.adafruit.com/assets/assets/000/036/306/original/testTubeRack.zip?1476210642)
Screw one&nbsp;locknut onto each end of the remaining two 8" pipe nipples. Set&nbsp;the bottom rack shelf onto the&nbsp;bottom ends of the pipe nipples and then thread these into the pipe fittings.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/343/medium800/projects_ttRack-6.jpg?1476216743)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/344/medium800/projects_ttRack-7.jpg?1476217276)

Place the acrylic support that will hold the Feather into the base and top shelves, fitting its pointed end into the square cutout.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/345/medium800/projects_ttRack-9.jpg?1476217382)

Create the crossbar by joining the two 6" pipe nipples with the remaining coupling, then screw their free ends into the elbows.&nbsp;

Place the top shelf over the leg threads, being sure to line up the vertical support with the square cutout, and then screw the legs into the elbows.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/346/medium800/projects_ttRack-10.jpg?1476217501)

To stabilize the rack, you can screw the flanges into a wooden base.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/531/medium800/projects_ttBT_base-1.jpg?1476393184)

# Mad Science Test Tube Rack

## Mix the Potions

![](https://cdn-learn.adafruit.com/assets/assets/000/036/533/medium800thumb/projects_ttBT_cu.jpg?1476394245)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/403/medium800/projects_pigment-2.jpg?1476291246)

It's mixing time. Be careful when working with the pigment not to breathe any of the very fine powder (wear a mask or respirator), and work on a surface that can be cleaned, such as a wax paper covered workbench.

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/036/404/medium800/projects_pigment-5.jpg?1476291284)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/405/medium800/projects_pigment-6.jpg?1476291320)

It only takes a very small pinch of powder per test tube. You can mix the pigment and water in each test tube -- use a stirring rod or bamboo skewer to thoroughly mix it, or place a stopper over the top, cover the hole with your thumb and shake it like crazy.

If you plan to use the same color in a number of test tubes, premix a batch in a measuring cup, mason jar, or beaker and then pour 50mL per test tube.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/406/medium800/projects_pigment-4.jpg?1476291369)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/407/medium800/projects_pigment-3.jpg?1476291383)

Shine a UV LED into your tube to see the effect!&nbsp;

Info: 

The pigment is suspended in the water, so you may need to occassionally shake it up to redistribute, or mix in a tiny amount of an emulsifier such as xanthan gum (available in health food stores and online) to keep it in suspension.

Info: 

# Mad Science Test Tube Rack

## Create the Mad Science

![](https://cdn-learn.adafruit.com/assets/assets/000/036/536/medium800/projects_ttBT_midLit-1.jpg?1476397362)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/525/medium800/projects_ttBT_details-4.jpg?1476392867)

You can now attach the FeatherWing to the vertical support of the laser cut acrylic using the M3 standoffs, screws, and nuts.&nbsp;

Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/036/356/medium800/projects_m3_IMG_7533.jpg?1476221837)

Place a standoff in each of the four holes, then affix a nut to the back side.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/357/medium800/projects_m3_IMG_7534.jpg?1476221854)

Place the FeatherWing over the four standoffs and secure with the four screws.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/528/medium800/projects_ttBT_details-5.jpg?1476392961)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/358/medium800/projects_m3_IMG_7535.jpg?1476221935)

Attach the LED wiring to the screw terminals of the TerminalBlock FeatherWing, using this circuit diagram as reference.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/501/medium800/projects_testTubeBreadBoard.png?1476378724)

With a potion-filled test tube in each slot of your rack, push a UV LED into the hole of each stopper and then place the stoppers in the test tubes.

![](https://cdn-learn.adafruit.com/assets/assets/000/036/529/medium800/projects_ttBT_details-6.jpg?1476393008)

![](https://cdn-learn.adafruit.com/assets/assets/000/036/527/medium800/projects_ttBT_details-3.jpg?1476392906)

Connect the Feather to the wall power adapter using the USB cable, and then plug the adapter into a wall outlet.

Now, turn down the lights, turn the FeatherWing power switch to ON and enjoy the spooky, mad science light show!

![](https://cdn-learn.adafruit.com/assets/assets/000/036/530/medium800/projects_ttBT_CU-1.jpg?1476393046)


## Related Guides

- [Adafruit Feather 32u4 Basic Proto](https://learn.adafruit.com/adafruit-feather-32u4-basic-proto.md)
- [Mini Smart Home with Huzzah, HASSio and Crickit](https://learn.adafruit.com/mini-smart-home-with-esp8266-huzzah-feather-raspberry-pi-hassio-crickit.md)
- [How to Choose a Microcontroller](https://learn.adafruit.com/how-to-choose-a-microcontroller.md)
- [MIDI Laser Harp with Time of Flight Distance Sensors](https://learn.adafruit.com/midi-laser-harp-time-of-flight-sensors.md)
- [CircuitPython BLE Controlled NeoPixel Hat](https://learn.adafruit.com/circuitpython-feather-ble-neopixel-hat.md)
- [CircuitPython Painter](https://learn.adafruit.com/circuitpython-painter.md)
- [Neon LED Signs](https://learn.adafruit.com/led-neon-signs.md)
- [Air Quality Sensor 3D Printed Enclosure](https://learn.adafruit.com/air-quality-sensor-silo-house.md)
- [Adafruit IO Home: Lights and Temperature ](https://learn.adafruit.com/adafruit-io-house-lights-and-temperature.md)
- [Motorized POV LED Display](https://learn.adafruit.com/motorized-pov-led-display.md)
- [Data Logging IoT Weight Scale](https://learn.adafruit.com/data-logging-iot-weight-scale.md)
- [Crickit Lab Shaker](https://learn.adafruit.com/crickit-lab-shaker.md)
- [3D Printed Truck Risers with NeoPixel LEDs](https://learn.adafruit.com/3d-printed-truck-risers-with-neopixel-leds.md)
- [Traffic Light Conference Badge](https://learn.adafruit.com/traffic-light-conference-badge.md)
- [No-Solder PaperCraft Crystal Light Strand](https://learn.adafruit.com/no-solder-papercraft-crystal-light-strand.md)
- [USB Foot Switch Controller in CircuitPython](https://learn.adafruit.com/usb-foot-switch-circuit-python.md)
