More and more contemporary microcontrollers are 3.3 Volt devices, in fact 5V is becoming a rare breed. The need for logic level shifting—boosting 3.3V signals up to the 5V supply voltage of NeoPixels—is frequently cited, but reality is more nuanced. Even in our own projects, we’ll often leave this part out. What’s up?
“NeoPixels require 5V logic” is a rule of thumb, a simplification that covers the vast majority of cases. When in doubt, 5V logic has you covered.
More accurately, “WS2812-compatible devices require logic above some percentage of the supply voltage, but that percentage varies from one make and model of device to another, and there are individual component tolerances and external factors like temperature to consider,” but that’s a whole lot of words and unknowns, so you can see why the rule of thumb gets used. Lets unpack the whole statement though, to better understand why we sometimes don’t bother with level shifting…
Percentage of Supply Voltage
The voltage level that distinguishes logic “high” from “low” is not precisely at 5.000V, but somewhere above zero and below the supply voltage (that is, whatever’s powering the NeoPixels). A datasheet will often provide some number…let’s say 3.5V…but that’s under specific test conditions, e.g. with a specific supply voltage (which the documentation should also mention alongside such figures). That is to say…the minimum reliable “high” logic level is not a hard number, but a relative figure or a percentage of the supply voltage, like VDD−0.5V or VDD×0.7.
In the latter case, VDD×0.7, this is saying the high logic state should be at least 70% of the supply voltage (but can be up to 100%, or even a few percent higher if pixels and controller are powered from separate supplies). That 70% figure isn’t canonically true (more later), but is cited often enough; itself another rule of thumb.
70% of 5V is 3.5V, still above the 3.3V output of most microcontrollers. But one shenanigan we can pull is to use a lower supply voltage. Three AA alkaline cells provide about 4.5V, and 70% of that is 3.15V…so 3.3V logic is robust enough! The output of a lithium-polymer cell might range from 3.7–4.2V (70% = 2.6–3V), so again we’re good.
NeoPixels are ostensibly 5V devices, but in reality are perfectly happy at slightly lower voltages (again, datasheet). 5 Volts is just a super common and ubiquitous voltage, provided directly by USB and many power bricks. It’s an analog world and other voltages are valid.
WS2812-Compatible
WorldSemi was the original manufacturer of this sort of integrated SMD addressable LEDs. Since then, others have come along producing components that use similar signaling, but aren’t 1:1 exact versions. These “WS2812-compatible” devices are often improved—better PWM frequency, more tolerant of solder reflow temperatures—and this sometimes includes a more generous logic level range, even if the datasheet isn’t explicit about this. In fact, few if any Adafruit products use the “classic” WorldSemi parts anymore.
In some of these cases, that 70% rule of thumb above might be relaxed to, say, 60%. This now means that some 5V parts are perfectly happy with 3.3V logic. There are still factors to be considered, and it’s a smart move to use level shifting if you’re not sure…but if it’s not some life-saving critical infrastructure, and if it tests reliably enough in development, we might forego level shifting in some projects for simplicity!
Tolerances and External Factors
Electronics is often depicted as being all cold, unyielding numbers…but in reality, everything is “ish.” A “5 Volt” power supply is really 5-ish Volts. 3.3V is really 3.3-ish Volts.
This is actually an argument in favor of level shifting, but explaining why sometimes a project works without, even when it shouldn’t.
Mass manufacturing just isn’t that precise; random factors creep in. Most consumer-grade electronic devices might have tolerances of ±5 percent…or even a bit more. Take that 5V supply, for instance…produced by the thousands or millions…and then picture a bell curve, with 5V in the middle and most parts falling close to that. Yet you’ll have a few outliers approaching 4.5 or 5.5V…but still within allowable tolerances. Anything testing outside some range would be scrapped.
It’s not just power supplies. Every single electronic component, even each individual NeoPixel, will have slightly different tolerances…sometimes in opposite directions.
What can happen is that you build a project on your workbench where it tests perfectly, but later it fails when plugged into an “identical” power supply or “identical” NeoPixel strip. One or more parts…power, microcontroller, pixels, were right at the edge of some tolerance and it’s only by chance that they worked together. Change just one variable and it’s pushed over the edge!
EVEN STRANGER: electronics can be subtly affected by temperature, barometric pressure, ambient light and other “random” factors! Usually a very small amount, but in edge cases this can lead to unreliable operation.
For a casual “just a quick workbench demo” project, maybe the fact that it works in this one controlled setting is good enough and you can skip level shifting. But when it matters, shift!
Datasheets
You’d think that a manufacturer’s own component datasheet would be The Final Word™ in settling such matters, but even this is sometimes filled with colorful metaphors.
These specifications are often written in the planning stages, and the final manufactured device might work beyond the intended bounds. Or sometimes figures are overly conservative to future-proof any changes. A part might recommend ≥3.5V logic when it really could be happy with anything over 3V, at least today. LED manufacturers sometimes make changes to improve production efficiency, even if this alters certain operating thresholds; some padding to the numbers allows wiggle room here.
Often enough, some “5V” parts (like SK6812 pixels—one of the WS2812-compatible alternatives) have proven quite reliable with 3.3V logic, even when documentation suggests otherwise. So this is another situation where we might forego level shifting.
Summary
If you want a NeoPixel project to be maximally robust and bulletproof, logic level shifting ensures reliable signaling. Our NeoPXL8 FeatherWings and Friend incorporate this, and all 3.3V ItsyBitsy boards have a 5V logic boost on pin 5.
Quite often though you can get away without level shifting, as when using a lower supply voltage. With a 5V supply and no shifting, you’re taking that small chance of unreliable operation, or “works on-desk but not in-field.” That might be good enough for casual, non-critical projects. Ask yourself if failure is an option!
Text editor powered by tinymce.