Zonnestroompanelen in Nederland

duurzaamheid achter de meter

(27) Arduino countdown timer with two displays and a buzzer part 2: design and construction of the Box

In the first part of this two-part article series I discussed the construction of a Display Terminal that consists of a 8×8 dot led matrix display combined with a 4-digit, 7 segment display. This unit is connected through a standard 8-wire LAN patch cable with the main unit: the Box. The latter contains the microprocessor, a buzzer and control buttons. The current article focuses on the design and construction of the Box. Together, Display Terminal and Box form a countdown timer which displays remaining time in minutes-second format, then counts down the last 9 seconds on the dot led matrix and finally sounds a piezoelectric buzzer.
The Box consists of two separate modules: a main ‘Machinery’ module which has a Arduino Nano on board and a female RJ45 port, and an auxiliary ‘Button’ module that hosts the control buttons and the buzzer. Both modules are connected with Dupont wires and they are mounted in a transparent acrylic case.

Figure 1: The complete countdown timer design. An Arduino Nano calculates (remaining) time and displays minutes:seconds on a four-character 7-segment led display. To enhance the countdown the final 9 seconds are co-displayed on a 8×8 dot led matrix driven by a MAX7219 controller. Both displays are combined in one unit: the Display Terminal. The lower part of the schematics shows the contents of the Box: Arduino Nano, buzzer, control buttons, potentiometer. The piezoelectric buzzer becomes active at countdown = zero. Two buttons are important: a start button and a button to reset the countdown timer. The setting of the potentiometer determines the duration of the countdown.

One exciting and very practical Arduino project is to build a countdown timer. This timer displays remaining time in minutes:seconds format, additionally counts down the last 9 seconds on a dot led matrix display, and then sounds an alarm signal to signal that time is up. Practical considerations led to a design with two units: a Box that can be placed on a desktop, containing the main machinery, control buttons and buzzer, and a separate, compact dual display unit, named the Display Terminal, that can be hung on a wall or attached to a cupboard. Connection between the two units is via a cable. Figure 1 shows the components involved in this project and the wiring diagram.

Display Terminal
The completed Display Terminal is shown in Figure 2. As its construction has been discussed in the first article in this project, it is shown here only for convenience.

Figure 2: Display Terminal. Front and back. A discarded Cat5 patch LAN cable connects the Terminal and The Box. The male connector on one end of the cable was cut, wires exposed, insulation stripped and the wires soldered to the pins of the TM1637 and MAX7219 components.

Cable connectivity between Display Terminal and Box
In the Display Terminal the 7-segment display has four pins, labeled CLK, DIO,VCC and GND. The MAX7219 dot matrix unit has 5 pins, labeled CLK, CS, DIN, GND and VCC. As GND and VCC of both displays can be combined we need for the connection with the Box a cable with one VCC wire, one GND wire and five control wires. As a Cat5 patch cable carries eight wires such a cable can be very conveniently applied here. One end of a discarded patch cable was cut off. The ends of the wires were 2 mm stripped and then soldered to their corresponding pins on the Display Terminal board (Figure 2). The 8th wire was used to supply power to a green indicator led on the Display Terminal. Figure 3 illustrates the color coding of the wires and the connections of the wires to the pins of the male RJ45 jack (at the end of the cable from the Display Terminal) and those on the female RJ45 port that acts as the output outlet of the Box.

Figure 3: Color coding and pin layout of the cat5 LAN patch cable construction of the Display Terminal. GND and VCC of both displays are combined, and the 8th wire of the patch cable is used to drive a (green) control led.

The Box: Electronics and supplies
Module 1 (‘Machinery’): 1x soldering board 60×40 mm, 1x soldering board 70×30 mm, 1x breakout female RJ45 port, 2x 15-pin female pin header, 2x 15-pin male pin header, 1x 2-pin male pin header, 1x Arduino Nano, wire,
Module 2 (‘ Button panel’): 1x soldering board 80×20, 1x soldering board 70×40, 1x piezoelectric buzzer, 1x 10kΩ pot meter, 1x push button, 1x capacitive switch button, 1x 220Ω resistor, wire, 2 x M3 nylon bolt/nut.

