My 6 year old still has no sense of time. When I tell her she can continue to play for 2 minutes before coming to dinner, 30 seconds or 10 minutes could pass and she wouldn’t know the difference. I started setting the timer on the microwave but she couldn’t see it ticking down from her playroom or hear the buzzer from her bedroom. So, I decided to create a portable timer that I could place next to her which would give her a visual indication of the passage of time.
with a simple numeric countdown on a 16x2 LCD panel but it really wasn’t very
interesting. And, even though she could count and know that 45 is a lot more
than 15, it didn’t really give her a sense of how much time was really left.
So, I moved to a visual – an hourglass on an 8x8 LED matrix. An 8x16 matrix is
really the minimum for a good representation of an hourglass in my opinion;
either way, an hourglass isn’t exactly a compelling thing to look at either.
After playing around with a few other visuals and levels of animation, my daughter and I settled on this design – multi-color drops falling and pooling up as time passes. Every few seconds, 1/64 of the countdown interval to be precise, a drop pools up – aka an LED remains on. Once, all the LEDs are kept on, then time is up and the entire LED matrix flashes and the buzzer sounds. To make it more flexible for a variety of situations, different countdown intervals can be selected – 1 minute, 2 minutes, 5 minutes, etc. And, to make it more interesting, the countdown interval can be remotely set by speaking into my Windows mobile phone. Once time is up, I have the option to give her additional time, again by speaking a countdown interval into my Windows mobile phone, even if we are in the same room (as long as I am in Bluetooth range of the LED matrix).
The core components of the project are an Arduino Uno, an neopixel 8x8 RGB LED matrix, and a Bluetooth module. The cool thing about the Adafruit neopixel matrix is that only a single Arduino pin is required to control it so there are plenty of pins left for all kinds of additional functionality. The Bluetooth module is used to communicate between the mobile phone and the Arduino. The Windows Virtual Shields for Arduino app runs on the Windows Phone 10 and enables me to utilize the phone's capabilities in my Arduino sketch.
This is a beginner project and no advanced software or hardware skills are required. Excluding the prerequisites, this project can be completed in 30 - 45 minutes if you have any Arduino. If this is your very first electronics project, I recommend that you spend a couple hours watching a few introductory Arduino videos prior to getting started.
If you make any enhancements or hacks, please leave a comment and let me know how it went. I am really interested to see what kinds of countdown designs you create or how you integrate other Virtual Shields capabilities into your project.
Here are some online resources that I found very helpful throughout the course of this project:
- Microsoft's Windows On Devices has
a very good step-by-step guide to get started with Windows Virtual Shields for
- Adafruit's Neopixel Uberguide provides a lot of detail on how to work with the LED matrix.
- Nulsom's LED matrix library for Arduino also works with this hardware.
- There are countless videos on YouTube to help you started with Arduino including the installation of the Arduino IDE and connecting the microcontroller to your PC. I highly recommend Jeremy Blum’s Tutorial Series for Arduino.
your Arduino for the Windows Virtual Shields (instructions here).
your Windows phone and PC for the Windows Virtual Shields (instructions here).
It will take 2-3 hours to complete the prerequisites if you don’t have Windows
10 and Visual Studio 2015 already setup but most of that time is unattended.
- Arduino Uno and standard A/B USB cable
- Neopixel 8x8 RGB LED matrix
- Bluetooth module
- Piezo buzzer
- Male-male and male-female jumper wires
- Lumina 635 (or other Windows Phone 10 compatible device)
- Optional: right angle header - male or female
- Optional: portable 5v rechargeable battery charger
- Soldering iron and solder
Step 1: Connect the LED matrix to the Arduino
Time: 15 minutes
Parts: Arduino Uno, neopixel 8x8 RGB LED matrix, 3-pin header, jumper wires, mini-breadboard
Tools: soldering iron, solder
I tried a few different LED matrices but I had difficultly getting some of the shield type ones working for this project. They would work fine by themselves but I was unable to get them working when I hooked up Bluetooth. Beyond the physical issues - the shields took up all the pins - there were also technical ones - likely a conflict with D0 and D1 (Arduino's RX and TX pins). So, then I tried the neopixel matrix. It worked perfectly: only one control pin was required and no RX/TX conflicts.
Before wiring the LED matrix to the Arduino, I had to solder a three pin header to the LED matrix. The choice of straight headers or 90 degree headers really depends on how you are going to mount the LED matrix. And, male vs female headers really comes down what type of jumper wire you have. Or, as in my case, the header decision was completely driven by what I had on hand - 90 degree male headers. Alternately, you could just solder the jumper wires directly to the LED matrix but I like the flexibility that the header pins provide.
Only three connections are required between the neopixel LED matrix and the Arduino. First, use a male-male jumper to connect Arduino's 5v pin to an unused row on the mini breadboard. Then connect a male-female jumper from this power rail to the LED's 5v pin. Use another male-female jumper to connect the Adruino's ground to the LED's GND. And, to control the LED matrix, connect a male-female jumper from any of the Arduino's digital pins (except for pin D0 and D1) to the LED matrix's digital input (DIN) pin. For my project, I used digital pin 9.
Note: The order of the 5v, GND, and DIN pins vary across manufacturers so double check the labels on the LED matrix before connecting your wires.
Step 2: Test out the LED matrix
Time: 5 minutes
Almost all LED matrices come with a library to get you up and running quickly. The Adafruit matrix was no exception as it comes with its own library. However, I prefer the library provided by Nulsom. I haven't looked under the covers yet to see what the differences are but I found the project worked a bit better with the Nulsom library - LEDs turned off consistently when I cleared the matrix and the virtual shield worked more consistently.
I downloaded the library files from the Nulsom website and copied them to my Arduino\libraries folder. Then I launched the Arduino IDE, opened one of the example sketches, and uploaded the sketch to my Arduino. Ahh, pretty lights!
Step 3: Connect Bluetooth module
Time: 5 minutes
Parts: Bluetooth module, jumper wires
This is the first time I used a Bluetooth module - it was super easy and now Bluetooth will run rampant in my projects. The BlueSMiRF Silver module I purchased from SparkFun is essentially a serial cable replacement. I did have to solder on a male header pin but once that was done, I was ready to roll.
Plug the Bluetooth module into the breadboard to make connections easier. To power the module, run a jumper from the power rail created in Step 1 to the module's Vcc pin. and run a male-male jumper from the module's GND pin to any of the GND pins on the Arduino. To establish the serial communications, connect a male-male jumper from the Bluetooth module's TX pin to the Arduino's RX pin (digital pin 0) and another from the module's RX pin to the Arduino's TX pin (digital pin 1).
Note: You will not be able to upload sketches from the Arduino IDE to the Arduino when you have the Bluetooth's TX and RX pins connected to the Arduino. Disconnect them when you need to upload a sketch and reconnect them once the sketch has been successfully uploaded.
Step 4: Connect the Peizo Buzzer
Time: 5 minutes
Parts: Peizo buzzer, jumper wires
The peizo buzzer has just two pins. Insert the buzzer into any unused rows in the breadboard and use jumpers to connect the peizo pin marked '+' to a digital pin on the Arduino (I used pin 3) and the pin marked '-' to a GND pin on the Arduino.
Step 5: Download and Deploy the Code
Time: 10 minutes
Now that you have everything wired up, download the code from github and load it into the Arduino IDE on your PC. Be sure to unplug the Bluetooth module's TX/RX jumper wires and then upload the sketch. Reconnect the TX/RX jumper wires to the Arduino's digital 0 and digital 1 pins.
Launch the Virtual Shields app and pair the phone to the Bluetooth module. Refer to prerequisite #2 above if you need instructions.
Finally, push the reset button on your Arduino to restart the sketch.
When prompted speak the countdown time into your Windows phone - i.e. one. Then, the LEDs will start doing their thing.
Step 6: Make it Portable
Time: 5 minutes
Parts: 5v rechargeable battery charger
The key to portability is being able to power your countdown timer independent from your PC. You could use a wall-wart / plug but then you still have to hunt around for a wall outlet. I much prefer to use a portable rechargeable battery charger so that the countdown timer can go anywhere - including the yard.
Charge the charger using your PC or a wall-wart when you get it. Then, connect the Arduino's USB cable into the charger, and voila, the Arduino is powered and portable.