VizTimer: the Electronic Hourglass




Introduction: VizTimer: the Electronic Hourglass

When our son was about three or four years old we started expecting him to do things in a timely manner. I would say things like "We need to go in ten minutes!" or "Play with that truck for five more minutes, and then give someone else a turn". The problem was (a) he could not read a clock, either digital or analog, and (b) he had no sense of how long a minute is. I realized that he needed a clear way to see what five or ten minutes looks like, and be able to track the time remaining. So, I set out to design and build a visual timer. I had seen many variations, including the classic egg timer, but I felt like the rotation metaphor was not intuitive to very young children -- it is all about looking at angles and fractions of a circle. Once I settled on a more linear design, the idea of an electronic hourglass seemed obvious: it provides the right visual metaphor, and I could use an accelerometer to implement the ergonomics of turning it over to start and stop the timer.

My final design, which I'll show you here, is relatively simple. The visual part consists of a strip of individually addressable RGB LEDs (e.g., WS2812). Programming is accomplished with a single button (a capacitive touch button, because it is flat). An Arduino-compatible microcontroller (an Adafruit Metro) runs the program and reads orientation information from a 3-axis analog accelerometer. Power is provided by a rechargeable battery pulled from a phone power bank (a standard 18650 lithium ion). The nice thing about the power bank is that it includes the charging circuity, a micro-USB port, and it outputs 5V, which is what the microcontroller and the LED strip expect.

Depending on your level of experience you can probably make this timer in a weekend or two. You will need basic soldering skills and the associated tools and supplies. The biggest variable is the enclosure: I have woodworking power tools that make this job easier, but I'll also discuss alternative ways to build the enclosure without lots of tools.

Step 1: Materials and Tools


For the electronics:

For the enclosure

  • Wood blank (at least 1.25 inches thick) OR Plywood of various thicknesses
  • Wood strip for top and bottom (0.25 inches thick)
  • Small sheet of plexiglass or acrylic
  • Sheet of diffusion material -- thin plastic cutting mats are great:
  • #6 screws, flat head and pan head, 5/8 inches
  • Zinsser shellac, wipe-on polyurethane
  • Tape, glue, sandpaper


  • Wire cutters and strippers
  • Soldering iron
  • Hack saw
  • Wood saws
  • Drill, drill bits, including countersink bit
  • Chisels and files
  • Plexiglass cutter or utility knife


  • Table saw
  • Band saw
  • Saber saw
  • Drill press

Step 2: Prepare the Battery

The first step is to pull apart the portable charger and remove the USB A connector. These devices are pretty simple: they have a 18650 lithium ion battery and a small board that contains the charging and discharging circuitry. There are typically two plugs: a micro-USB for charging the battery (input) and a larger USB A for providing power to phone charging cables (output). We are going to use the output to power the timer, so there is no need for the USB A connector. Use a combination of a soldering iron and pliers to remove it.

NOTE: Be careful not to damage the leads that are left behind on the board. We will need to use the two outer ones.

Step 3: Add the Power Connectors

Start by soldering a 24AWG wire onto each of the power leads where the USB A connector was. I use red and black to help me remember which one is power (5V) and which is ground. On the power side, add a terminal that fits the leads on the power switch. Prepare a second red wire with a terminal on one end.

If you connect the two terminals to the switch you should have two wires ends left -- one red and one black. Join them to one side of a JST connector. I like the JST connectors for power connections because the shape of the connector prevents you from plugging it in the wrong way and frying your circuit.

Prepare a red and black wire with the other side of the JST connector.

Make sure the wires will be long enough to reach along the length of the timer (see later photos). It's easy to trim or just stuff in extra wire.

Step 4: Assemble the Control Board

The control board is fairly simple, but there are a few details to look out for. Start with a perma-proto broad that has the same pin wiring pattern as a standard breadboard (note the power rails). Trim it as necessary to make it as small as possible, leaving the power rails and enough pin holes so that you can add the necessary hookup wires.

Solder the microcontroller and the accelerometer to the board using standard headers. NOTE the orientation of the two boards:

  • Make sure the micro-USB connector faces the edge of the board, so that you can still access it for programming.
  • Note the orientation of the accelerometer because that choice will determine what it considers "up" vs "down".

Step 5: Wire Power and Accelerometer

Decide which of the power rails will be 5V and which will be ground. Add small segments of wire from the power rails to the power and ground on both breakout boards.

