Electronics Projects

Big LED clock with automatic brightness control

Controlling big LED displays that use several LEDs for lighting each segment is a certain challenge. The problem is that the voltage drop on display segments is well above the maximum voltage of microcontrollers. This project describes an approach to this problem based on source and sink drivers TLC59210 and TLC59213 manufactured by Texas Instruments.

Front view Back view

Hardware

The digits in the used LED display are 2" high and each segment involves 4 LEDs in series, so the voltage drop across the segments is between 7.5 and 8.4V. The decimal point uses only 2 LEDs though. Adding to this an unavoidable voltage drop on current-limiting resistors and switches leads to power supply voltage of 10V and more. The above mentioned drivers can sustain up to 15V. TLC59213 can be directly connected to a single high-voltage power supply, however its inputs are compatible with TTL or CMOS logic. It has 8 channels out of which only 4 are used for this design. Every two channels are connected in parallel and used to switch the common anodes of the LED displays.

TLC59310 also has 8 channels equipped with open drains switches, so it perfectly fits to switch the cathodes of the LED displays. Each of the ICs has latches on inputs. At rising edge of the CLK pulses the data is latched into the ICs and remains unchanged till the next rising edge. Therefore, the data inputs can be connected in parallel to save the μC pins. In our case 10 pins are needed to control the drivers: 8 for data and 2 for clocks. The CLR inputs of drivers are not used, so they must be connected to Vcc.

Schematic Assembled PCB

The time is kept by MAX1337C RTC manufactured by Maxim. It contains a built-in 32.768 KHz quartz crystal, which is very beneficial for thermal stability and simplifies the layout. The RTC is powered from a separate button cell to keep track on time when the power is off. It communicates with μC over the I2C interface.

The I2C bus is shared with an ADC that is used to sense the luminosity. This is needed for an automatic brightness control of the LED displays. The displays emit a fair amount of light in darkness, so their brightness adjustment is much more actual compared to smaller displays with digits size below 0.5". The luminosity is actually sensed by a photo-resistor R1 whose resistance is about 100 Ohm under bright sun conditions and raises up to 500 KOhm in darkness. The joint point of the voltage divider R1 - R2 is connected to the input of a 12-bit SAR ADC vi a low-pass filter R3-C4. Experiments showed that 3-4 lower-order ADC bits in this application change even if the sun is temporarily blocked by a cloud. In our case 5 lower-order ADC bits are ignored and the remaining 7 provide sufficient accuracy for the PWM-based brightness adjustment of LEDs.

The circuit is powered from a switching voltage regulator based on TPS5410. Resistor R15 is used to adjust the maximum LED brightness by varying the output voltage in the range about 7-13V. The optimal voltage turned out to be 10.5V for the used display and the values of R6-R17. Further increase of it does not make LEDs noticeably brighter but might lead to over-hitting the source driver DA5. The current-limiting resistor R6 is of a higher value than R7-R13 in order to balance the current through each LED segment. The maximum pulse current through a segment is 45 mA in our design, whereas the maximum constant one for the LEDs is 25 mA according to the datasheet.

The LED displays are mounted on small perfboards from RadioShack, which are bolted to aluminum 0.5" profiles. The input connector and voltage rectifier along with C12 are placed on one of the boards. Photo-resistor R1 is mounted on the top profile on an insulating washer. All other components are assembled on a PCB which is fixed with bolts on 5 mm standoffs at the corners. One more standoff is mounted right under the battery cell to prevent a possible damage of the PCB caused by bending it when the battery is being replaced. The back side of the device is covered with a plexiglass plate. It has two holes providing an access to the time setting buttons with a pencil.

PCB layout Component placement

The PCB is designed for resistor and capacitors in packages 0603 (R2, R3, R14, R16, C3, C7, C10), 0402 (R4, R5, C1, C4, C5, C6, C8) and 0805 (C2). Used types of C9 and C11 are Kemet T520D686M016ATE050 and Panasonic ECJ-3YB1E106K, respectively. L1 is TDK part SLF7045T-101MR50-PF. Trimmer R15 is Copal ST32ETA102, quartz crystal Q1 is Abracon ABS09-32.768KHZ-7-T. R6 is composed of 3 resistors. One of them is a part of isolated 8-resistors array (CTS 766163220GP), also containing R7 - R13. The other two are 0603 resistors of 51 Ohm each. This is done to increase the maximum dissipating power of R6. Connector XS1 is Sullins LPPB071NFSC-RC and buttons are C&K models KSC201GLFS.

Software

The display is driven in a multiplex mode, so each of the digits is on for up to 25% of time. Decreasing the time the digits are on leads to decreasing their brightness. The digits are switched every 4 msec provided by channel 0 of Timer_A of the μC. This way the display refresh frequency is 64 Hz. The timer runs in the up mode from 0 to 127 and generates an interrupt upon rolling over. The corresponding ISR switches to the next digit in the cyclic order and turns it on.

Turning the digit off is provided by channel 1 of timer. For this a value N in the range [4, 127] is loaded into the TACCR1 register. As soon as TMR counter reaches this value a new interrupt is generated. The corresponding ISR shuts down all digits by writing 0 into the TLC59213 registers. This way a PWM switching the digits is established. Its duty cycle varies with N between 3% and 24.8%, thus controlling the digit brightness. The value N is the 7-bit code obtained from the ADC as it is explained above.

The time is kept in DS1337C registers and is requested by the μC as soon as the number of channel 0 interrupts reaches the value 15360, which happens exactly every minute. The luminosity is sensed every 15 seconds. The ADC works in the default mode by performing a single conversion as soon as the result of the previous one is read. There is no need in a more frequent luminosity measurement, also because communicating with the ADC that shares an I2C channel with DS1337C leads to a higher current drawn from the CR2032 battery.

For the first time the power is turned on, the wiper of R15 should be placed in the lower position corresponding to a minimum voltage at the output of TPS5410. After this by slowly moving the wiper one sets a desired maximum display brightness. Note that if the output voltage of TPS5410 exceeds about 11V the source driver DD4 might be noticeably warm, while there is no significant increase of the display brightness.

Downloads


Last modified:Mon, Jan 23, 2023.

08676