Why 3.3 V turns it pink
The same numbers on a 3.3 V board make a different colour. Green and blue lose about three quarters of their current and red only about half, so red's share of the light grows and white turns pink. It is arithmetic, not a fault, and the fix is a second set of numbers.
The same numbers, a lower voltage
The sketch sends 167, 255, 122, the numbers that land on white from 5 V. Slide the pin voltage down to 3.3 V and nothing in the sketch changes, but the bars do: red's share of the light grows past its tick, green's and blue's shrink, and the mix reads pink.
Why red wins
The current through each colour is the voltage left over after its LED, divided by 1 kΩ. Three resistors, three currents worked the numbers:
| From 5 V | From 3.3 V | What is left | |
|---|---|---|---|
| Red | about 3.1 mA | about 1.4 mA | about 45 % |
| Green, blue | about 2.2 mA | about 0.5 mA | about 23 % |
Dropping the pin voltage by 1.7 V takes 1.7 V off every colour's headroom. Red had 3.1 V to start with and keeps 1.4 V. Green and blue had 2.2 V and keep 0.5 V. The same loss is a much larger fraction of the smaller number.
So the balance you trimmed at 5 V is gone at 3.3 V. Red now gets nearly three times the current of green and blue, where it had about 1.4 times, and a mix that was white has about twice as much red, for its green, as white needs.
Equal numbers, too
Set the figure to 255, 255, 255. From 5 V it is violet, as in the previous article. From 3.3 V, red's share rises to more than half the light and the same numbers read pink. How strong a pink depends on your LED's bins, and the model cannot say. The direction, towards red, does not: it comes from red's extra headroom.
A second set of numbers
Green and blue lose the same fraction, because they take the same voltage, so their balance with each other survives. Only red needs to come down. Worked through the same arithmetic, a 3.3 V board wants about 84, 255, 122, where an Uno wants about 167, 255, 122: red halved, the other two unchanged.
Treat 84 as a starting point with wide error bars. At 3.3 V green and blue are running on half a volt of headroom, and a tenth of a volt of difference in the LED is a fifth of their current. Trim by eye on the board you will use.
The other fix is to drive the block from 5 V. A 3.3 V board cannot do that from its own pins, and the XL LED's 3.3 V article covers the transistor that can.
When it does not work
That is this article. Turn red down to about half of what it was on the Uno and leave green and blue where they were: 167 on an Uno becomes about 84 on a 3.3 V board. Then trim by eye, because the 3.3 V case is the one most sensitive to your particular LED.
Green and blue have only about 0.5 V to spare over their LEDs. The datasheet lets their forward voltage vary by 0.6 V between parts, so two TK02s on the same ESP32 can differ in green by a factor of two or more. On an Uno the headroom is 2.2 V and the same variation hardly shows.
No. PWM can only turn a colour down from its maximum, never up past it. Red is the one that is too strong, so turn red down. If you need green and blue brighter, the answer is a higher voltage, not a larger number.
No. A Pico pin at its default drive supplies up to 4 mA, and the most this block asks of any pin from 3.3 V is red's, about 1.4 mA. The Pico, the ESP32 and the ESP32-S3 all give the same colours here.
Edit this page — content/books/rgb-led/why-3v3-turns-it-pink.mdx
Questions about this product
See what other owners have asked, and read their solutions.
RGB LED
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.