Add three wires to connect the three outputs from the accelerometer to three analog input pins on the microcontroller. On my set up I connected the X output to A2, the Y output to A1, and the Z output to A0.

Step 6: Wire the Power Connector

Solder the free side of the JST connector assembly to the control board. Pay attention to the polarity: make sure the red wire is soldered to the 5V power rail, and the black one to the ground rail.

Step 7: Wire the LED Strip

In this step you will decide the overall size of the timer because we want the LED strip to run the full length. I chose an LED strip with 30 LEDs at a density of 144 LEDs/meter. The total height is about 8 1/2 inches. I laid out all of the parts on the wood blank to make sure it would fit.

Most of these strips can be cut to any length -- just make sure you cut at the specified point where the pads are exposed. Solder three wires onto the exposed pads at the input end of the strip. Most strips have some sort of indicator, like a tiny arrow, showing the direction of data travel. Power can be connected on either end, but data must go in the proper direction down the strip.

Make sure the wires are long enough, so that they can wrap from the front of the timer back around to the control board. Solder the power wires into the power rails on the control board, and solder the data wire to one of the digital pins on the microcontroller.

Step 8: Add the Capacitive Touch Button

Like the power switch, the capacitive touch button needs a removable connector because of the way it is attached to the timer. My strategy here is to solder straight headers onto the button, then solder a three-wire Dupont cable to the control board. The "female" Dupont connector fits the spacing on the header pins perfectly.

Solder the power and ground wires to the rails on the control board, like you did for the LED strip. Wire the data line (which will read "high" when the button is pushed) to one of the digital input pins on the microcontroller.

The complete circuit is shown in the final photograph. At this point you can power it up and, if you want, upload the code and test it.

Step 9: Lay Out the Enclosure

My enclosure is made primarily from a slab of maple about 8 1/2 inches long, 2 1/2 inches wide, and 1 1/4 inches thick. Use the LED strip as a guide for cutting the length, adding an extra 1/8 inch for wires and clearance.

The electronics should fit comfortable on the wood slab, with the battery and switch on the lower half, and the control board on the upper half. The final timer will actually have two separate enclosure spaces for these components.

Step 10: Alternative Enclosures

I realize that not everyone has the tools needed to make the enclosure described in the next several steps. There are a few alternatives that still come out very nice.

One strategy that will result in a very nice, modern-looking enclosure is to cut pieces of plywood into the necessary shapes and glue them together like a sandwich. This approach can be accomplished with just a few hand tools. You can get small pieces of high-quality plywood in various thicknesses at hobby and art supply stores.

Step 11: Slice Off the Front

In my first prototype of this timer, I drilled and chiseled out the spaces for the electronics, which turned out to be a huge pain, and I could never get it to look completely clean. Instead, I resaw the wood blank -- that is, I cut it into two boards that are the same size, but different thicknesses. The thin part becomes the solid front, which the thicker part becomes the part that holds the electronics.

To make sure that the spaces will be big enough I use the thickness of the battery to determine where to cut. This step can be done with a hand saw, but using a band saw makes it easier and more precise.

TIP: Mark the end of the board with a triangle or other mark right after you cut it, that way you can easily remember exactly how the two boards go back together.

Step 12: Lay Out and Cut Space for the Electronics

Working with the thick part, I lay out the rough shape of the timer. The walls of the enclosure will be about 3/8 inch thick. Use your electronics as a guide for the sizes of the spaces: the battery needs to fit in the lower space, the control board needs to fit in the upper space.

Start by drilling out the corners of the spaces. We will completely remove these rectangles, which is a quick job using a saber saw. Clean up the edges using a file and/or sandpaper.

Now you can dry-assemble the enclosure and make sure the electronics will actually fit!

Step 13: Cut Holes for the Connectors

It's a lot easier to cut the holes for the power switch and micro USB (for charging) before we glue the assembly together. Measure using the actual switch and charging board, and cut using a small saw. Clean up with files to get a tight fit.

We also need to cut a channel between the two chambers of the enclosure in order to connect the power. You can use any combination of chisels and saws -- this part doesn't need to be pretty because it won't be visible. But make sure it is wide enough to allow the JST connector to pass through.

Step 14: Glue the Enclosure Together

Glue the two sides of the enclosure together. Look carefully at your markings and at the wood grain to make sure you are glueing them back together the right way. You want the end result to look as though you never sliced the board at all!