Box housing
As a case for the Box I took a discarded 70 x 140 x 70 mm acrylic luxury chocolate box. Openings and holes can be cut and drilled in this material with some effort and care. These openings are necessary to permit the mounting of the Box’s components, to create ports and to let a usb power cable pass.
On the bottom of the case a fitting piece of 4 mm MDF was placed to support the ‘Machinery’ module. The lid of the chocolate box supports the ‘Button’ module. Both modules are connected via Dupont wires.

Module #1 (‘Machinery’)
The ‘Machinery’ module consists of one soldering board that acts as a support for the breakout female RJ45 port. This long edge of this support board was attached to the short edge of the main soldering board that supports the Arduino Nano (Figure 4). The two boards are positioned perpendicular to each other.

Figure 4: ‘Machinery’ module. The breakout female J45 port is soldered onto a support board (A) that is positioned perpendicular to the main board (B). The Nano is indirectly mounted onto the main board, via two rows of female pin headers. Parallel to each row of female pin headers a row of male pin headers was soldered, with 1:1 corresponding male-female pin connectivity. The fully assembled module is shown in the lower right corner.

Module #2 (‘Button panel’)
The buttons through which the countdown process is timed, started and reset should be positioned such that they can easily be accessed, that is, on top or on the front of the Box. For practical reasons – we had in mind a discarded transparent acrylic chocolate box as case – these principal devices were mounted on their own soldering board (Figs. 5 and 6) that was attached with two nylon bolts to the inside of the lid of the container. In the lid a rectangular opening was made to allow easy access to the buttons and the potentiometer.

Figure 5: ‘Button panel’ with an horizontal part that carries the main control buttons: start, reset, potentiometer. The buzzer is glued in place on its own, vertical soldering board that is attached to the long edge of the board carrying the buttons.

The buzzer was glued into position in a circular opening cut in a separate 70×40 soldering board. This board was mounted at the edge of, and perpendicular to, the button carrying board. An illustration of the fully assembled module is provided in Figure 6.

Figure 6: Assembled ‘Button panel’ module. The module is connected with six Dupont wires to the ‘Machinery’ module: 5V (red), GND (black), Reset (grey; to pin RST), Start (magenta; to pin D2), Buzzer (green; to pin D9), and pot meter (yellow; to pin A0).

As the reset button is a simple push button, the wire that connects the button to the RST pin of the Nano will be set HIGH when the button is pushed. The start button however is of the capacitive type which implies that the state of the wire connecting the button to pin D2 of the Nano will become LOW when the button is touched. This difference in state change when these two buttons are touched has been taken into consideration in the sketch.

Figure 7: Fully assembled Box seen from the front, ready for use. The Button panel is fastened with screws to the lid of the acrylic container while the machinery module rests on the bottom of the container. A separate window in the wall of the acrylic container allows passage of the power supply while another fenestrum in front of the RJ45 port allows plugging in of the cable to the Display Terminal.

After completing these modules the ‘Machine’ module was placed on the MFD inlay in the acrylic case. The ‘Button board’ was mounted with nylon bolts, against the lower side of the lid of the container, such that the buttons and the pot meter were exposed; the Dupont wires were connected, the cable to the Display Terminal plugged in and the power supply connected. As expected from the tests (see the first part of this project) the entire countdown timer worked without any problem.

Figure 8: Display Terminal in operation – working with the laboratory bench model of the Box. Picture taken from the first paper in this series. 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.

Even before the Box was finally completed the prototype of the countdown timer had already been in permanent operation for some time in my office. The power supply is plugged into a power strip socket that is used to power my desktop computer. Because of this arrangement the countdown timer starts automatically doing its job the very moment I switch on my computer. As the timer is set at 30 minutes the buzzer automatically reminds me every half an hour that I have spent even so much precious time working or leisuring at my computer. In order to halt the buzzing sound I must manually reset the device.
Instead of a buzzer another audio signal producing device can be applied. I am thinking in this respect to spend some time on an experiment to combine the countdown timer with an MP3 player. Messages recorded and stored in MP3 format then could be played randomly. As whole range of devices can be considered to replace or to amend the buzzer with output: lights, servos, relays, phones that start ringing, popup messages on my computer, name it. The sky is the limit.
All in all I consider this Arduino countdown timer a very helpful addition in my office in my attempts to keep track of time and to combat computer fatigue. Usually after two countdown episodes it’s time for some body exercise and… coffee!

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.