Zonnestroompanelen in Nederland

duurzaamheid achter de meter

(24) Arduino countdown timer with two displays and a buzzer part 1: design and construction of the Display Terminal

Summary
Having a timer at hand can be handy for instance to sound an alarm when a specified amount of time has passed. The current project was started to have available on my desk an independent timer that warns me that a lot of time has been spent on computer issues and that the moment has come to start doing something else instead of sitting in a chair, typing Arduino instructions and running test sketches. The design includes an Arduino Nano, a potentiometer to set the timer duration, start and reset buttons, a four character 7-segment led digital display to indicate time remaining, a 8×8 dot matrix to display the final seconds countdown to zero, and a simple piezoelectric buzzer. The entire construction consists of two separate units that are connected with a cat5 LAN patch cable: a Box (containing the Nano, buttons and buzzer) and a Display Terminal. In real life the latter unit is positioned on top of my computer monitor. The display timer is described here because it was the first of the two units completed.

 

Introduction
A timer is a very useful device if one wants to be warned that a certain amount of time has passed or that it is time to stop an existing activity to begin a new one. The wind-up alarm clock in the bedroom of my grandma is one of the oldest applications. Mechanical alarm clocks have been replaced by electronic ones. My kitchen sometimes sounds a cacophony of electronic buzzes when timers switch off devices when some cooking related activity has been completed. My induction cooktop, the electric water kettle and the magnetron oven are typical examples of such timer equipped gear.

Figure 1: My countdown timer design. An Arduino Nano calculates remaining time and displays the minutes and seconds on a four character 7-segment led display. To enhance the countdown, the final 9 seconds are also displayed on a 8×8 dot led matrix driven by a MAX7219 controller. A piezoelectric buzzer begins making annoying sounds at countdown = zero. Two buttons are necessary: a start button and a button to reset the countdown timer. The pot meter sets the duration of the countdown.

With some electronic components and an Arduino it is very well possible to create your own timer. The Arduino does all the calculations, monitors buttons and governs the displays. Start time is controlled by setting a potentiometer. The displays: a four-character, 7-segment led display to show seconds and minutes of time remaining and a 8×8 dot led display for the final nine-to-zero seconds countdown, are combined in a construction called a Display Terminal. From this device a 8-wire cable runs to the Box that contains the Arduino, buzzer, pot meter and the control buttons. When time is up the buzzer starts its job: buzzing annoyingly. Pressing the reset button restarts the cycle.

Display Terminal and Box in schematics
Before focusing on the Display Terminal the wiring diagram for the entire construction is here for inspection. A cable connects the Box and the Display Terminal.

Figure 2: Wiring of the timer construction. The wires connecting the 7-segment led display and the 8×8 dot matrix display are bundled in a cable and connect the displays with the box.

Display Terminal: Electronics and supplies
1x MAX7219 8×8 dot led matrix module, 1x TM1637 4-character 7-segment display, 60 x 80 mm soldering board, nylon and copper spacers, Cat5 LAN cable, green led, 1x 560Ω resistor.

Figure 3: Construction of the Display Terminal. Front and back. A discarded Cat5 patch LAN cable was used to serve as connecting cable. The connector on one end of the cable was cut, the wires stripped and soldered to the pins of the TM1637 and MAX7219 components.

Cable connectivity: RJ45 pins and wires

The 7-segment display has four pins, labeled CLK, DIO,VCC and GND. The MAX7219 has 5 pins, labeled CLK, CS, DIN, GND and VCC. Obviously, GND and VCC can be combined inside the terminal, so we need for the connection with the Box a cable with only one VCC wire and one GND wire. To connect everything properly the number of required wires is seven. A LAN patch cable carries eight wires which leaves us with one spare wire. The luxury of having an extra wire tempted me to mount a green indicator led on the Display terminal and to use the spare wire to provide signal to the led. To have the led burn with reduced intensity a 560Ω resistor was placed between the cathode and GND. The color coding of the patch cable and the RJ45 connectors is shown in Figure 4.

Figure 4: Color coding and pin outlay of the cat5 LAN patch cable construction of the Display Terminal. GND and VCC of the dot led display and the 7-segment 4-character led display are combined, and the redundant 8th wire of the patch cable is used to drive a (green) control led). In the final design the Display Terminal has no chasasis RJ45 connector; I took a broken patch cable, cut off one connector and soldered the patch wires directly onto the corresponding pins of the displays and the control led (as can be seen in figure 3).

 

Figure 5: Working laboratory bench model of the Box, showing half-finished parts that will be assembled into the Box. The Arduino Nano is in its final construction mounted on two rows of pin headers soldered on the horizontal print board (‘base board’). Attached vertically to the base board is an additional, smaller print board that carries the patch cable connector. The start button and the pot meter are already soldered on their own ‘petite’ board. The buzzer and the reset button are still on a prototyping breadboard.

Added later: The Box is now completed and its design, construction discussed in the second part of this series.

Figure 6: Display Terminal in operation – working with the laboratory bench model of the Box. Currently set at 30 minutes run time the buzzer starts to make annoying sound at time = 0, and the timer must be restarted by pressing the reset button to run the next cycle

Sketch
Operation of the  Display Terminal and the buzzer is controlled by the sketch ‘timer_arduino.ino‘. You can download a working version of the sketch here. This sketch is a modification of an original 4-segment led display timer sketch by Gavin Lyons.
(as the sketch is under continuous development; a final version will be supplied when part 2 of this paper, “Design and construction of the Box” is published)