This is a shortened translation from Russian of my article published in Радиомир (Radio World) magazine, no. 10 (2010) pp. 22-25 and no. 11 (2010) pp. 23-24. The clock is based on a LED display with digit height 4" (101.6 mm) and has automatic display brightness control. One can easily read it from a 100' and more distance.
Clocks are one of the devices that everyone uses several times every day. This clock was designed with a purpose of checking time during a work in our garden, when a wrest watch is not always appropriate to carry. The clock can be placed at home so that it could be seen through a window from the garden. During the dark time it can also be used for serving your community by providing time to everyone who passes by. If you use it at home, the display brightness will be automatically adjusted to the lighting conditions, since otherwise it hurt your eyes by reading.
Huge LED displays are manufactured by various companies and, as a rule, are pricy. We used one of least expensive ones manufactured by Ningbo Flying Electronics Co., Ltd. They are about 4 times less expensive than, for example, similar size indicators from Kingbright. However, there is no free cakes, which in our case means that the indicators are not that bright as they could be. In order to provide reasonably bright lighting of LED segments each of them includes 4 pairs of LED connected in parallel, whereas the pairs themselves are connected in series. This resulted in about 8.5V voltage drop on LEDs per segment. Experiments showed that in order to achieve a reasonable brightness of display at daylight, the current through each segment should be at least 45mA. This way 4 indicators would draw 1.5A in a static mode if all their segments are lighted up. Since this is too much, we use the multiplex approach. This way the peak segment current must be a way higher. It turns out that by using ¼ multiplex mode the current through every segment should be about 100mA at daylight. Unfortunately, it is not specified in the display data-sheet if it can handle such peak current for a long time, so we decided to use a ½ multiplex mode with a safer peak segment current of about 75mA. In other words, first two hour indicators are turned on. Upon turning them off two minute indicators are lighted up and so on. This way the duty cycle of each digit does not exceed 50%.
Another issue we faced with was that turning on two digits at full brightness might result in a variation of current drawn from the power supply on 2·8·75 = 1200mA. This is a big challenge for any power supply and can lead to a high output voltage ripple and EMI. Linear voltage stabilizers provide highest power supply ripple rejection ratio, however a linear voltage stabilizer with output current of 1A must be mounted on a decent heat sink. We used a switching voltage regulator that does not need any heat sinks at 1.5A load. Furthermore, a special protocol was developed to control the display digits. The time under this protocol is splitted into quadruples of time intervals. The first digit is lighted up in intervals 1 and 2, the 2nd one in intervals 2 and 3, the 3rd one in intervals 3 and 4, the 4th one in intervals 4 and 1, and so on. This way no more that two digits are on in each time moment (at duty cycle 50% or less) and at most one of them is turning on or off. Therefore, the current drawn from the power supply is varying on at most 600mA and the voltage ripple and EMI are noticeably reduced.
This idea is implemented by using a 8-bit Atmel ATTINY44 microcontroller, which provides a simple way for generating 4 coherent PWM waveforms. The microcontroller has 2 timers, each of which is responsible for controlling 2 PWM channels. The principle is explained on the figures below.
Oscillogram 1 | Oscillogram 2 | |
![]() |
![]() |
---|
The bold slanted lines depict numeric values of timer counters and the horizontal dashed lines correspond to the values stored in registers OCRxA and OCRxB that are used to generate phase correct PWM waveforms. If these values are symmetric w.r.t. the top and bottom of the slanted lines, then the duty cycle of each digit is the same. In order the PWM pulses to be disjoint the lower threshold value must not exceed 127 and the upper one must be in the range 128..255 with 8-bit PWM resolution provided by Timer0. For generating the other two PWM waveforms we used Timer1 in 8-bit mode, which is accomplished by loading 255 into the ICR1 register. The coherence of timers is achieved by loading constants 0 and 128 to their counters before starting the timers. Since both timers have a common clock source, Timer1 generates waveforms (2nd and last ones on the right image) with phase difference 90° w.r.t. the ones generated by Timer0 (1st and 3rd waveforms).
Since our displays have OC configuration, their anodes are controlled by P-channel MOSFETs VT1 - VT8 (the right schematic below). Using MOSFETS eliminates any noticeable heating up of them compared to, say, UDN2981 drivers. The later ones experience about 1.5V voltage drop on their bipolar output transistors, which leads to dissipating 0.075·1.5·8/2 = 0.45W of heat and, thus, to a high package temperature. For driving the decimal points I used a Zener diode VD1 in series with the segment LEDs, since just 2 LEDs are used in the dot segments. The gates of VT1 - VT8 are driven by shift register DD1 controlled via the SPI interface. We assembled 4 blocks for each of the display digits, which are depicted by the dotted lines in the main schematic. The colon separating the hours and minutes is composed from the decimal dots of the indicators. For this the digits 1, 3, and 4 are mounted with the decimal dots on the top compared to the one for digit 2. This way one can implement AM/PM mode or alarm clock mode, and also display the degrees symbol °, if needed. The PCB for digit 2 is a bit different from the other ones, and all the PCB files are available for download below.
Main schematic | The LED module | |
The common cathodes of the indicators are switched by the N-channel MOSFETs VT1 - VT4 on the main schematic. The voltage shift of their gate signals to the level of -5.5V is provided by IC DD2 that includes 4 analog switches. These switches connect the MOSFET gates either to the corresponding sources or to the +5V bus, which guarantees a low open channel resistance and low heat dissipation.
The ambient light is monitored by the photo-resistor R1. The signal from the voltage divisor R1-R2 is attached to the ADC input of the microcontroller via a low-pass filter R3-C1. Its 10-bit digital output is truncated down to 7 higher-order bits according to the PWM resolution. ADC conversion is performed every second. The microcontroller is clocked by internal 500 KHz oscillator and the generated PWM frequency is about 125Hz, which eliminates any display flickering.
As it is seen, there is no clock crystal shown on the schematic. However, the crystal is integrated into RTC DD3. This IC also contains a voltage comparator that switches it to time-preserving battery as the power goes down. The RTC is configured to generate an interrupt every minute when the seconds value is reset to 0. The RTC interrupt generates a falling edge of signal level at pin 10 which results in requesting a pin change interrupt. The corresponding ISR reads time from the RTC and sends it to the display. This way the main program loop is reduced to requesting periodic ADC conversions and debouncing the time setting buttons.
The unit is powered by a 1 MHz switching DC/DC converter based on IC DA2. The converter is designed with the help of SwitcherPro software which is available from the TI website. The output voltage of the converter is 10.5V and it can be adjusted with R6 to meet the display brightness requirements. It important to mention that none of the converter outputs is grounded. The +5V voltage is provided by a voltage regulator DA1. The converter takes 11-15VAC or 15-22VDC from a wall wart. Average drawn current from input is about 0.8A.
Back view | Main PCB | |
The clock chassis is formed by ¾" aluminum profiles. The boards are mounted on them via ¼ standoffs. The boards are designed with Eagle software, the corresponding files are available for download. The copper on the back side of PCBs is used as ground. Capacitors C9, C15 are in 1210 packages, C10, C11, C12 - in 0402, C4 - in 0805, the other resistors and capacitors are in 0603 packages. Resistors R1 - R8 are integrated in CTC 767163270G network array. Connector XS1 (Sullins LPPB061NFSC-RC) is used for loading code into the microcontroller. Buttons SB1 and SB2 are C&K KSC201GLFS. CdS photo-resistor R1 is Advanced Photonix PDV-P7002. Its dark and light resistance is about 500K and 100 Ohm, respectively. Power inductor L1 is Bourns SRU1038-150Y.
The microcontroller code is written in assembly language and developed in AVR Studio 4. For loading the code into the microcontroller we used Atmel AVRISP mkII programmer. A special adapter was constructed to connect the programmer to the PCB.
Last modified:Mon, Jan 23, 2023.