My brother recently got married and as per the rules of engagement, the lead up to the event included a Stag night.
For my Stag night, I was given a hard hat complete with a flashing LED light and plastic antlers.
I decided I wanted to make something special for my brother. Something minimalistic, but effective.
The result was this…..
It was my first project using an Atmel AVR microcontroller. I’ve always planned on using an AVR, but normally settled for a simpler device such as a PIC or PICAXE, but this time I was determined to take the plunge and learn how to program the AVR.
To add difficulty to the project, I wanted to use a real time clock crystal too. This upped the ante a lot. It meant using the internal clock for the processor, external clock for the time counting and interrupts to decrement the displayed count.
I decided to use a pair of Red 4-digit 7-segment serial displays from SparkFun to simplify the display side of things. These turned out to be an excellent choice as they also support SPI control meaning I could send data to both displays with only four pins.
Here’s a sketch from my notebook of the schematic. It’s probably wise to add some capacitors to smooth the power supply. I was using batteries and the aim was small size and low weight.
The button is used to program the time remaining. I wrote some interesting code to de-bounce the input. The button is held in for about 5 seconds, then it goes into program mode where each single digit can be incremented and a two second hold jumps to the next digit. The programmed time is then stored into the EEPROM.
The Red LED on the top of the helmet is turned on at the start of each second for the period of time it takes to update the display (about 75ms) before it’s turned off and the microcontroller goes into a power saving sleep mode.
And, the most important part, here’s a photo of the helmet in use by Mr Pixel. This was 6 days, 18 hours, 18 minutes and 18 seconds before the wedding. I was unable to get a picture with the flashing LED lit up as it stays lit for such a brief period of time.
While we were out and about, people seemed to quickly work out what the numbers meant and were very interested to find out where to buy one from.
Overall, a successful endeavor.