I found it tricky to keep the boards aligned when clamping them, so I used a large parallel clamp at the top and bottom to keep everything from sliding around.

Step 15: Make the Top and Bottom

The top and bottom pieces can be whatever size and shape, and whatever wood you like. The only requirement is that it be thick enough to accommodate the capacitive touch button breakout board.

The part I found the most challenging about this step is getting the pieces lined up when I drilled the screw holes. My strategy is to drill the holes in the top and bottom pieces first, then line them up and mark the holes on the ends of the timer. Make sure you countersink the screw holes enough that the screws will not protrude -- otherwise the timer will wobble when you try to stand it up.

I still ended up with parts that were slightly askew. You can fix this problem by glueing a toothpick into the old hole, waiting for it to dry, cutting it off, and drilling a new hole.

Step 16: Cut Recess for Capacitive Touch Button

The capacitive touch button is on the end of the timer closest to the control board. This is the end that will be up when you set the timer and down when it is running. As with the screws, it is important that the button not protrude from the wood, otherwise the timer will be unstable when you turn it over.

Measure and cut a hole big enough to accommodate the pins of the board and the 3-wire Dupont connector from the control board. Place the button in position and trace the outline of the board. Using a combination of drilling and chiseling, form a recess that allows the button to sit low enough, so it does not interfere with the timer sitting flat on. I also found it helpful to trim the leads on the top of the board to make them as short as possible.

Step 17: Drill Holes in the End of the Timer for Wires

Both the capacitive touch button and the LED strip need wires that run from the inside of the enclosure. To make space for them, drill two holes in the end of the timer through to the inside of the enclosure.

The first hole make space for the three wires that power the LED strip. The shape is not crucial, but you need to carve out a little of the front of the timer so that they can bend around to the front.

The second hold runs from the control board to the capacitive touch button. The position and size of this hole should match the hole you cut in the previous step. Line up the top and mark the hole. Drill and chisel until the three-wire Dupont connector goes through cleanly to connect to the button.

Step 18: Cut Plexiglass Backing

The back of the timer is clear plexiglass, which holds the electronics in and shows them off! Trace the outline of the enclosure and use a scoring tool or utility knife to score the plexiglass. Cut the score line a few times to make it deep. Line up the score line with the edge of the table, and with a quick downward motion snap off the plexiglass piece. It should break cleanly.

This technique only works with breaks that run all the way through the plexiglass, so it might require two breaks to the get the right size. Leave the protective film on for now.

Step 19: Drill Holes for Backing

Line up the plexiglass back and tape it securely. Drill a hole at each corner for a small screw. I used 5/8" pan head number 6 screws. Be careful not to drill too far into the wood. Center the screw holes in the available wood at each corner to give maximum holding power.

Step 20: Mark the Back Alignment

One problem I've run into in the past is that I forget how the plexiglass was oriented when I drilled the holes. Small differences in the positioning of the screws, however, often mean that it won't fit any other way. Rather than guess, I create a mark that tells me exactly how the pieces should be oriented.

Before you remove the tape, use a file or a small saw to cut an asymmetric divot through the plexiglass and the wood. This mark will only line up when the pieces are in the right position.

Step 21: Cut Hourglass Shape

Now that the enclosure is essentially finished we can cut the hourglass shape. The exact dimensions are not critical, but make sure you don't weaken the enclosure too much by cutting close to the inside boxes.

Keeping the tape on, cut through the wood and the plexiglass at the same time. I used a band saw, but most hand saws can cut through both materials. Clean up the cuts with files and sandpaper.

Step 22: Cut Groove for LED Strip

The front of the timer has a groove to accommodate the LED strip as well as the diffusion material. Line up the LED strip and trace its outline on the wood. Add a set of parallel lines about 1/8 to 1/16 outside of those lines to mark when the diffuser will go.

This step is the most difficult without the proper power tools. I used a table saw with a dado blade to cut a deep channel for the LEDs (the inside lines). Make sure you don't cut through to the inside of the enclosure! Next I cut a shallow channel for the diffuser (the outer lines). Test fit the LED strip and make sure the leads comfortably reach around to the control board.

You're pretty much done at this point!

Step 23: Sand and Finish

Sand all three wood parts using 220 or higher sand paper. I also like to add a small bevel along all of the right angle edges to give the enclosure a more refined look and to make it more pleasant to hold.

