Build an RGB LED Controller

Using Parallel FET Dimming

There are a lot of fun and interesting things you can do with LEDs and the different ways to control them. In this article, Dirceu describes an alternative approach to control RGB LEDs, using the parallel FET dimming technique. He steps through his efforts to design and build an alternative lighting system based on power RGB LEDs. To control them he goes very old school and uses an 8-bit MCU and the BASIC programming language.

By Dirceu R. Rodrigues, Jr.

Nowadays, applications involving advanced processors like Arm and Espressif ESP-32 are commonplace. But I thought it would be cool to test some fun lighting sequences that are controlled by an 8-bit microcontroller (MCU) programmed using an ancient language: BASIC. Although using pulse-width modulation (PWM) to dim LEDs with MCUs is a long-established idea and there’s a plethora of such products on the market, my approach differs from others regarding the drive method used. The benefit will be a relatively shorter BOM, but is also of particular interest to embedded system designers involved with LEDs because it will be possible to experiment with alternative configurations for the control stage.

LEDs are inherently nonlinear devices. Their brightness depends primarily on the current flowing through them, even though the voltage on terminals don’t vary that much. To achieve a constant LED current, there are two approaches: linear or switched current regulation. A linear regulator is preferred in situations where the noise due to commutation would be unacceptable—or for example, in high-precision measurement equipment. When efficiency is the main concern, a switched regulator or driver usually is chosen.

A commercially available driver usually operates above 1 MHz, providing hysteretic regulation for the LED current. To implement the required dimming, a common solution is to apply a PWM signal to an enable pin of the regulator. Because the entire component is switched continuously, the delay due to the soft start function must be taken into account. The disadvantage of this mode is, therefore, the limitation at low frequencies, usually 100 Hz. Other drivers, such as the ZXLD1350 from Diodes Inc. (used here), have a similar input named ADJ, capable of accepting a PWM signal up to 1 kHz.

Figure 1
Shown here is the basic idea for the design.

As outlined in Figure 1, my application takes a different approach. Rather than applying PWM pulses to a dedicated regulator pin, these signals are used to “short-circuit” the LED. So, when a switch is closed, the corresponding LED is off. This technique—known as parallel FET dimming—does not pose a problem itself, since the driver is based on a current source. Regardless of the state of each LED, the same current always flows through the entire circuit. For an independent control of three RGB LEDs, traditionally three drivers are employed, each with its own inductor, Schottky diode and sensor resistor, as shown in Figure 2a.

Figure 2
(left) shows a traditional configuration for driving 3 LEDs. (right) shows my alternative configuration, which reduces the number of components by connecting the three LEDs in series.

My alternative configuration to reduce the number of components is to connect the three LEDs in series, each with its own switch driven by PWM (Figure 2b). Note that, in this case, the ADJ pin from the single ZXLD1350 stays floating, and the three PWM signals are moved to the gate of MOSFETs. Therefore, it is possible to control three LEDs using only one set, consisting of driver, sense resistor, flyback diode and inductor. …

Read the full article in the August 349 issue of Circuit Cellar
(Full article word count: 2287 words; Figure count: 9 Figures.)

Don’t miss out on upcoming issues of Circuit Cellar. Subscribe today!

Note: We’ve made the October 2017 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Flexible Embedded/IoT OS Targets 8-/16-/32-bit MCUs

Segger has introduced emPack, a complete operating system for IoT devices and embedded systems. It is delivered in source code for all 8-/16-/32-bit microcontrollers and microprocessors. emPack is optimized for high performance, and small memory footprint and easily fits onto typical MCUs without requiring expensive external memory, keeping the cost of the embedded computing system to a minimum.
emPack components are written in plain C and can be compiled by standard ANSI/ISO C compilers. The software package includes embOS, emWin, emFile, embOS/IP, emUSB- Device, emUSB-Host, emModbus, emCompress, emCrypt, emSecure, emSSL, emSSH, and SEGGER’s IoT Toolkit.

All emPack components work seamlessly together and are continuously tested on a variety of microcontrollers from different vendors. According to the company, it is very easy to get started with emPack. And it significantly reduces the time it requires to deliver a product using robust and well tested components that simply work.

Another benefit of using emPack as a platform is portability: Switching to a different microcontroller even with a different core requires minimal changes. Standardizing on emPack enables you to enhance your products when newer, more powerful processors are introduced, or can target a wider customer base with cost-optimized products using less expensive MCUs.

Because all components work together through well-defined interfaces, existing projects that already have a mandated RTOS can use emPack’s components by simply customizing a small number of OS adaptation functions. emPack has been fully tested with Amazon FreeRTOS and example configurations are available upon request.

Segger | www.segger.com