-
-
Notifications
You must be signed in to change notification settings - Fork 257
FAQ #2
I have connected this to my Esp8266 (or other 3.3v based Arduino) and they don't show the colors correctly.
The effects you may see, but are not limited to are; the first or last pixels show incorrect colors, random flashes, or nothing.
See this YouTube video from ResinChemTech on the topic of shifters and signal wire lengths.
This is due to the IO Pins on the device are 3.3v and the pixels require +-0.5v relative to their power voltage. Most pixels require 5v to run; so this puts the Pin IO out of spec. There are several solutions to this problem.
- Use shorter wires between the controller and the first LED. Best to keep them Less than 12" / 30cm.
- Make sure there isn't a 5v IO Pin on your device. A few lower voltage devices expose a compatible output pin just for this purpose. Switch to that Pin if you can, but the esp8266 methods use very restricted set of pins. Note that Adafruit HUZZAH ESP8266 board that has built in level shifters for RDX0/GPIO3 pin is designed so that the pin is an "input"; but it is needed as an "output"; so you must use the UART method with this board.
- Use a level shifter in your design. Adafruit sells several, like the 74LVC245 or the bidirectional TXB0104 that will work and you can find similar modules and circuits that you can incorporate. This will shift the 3.3v IO output to 5v for the pixels. See Issue #183 for details on making it work.
- Lower the running voltage to your pixels to within range of the IO pins. Since the pixels need +-0.5v IO, if the primary voltage of the NeoPixel is 3.8v, then the 3.3v of the IO pin are within spec. Some pixels can run just fine at 3.8v and this is often the lowest rated voltage they can run at. The problem with this solution is how do you provide 3.8v at the current requirements the Pixels run at? You will need to get a variable power module and with a good meter you will need to set the voltage output to 3.8v. A lot more effort than just getting a level shifter.
For this reason I don't suggest this solution except for the bench testing.
More rambling on the topic:
The acceptable driving voltage of pixels depends on the chip. The above voltages may be correct for some pixels, but others differ. For example, with the WS2811, the specified thresholds are >= 0.7 * VDD for high, and <= 0.3 * VDD for low. Using 5V pixels, that's above 3.5v for 1 and below 1.5v for 0. As you can see, a 3.3v uC can put out a 0 easily, but is out of spec for a 1. Luckily, the pixels often work a bit beyond spec anyway, at least if the pixel is close to the uC, but sometimes the pixels don't work reliably (other chips will have their own specified, and actual, thresholds; the actual thresholds may vary by batch even within the same pixel chip type).
There are several techniques that can be used to address this, if necessary (ie: if direct driving doesn't work). As described above you can use a level shifter; or you can use a buffer chip since the drive is one directional. You could use a 5V "null pixel" chip close to the 3.3v uC; it's close so it may work fine, and its output will drive the next (displayed) pixel just fine even if it's further away. Just adjust your software to insert a black logical pixel before the first displayed pixel.
Alternately, you could insert two null pixels like this, but use a diode to drop the power to the first by a nominal 0.7v, to 4.3v (input high threshold = 0.7*4.3=3.0v), then run the second null pixel at 5V and you're good from there. See below for a link to this technique.
Yet another approach if your pixel power supply is independent of the uC power supply, is to use a diode between the uC ground and the pixel ground (anode at the uC ground). This has the effect of raising the 0v .. 3.3v uC output by a nominal 0.7V as seen by the pixel, so the pixel input sees 0.7 .. 4.0 V, which is within the specified thresholds. If you do this, be sure to remember that the two grounds are different, and don't short them together accidentally (it won't cause any lasting harm if you do, but the pixels may stop fully working again while the diode is effectively shorted out).
Here are some other techniques of which I have never tried but may work in a pinch.