Sunday, July 24, 2016

Countdown timer for a PhotoBox

One day a colleague from our Laser department (YES we have Lasers!) stood next to my desk and started to ask some suspicious questions about 7-Segment displays and how to control them with an Arduino.

In general its not a problem, I like to share my knowledge about electronics and programming etc., but I hate it to answer questions without knowing the circumstances. So I asked him what the target of the project would be and he said he wanted to program a countdown timer and that he also has not really the time to do it. He also told ne that the project is not for him, its for Murat (Also a guy from the Laser department).

Later that day I went to Murat and asked him about the details of the project and what the main goal would be. He told me that he want to build a PhotoBox for his sisters wedding. I told him that if it is for his sisters wedding it should not only be some 7-Segment displays. He would need something which looks much fancier with more animation and special effects than a 7-Segment display is able to provide, and I showed him my work that I have done with the 3208 lattice clock and that something similar could be done for a countdown display.

He said he would like to have something that does the following:

  • Push a button
  • Countdown starts
  • End of the countdown a Relay is triggered
On that evening I went home and started to dig out my spare 3208 Lattice Clock module and a relay board. I soldered some connectors for power supply, relay output and programming to the board, and started to play with it. After some hours I came up with the following animation:

In the video itself it is not very clear, but the sequence is as follows:
  • Press RESET or reconnect the power to start
  • Dim up the first number in the middle of the screen
  • Shift the number out to the left while the new number comes from the right
  • When the 0 is reached then dim it out
  • Actuate the relay output for one second
  • Wait in idle until RESET or re-power
The complete code including the control for the HT1632C is in one single Arduino sketch with less than 300 lines of code. I apologize for the German comments in the code But it was quick and dirty written. The code can be found in my GitHub repository

So far my work was done for this project. Murat also sent me some pictures of the finished project where he put it all together into a nice box with a tablet as picture preview.
Sadly Instagram changed their logo recently.

HotKey 3

Building and Programming a prototype

Wiring up the Keypad to the Arduino Leonardo

To wire up the Keypad to the Arduino Leonardo I've soldered some thin copper wire to the connector of the PCB and connected it to an external proto board as you can see in the picture below.

After that was done I wired up a simple adapter board for the Arduino Leonardo.

The schematic for this board is quite simple. It just consists of a 10Pin connector for the keypad, an RGB LED and two connectors for the LC-Diaplay and the Serial debug connection.

Creating the Program / Sketch

After the Keypad was wired up to the Leonardo I had to figure out a way to find get the key presses properly into the Arduino. THANKFULLY there was already a library on the Arduino page which does exactly THAT. I've played around a little bit with it and it seem to work properly.

I've created some test sketches and uploaded them into my GitHub repository.

Now I will need to find a way to replace the original PCB of the Keypad.