Fork me on GitHub

Project Notes

#337 RgbLedGlow

Rainbow glow effects with an RGB LED and OpAmp oscillators.

Build

Notes

For a while I’ve been thinking of ways to generate a pseudo-random rainbow glow on a composite RBG LED. In particular, by avoiding just throwing a microprocessor at the problem!

First, I want a waveform that has a smooth rise and fall in intensity, including being off for a period. Second, the reg, green, blue waves should not be synchronised, so the effect is an infinite colour palette.

I finally settled on three independent opamp-based triangle wave generators.

RGB LEDs

The RGB LEDs I have are common anode:

  • Size: 5mm
  • Pins sequence: RED/Common Anode(positive terminal)/Green/Blue
  • View Angle: About 25 degree.
  • R: wavelength 630-640nm, Brightness 1000-1200mcd, Forward Voltage 1.8-2.0V
  • G: wavelength 515-512nm, Brightness 3000-5000mcd, Forward Voltage 3.2-3.4V
  • B: wavelength 465-475nm, Brightness 2000-3000mcd, Forward Voltage 3.2-3.4V

Basically, these are just three LED dies in the one package.

Triangle Wave Generator

I borrowed the basic idea from LEAP#089 BreatheLamp, and adjusted the components for best effect.

The three oscillators are independent and nominally run at the same frequency. But component toleraces introduct enough variation that the phase difference of the three oscillators drift slowly, resulting in a continually varting mix.

A common reference volage sets the feedback offset. This is adjustable, the effect being to shift the waveforms with respect to the required LED control levels (meaning the LEDs stay on for longer of shorter periods).

Here’s a sample of the Red (CH3), Green (CH1), Blue (Ch2) waveforms.

scope

LED Control

The LEDs are configured with a low-side PNP control and current-limiting resistors. This puts the linear region of the transistors in the general vacinity of the triangle waveforms.

After some experimentation, I discovered I could get a much more peasing “glow” effect by reversing the PNP driver transistors (i.e. swap Collector and Emitter). The current flow is reduced, which can be offset by also reducing the current-limiting resistors. But it does expand the (pseudo-)linear region to cover the entire triangle wave sweep. This is a bit of a hack, and could probably be better achieved by ensuring the driving triangle wave is amplified and offset precisely to bias the transistors appropriately.

The schematic shows the alternative arrangements. The demo video is using the reversed-PNP arrangement.

Construction

Breadboard

Schematic

Build

Credits and References

About LEAP#337 LEDOscillators
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.