I recently needed to control nine seven-segment displays for a microcontroller's serial port. The complication I faced was the need to provide a continuous brightness adjustment for all the digits – from completely dark to fully bright. I couldn't easily use the obvious solution of a string of 74HC595 serial-to-parallel converters driving the segments through series resistors, because I would have needed a variable power supply for the displays – an inefficient and inelegant approach. I considered using software to control the duty cycle of the displays' drive signal, but as a long-time analog-circuits guy, I felt honor-bound to find a way that wouldn't require writing any more code. Besides, I'd used up all the I/O pins on my microcontroller, so a software solution would have entailed changing processors. Allegro Microsystems offers several parts for driving common-anode displays. Each includes a serial-data interface and an on-chip control loop that sets equal on-currents for all the segments, using a single resistor to ground. I selected the Allegro A6275E (Figure 1), which neatly matches up one chip per display digit. Now, I had to simultaneously vary nine resistors.
|Figure 1.||An analog control loop provides an adjustable “ground” node to control the current flowing through
the resistors that set the segment currents.
I cheated, of course. Instead of varying the resistors, I moved their apparent ground point with a simple analog control circuit comprising a dual op amp, a power MOSFET, and a few passive components. IC1A provides a buffered version of the A6275's nominal 1.23 V reference voltage to the top of the potentiometer, preventing the potentiometer's loading from affecting the segment currents of the “master” A6275. IC1B drives Q1’s gate and forces Q1’s drain voltage to be equal to the voltage at the potentiometer's wiper. This action varies the voltage across the 909 Ω resistor between (almost) ground and the reference voltage and yields a smooth intensity control from maximum (20 mA for a 909 Ω resistor) to zero. The slight variations in A6275 reference voltages and the tolerances of the 909 Ω resistors add to the normal variations in intensity from digit to digit, but these variations were unnoticeable in my application.
One important point to note is the connection of IC1B: The feedback from Q1’s drain goes to the IC's noninverting input. The MOSFET adds an inversion inside the main loop, so using the op amp's noninverting input as the feedback point results in overall negative feedback. C1 and R3 create the loop's dominant pole, and R2 isolates Q1’s gate capacitance to ensure that IC1B doesn't oscillate. Allegro cautions against excessive capacitance at the A6275's reference pin, so I used R5 to isolate IC1A’s input capacitance from this point. IC1 must have a rail-to-rail output, its input must operate down to the negative rail, and it must operate with a total supply span of 5 V. Q1 needs to have low on-resistance with 5 V gate drive. Using the STP30NE06L from ST Microelectronics was probably overkill at 0.045 Ω, but the price was right at less than $1. The remaining components are noncritical. You may want to experiment with different potentiometer tapers; in my case, an audio taper gave a pleasing “feel” to the brightness control.