I start with one or two coats of shellac, which sinks into the wood and really highlights the grain. It dries fast, so you won't need to wait long. Once dry, sand lightly with 320 or 400 sandpaper to even out the surface. But don't overdo it: you should still be able to see some of the glossy finish.

Next I apply a coat or two of wipe-on polyurethane, which is a tough, but attractive finish. You can buff it lightly with steel wool once it is dry.

Step 24: Assemble the Electronics

Start the final assembly by feeding the LED strip from the inside of the enclosure through to the channel on the front. Peel off the sticky tape or use a small amount of glue to affix the strip to the channel.

Next, hot glue the capacitive touch button into the recess in the top. You should be able to see the pins sticking out through the bottom. Make sure the button is flush (or lower) to the surface of the top part, so the timer doesn't wobble.

Insert the battery in the bottom compartment and feed the USB connector through. Use some hot glue to make sure it is secure in the space.

Add the control board to the top compartment of the enclosure. Feed the JST connector from the battery through the hidden channel in the center of the timer. Connect it to the JST connector on the control board.

Feed the 3-wire Dupont connector from the control board through the hole in the top and connect it to the pins on the bottom of the capacitive touch button.

Push the on/off button through the hole in the side of the enclosure (from the outside), until it sits snugly in place. Attach the two wire terminals to the two leads on the switch.

You should have the set up shown in the last photo.

Step 25: Finish Assembling the Enclosure

Line up the plexiglass and secure it in place with four screws. Screw on the top and bottom pieces. Check the alignment of everything and make sure the timer sits flat on the table on either end.

Step 26: Add the Diffusion Material

Cut a strip of diffusion material that is slightly wider than the channel around the LED strip. This will cause the diffuser to bow out a bit, holding it in place without glue, and providing more diffusion. In the general, the farther the diffuser is away from the LED, the more diffuse it makes them.

There a many suitable materials. I have used thin plastic cutting mats (cheap on Amazon) and this plastic "poster board" (which is thin and floppy, and not "board" at all).

Step 27: Customize and Upload the Code

Download the code from You will also need the FastLED library, which provides the low-level drivers for the LEDs. The parts that you are most likely to need to change are right at the top: the five pins (the LED pin, the capacitive touch pin, and the three accelerometer pins). You might also need to set the number of LEDs in the strip.

Feel free to explore and modify the code!

Connect the control board to your computer and upload the code. You will need to remove the plexiglass backing to get at the micro-USB connector on the microcontroller.

Step 28: How to Use It

The goal of this design was to make setting and running the timer as simple as possible.

The timer has three modes: program mode, timing mode, and pause mode. The mode is determined by the orientation of the timer: program mode when the capacitive touch button is on the top, timer mode when it is on the bottom, and pause mode when the timer is on its side.


When you first turn it on you will see a blinking yellow "cursor" at the bottom of the LED strip. Touch the capacitive button to add time in 15 seconds increments. Each 15 seconds is shown as a purple dot. When you get to 60 seconds, the purple dots are replaced by a blue dot, which represents a minute. Hold the button down to add minutes continuously until the button is released. Every fifth minute dot is colored white to make it easier to see the total.


Turning the timer over starts the countdown. All of the dots start out lit up, regardless of the total time -- this was a design choice on my part. You could also program it so that each dot always means the same amount of time.

Dots fall one by one until the time is up. Then the timer displays a colorful "finale" for about 15 seconds. To go back to program mode, turn the timer back over. The yellow cursor will show again. If you start the timer again immediately without programming it, it will use the previous amount of time.

A nice addition to this timer would be a small speaker to play sounds, especially an alarm sound at the end.


During timing mode you can pause the timer by turning it 90 degrees and resting it on the side. The timing dots freeze in place, and pulse gently to indicate that the timer is waiting to be restarted. Turn it back to continue timing, or the other way to go back to program mode.

I hope you enjoy this device as much as I do!

Make it Glow Contest 2018

Participated in the
Make it Glow Contest 2018

1 Person Made This Project!


  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Make It Bridge

    Make It Bridge
  • Big and Small Contest

    Big and Small Contest



4 years ago

Inspired by this, here's my take on the idea.

2019-01-21 14.24.44.jpg

Reply 4 years ago

Wow, beautiful! I love the wood and the shape. And the diffuser on the LEDs looks great. What material is it?


Reply 2 years ago

Its a sort of 'linear lens' shape, printed in clear PLA, with 15% fill. Apple wood from the hurricane of 1987.


