Gleagle Hardware R&D Team · August 10, 2026
This article documents the development of the rainbow color transition algorithm for Gleagle’s next-generation smart shoe display LED strips. From the failure of the textbook HSV approach through three failed patch fixes, to the breakthrough sine-wave mathematical solution — the final implementation uses only a 256-byte lookup table and 4 lines of core code, delivering constant-brightness, stepless rainbow effects.
Gleagle’s next-generation smart shoe display features full RGB LED strips. One core feature is “automatic rainbow color cycling” — the strip continuously flows through colors at two selectable speeds, with colors always saturated and transitions silky smooth.
The requirement breaks down to three words: auto color change, adjustable speed, linear transition.
The team’s first instinct: textbook HSV-to-RGB color wheel algorithm. It has served the graphics industry for three decades. What could go wrong?
Wrote it, compiled it, flashed it, powered on. The LEDs lit up. Then we went silent.
Standing three meters from the strip, the problems were impossible to miss:
Problem 1: Flickering Brightness. Red tones appeared bright and full; blue tones were visibly dim. The room looked like someone was adjusting a dimmer. Measured with instruments, total RGB radiant power varied by more than 2× within a single color cycle.
Problem 2: Stepped Color Transitions. Every quarter of a cycle, the color would suddenly jump. Not a gradient — an abrupt shift. Crossing from violet-purple to red, the eye caught a clear discontinuity.
Problem 3: Near-Black Zones. At certain color wheel angles, brightness dropped to near zero. For a shoe display illuminated from below, insufficient brightness is fatal.
Each of these three problems alone was enough to fail quality inspection.
We spent an afternoon on root cause analysis. The problem was not sloppy code — the root was in the HSV algorithm itself.
HSV rainbow mechanism: saturation and value are kept at maximum; only hue angle rotates. At each step, two of three output channels stay at 255 (maximum), the third varies linearly between 0 and 255. This seems efficient: every channel’s dynamic range is fully utilized, colors are maximally saturated.
Do the math:
Within a single cycle, total luminous flux oscillates between 255 and 510. Amplitude: 100%. Frequency: equal to the color wheel rotation speed. This is the mathematical essence of the “flickering.” Not a bug — a physical property of the algorithm.
As for the color jumps: at six sector boundaries, one channel transitions from 0 directly into a linear ramp zone. The human eye is extremely sensitive to brightness gradients at low luminance. A change from 0 to 10 is visually far more jarring than 200 to 220.
Gleagle’s engineering culture is “try the fastest fix first.” We tried, in sequence:
Each fix robbed Peter to pay Paul. The core contradiction remained: Under HSV, color saturation and brightness are coupled. To get pure color, you accept brightness fluctuation. To get constant brightness, you sacrifice purity.
The problem was in the choice of mathematical tools. HSV is designed for displays, with its own physical assumptions. When driving LED strips, those assumptions don’t hold.
We asked a more fundamental question: Is there a method that keeps R+G+B constant at every instant?
High school math provides the answer. For any angle θ:
sin(θ) + sin(θ+120°) + sin(θ+240°) ≡ 0
If R, G, and B are each based on one of these three sine waves with the same DC offset, then R+G+B at any moment equals three times that offset value. Total brightness is constant. Provable mathematically.
This is “linear transition” defined correctly: not linearity in color space, but linearity in brightness constancy.
Once the approach was settled, the implementation was remarkably clean:
Memory: A single 256-byte precomputed sine lookup table stored in chip program memory. 256 discrete points cover all human-visible color differences.
Runtime: One 8-bit phase pointer, incremented by a step value on each interrupt. Each update:
All three signals change simultaneously. No branches. No zone-switching. No edge-case handling.
Mathematical guarantee: At any moment, R+G+B = 3 × DC offset = 384 (128 per channel average). Compared to HSV’s 255–510 oscillation range, the difference is night and day.
Flashed the new firmware, powered on. The LED strip lit up — quiet, uniform, rich. A rainbow flowing through the room.
In slow mode, you stare at the strip. The color is changing, but you cannot remember when it went from orange to yellow. Because there was no moment of “change” — only a state of “changing.” This was exactly our definition of “linear transition.”
Measured data: full-cycle R+G+B variance under 2% (discrete error from table rounding). Completely imperceptible to the human eye.
| Metric | HSV Approach | Gleagle Sine Approach |
|---|---|---|
| R+G+B Range | 255 ~ 510 | 384 ± 1 |
| Brightness Fluctuation | ±50% | <1% |
| Transition Smoothness | 6-segment spliced | Full continuous |
| Dark Zone Problem | Present (near 0) | None |
Sometimes switching your mathematical tool is more effective than optimizing code. HSV is not wrong — in display color gamut mapping and image processing, it’s the standard. But LED strip evaluation criteria are different: the audience doesn’t care “how pure this color is.” They care “how comfortable the whole transition feels.”
With the sine wave approach, we traded away the laboratory metric of “producing the purest possible red/green/blue” for the product experience of “no viewer at any distance can see a flaw.”
At Gleagle, we call this kind of trade-off “product-level mathematical choice.”
| Parameter | Value |
|---|---|
| Color Gamut Range | Full spectrum cycling |
| Brightness Constancy | R+G+B ≡ 384 (variance < 1%) |
| Transition Smoothness | 256-level continuous |
| Fast Mode Cycle | ~2.6 seconds |
| Slow Mode Cycle | ~5.1 seconds |
| Memory Overhead | 256 bytes (sine lookup table) |
| Core Logic | 4 lines of code |
Gleagle Technology. We debug every LED strip as if it were a light art installation. That’s how Gleagle treats product.
This algorithm is now standard in all Gleagle smart shoe display LED controllers. Available for OEM integration. Contact us for module specs.