4 years ago

Excellent build! Currently working through this, and have put all of the electronics together, though when i plug the USB into my laptop and attempt to upload the code, it says "Problem uploading to board", and I have a Windows error saying, "Power surge on USB port - Unknown USB device needs more more power than port can supply." I am sure that the port itself is fine because if I plug my phone in, it is able to charge.

Am I missing something here? Any help would be appreciated!


Reply 4 years ago

Hi! Sorry it took me so long to reply. Typically, you get that message if you have a short somewhere in the circuit. Sometimes it happens if you try to power the hourglass completely from the USB port, but that is less likely. Unplug everything and check the connections. In particular, look for places where you might have accidentally reversed the polarity -- that is, plugged a wire that supposed to be 5V into the ground, and vice versa. That is the most common cause; I've done it many times myself!


Reply 4 years ago

If you have a multimeter, use the continuity check or resistance check to make sure there is no direct path from power to ground.


Reply 4 years ago

Thanks for getting back to me! The power surge was resolved after it seemed like my inadequate soldering job caused a short somewhere in the circuit. I've managed to upload the code, however I now face the issue with the LED strip - it just doesn't seem to light up. I used a multimeter on either end of the strip itself and there seemed to be connection all the way through the strip. I tried powering it with a 3V battery separately but there was still no illumination. (The working voltage of the LED strip is 5V though I would've thought there should be some illumination).I also tried connecting the battery to the remainder of the LED strip that wasn't cut-off and used for the project and no illumination. Any thoughts of why it may not be lighting up?


Reply 4 years ago

Don't worry, I have solved the above! The data cable on the strip was faulty, so replaced it.


Reply 4 years ago

I am currently having an issue regarding the accelerometer, however. For some reason, the values do not change on the serial monitor when i move the controller. What's interesting is that it does detect temperature when i touch the active pins on the accelerometer. I understand that the output readings from the code are set to milli-g's, so it would detect small changes in heat, but why wont it detect position? Any help would be truly helpful, thanks!


4 years ago

After more testing, I found that the "disco" display at the end of the timer works up to 2 minutes and 15 seconds. When I set the timer for 2 minutes and 30 seconds - the LED's all fell in their proper sequence - and then all the LED's went off. When inverted - no cursor and no auto restart as with the lesser time values. Has anyone else had this happen? I read through the sketch, but I am not real good at programming (yet) to figure out if it is a code thing. This is a beautiful piece and will be a wonderful gift for my 5 year old granddaughter if I can solve the end time display issue.


Reply 4 years ago

Sounds like a bug of some sort, but I haven't seen anything like that. Can you tell me more about the hardware setup you have?


Reply 4 years ago

I got all the exact same parts you had listed - except for the main board. I had (and used) an Arducam Pro Mini #B0026. Its a 16MHz with an Atmega328P-AU chip. I sized mine for 40 LED's and edited the code for that.


Reply 4 years ago

Can you send me your modified code? I'll take a look


4 years ago

3D printed hourglass - thanks for a wonderful project. Designing and printing the 3D enclosure was fun. Works great - except:
Up to 2 minutes the display runs its course and makes the multi color blink for 15 seconds and then shuts off, and will auto restart when inverted. When I run it for 3 minutes, the display runs its course and then abruptly shuts off, and needs to be reset manually to work again. Not sure why this happens.


4 years ago

Error message when verifying. Where do I get this library that works? I found two at Github but they didn't work. This is the library "Accelerometer.h".
\VizTimer-master\VizTimer\VizTimer.ino:2:27: fatal error: Accelerometer.h: No such file or directory


Reply 4 years ago

Oops! Those were separate libraries. What I did is just copy the contents right into VizTimer.ino. I just pushed the changes to GitHub, so if you update your repo you should get a copy that compiles. Sorry about that!


4 years ago

Hi there
If you think it was good, you're so wrong, because it was been fantastic.
Can I build this with arduino nano?
Keep making such amazing stuff like this


Reply 4 years ago

Funny comment -- thanks!
Yes, you can definitely build this project with an Arduino Nano. It is almost identical to the Adafruit Metro that I used. In fact, you can use any microcontroller that runs on 5V and has at least 3 analog inputs, 1 digital input, and 1 digital output.


Reply 4 years ago

what about using ADXL345 instead of ADXL335 and TTP223 instead of AT42QT1010?