Hi! First post here. I've been searching the internet (including lots of posts here) and found some similar issues but nothing exactly the same, so making a new post to see if anyone has a solution. Here goes...
There are really 10 LEDs in series but I didn't show those for simplicity. It's all on a PCB so the longest trace between the ESP and the level shifter is about 2cm. There is 5V external power with an LDO for the 3.3V power.
This circuit results in the first two LEDs flashing for ~500ms on power-on. As soon as I plug in the power. Before the ESP fully boots. After the ESP boots and takes control of the GPIO everything is good. Then, when I shutoff power, the first LED briefly flashes white.
Removing the level shifter eliminates the flashes. I can't seem to use my oscilloscope here because when I probe the level shifter pins it also eliminates the flashes. I've read because the probe adds impedance that can mask the problem.
I realize I can use the new V6 WS2812B that spec 3V3 data, and I know that I can conceptually just run without the shifter for this small circuit.
I'd really like to know what's wrong with this circuit for my learning. How do I keep the WS2812s quiet at startup and shutdown and stay in spec with a 5V data line?
Thanks for the suggestion. What is on that breakout board? I can't read the markings on the passives or the chips. I think it looks fundamentally similar to what the 74AHCT125 is doing in my current implementation. But willing to try other hardware.
I’ll try that resistor change tonight and report back. I think I can easily solder on a 10K through-hole to the Y output and swap the existing SMD 100k for 10K.
If I’m guessing at your logic here, I think it's to more strongly hold the DIN low so upstream junk doesn’t make it to the LED?
I’m still not sure why I don’t see flashes without the shifter. My best guess is there is noise on the GPIO line, and the un-shifted junk voltage is low enough to stay below the V-ih threshold, but when shifted it shows up as a strong 5V trigger? Maybe I should try to probe the ESP pin for that voltage level...I'll put that on the list for tonight, too. I don't have a clue why I would get that noise from the ESP on the GPIO before boot and at power-down.
Before boot, the pin probably defaults to input and so the 74HCT input is floating (and the 100K is to weak to prevent that, although I would have thought it was enough).
Another option could be to connect connect the OE pin of the 74HCT to another ESP pin. But then you would have to make sure that isn't floating at bootup either! Ok, dumb idea...
Maybe, but that actually got me thinking. So good idea. :) If I could hold that OE pin high briefly at startup it would block noise from going through. Maybe an RC on that OE pin, with R as a pull-up. And then add an NPN with base tied to the ESP32 EN pin, so once the chip is stable, the transistor pulls the OE to ground and lets real signals through? I dunno if that would actually help on the power off glitch. And sorta feels like a bolt-on band-aid.
Thanks for the suggestions and thought stimulation.
I do.
GPIO12 is a strapping pin and may have glitches during power up and/or reset.
There are five strapping pins:
1. MTDI (GPIO12)
2. GPIO0
3. GPIO2
4. MTDO (GPIO15)
5. GPIO5
Try using a different pin.
Hmm, good point to check. I had thought the internal pull down on 12 would keep it quiet (and my external 100K pull down was added reinforcement) at boot time. But maybe there is something in the guts of the ESP32 that puts some noise on that line.
I've allocated the other GPIOs but I'll figure out a way to test a different one.
Might need a new board spin because I never saw any of this on the perf board I made with ESP32 dev kit, a dip version of the 74HCT and LED breakouts wired together. Wasn't until I got the PCB made that I saw this power-on and -off flashing.
I use a 74HCT02 powered with 5v, as a level shifter, connecting the 'A" to the gpio which provides the LED signal. If the signal can be inverted programmatically, i do that. Otherwise i invert it using 1 extra gate. I connect the 'B' input using a 10K physical pullup and acting as an enable pin which is pulled LOW programmatically before the first signal is sent.
Well, it's not noise but it's not documented what the ESP does with the strapping pins during boot.
Wasn't until I got the PCB made that I saw this power-on and -off flashing.
The extra capacitance of the perfboard design and DIP were probably enough to filter out the glitches. You could try adding a 5pF cap on GPIO12, but that is just a bandaid solution.
When you tried this, was the 330 ohm resistor in series with the ESP32 pin? Depending on the other capacitances involved, it could form an RC network with a time constant of tens of of nano seconds.
I was using it as an “attempt” to filter reflections / noise. Thought it would be a good practice on the 800Khz protocol here, and started with 330 ohm simply as something in the 100 - 470 range that I had on hand when I build the perf board prototype.
This turned out to be true! I was able to scope the GPIO and the ground pin directly on the ESP32 module and saw some spikes, ~850mV - 900mV that the level shifter pumped up to a strong clean 5V.
I think I’ve solved it (or band-aided) with the help everyone provided and one other important miss in my design that I uncovered last night.
Revisiting all my reference schematics I saw ESPRESSIF recommends an RC on EN with 10K and 1uF cap or stronger. I had the 10K pull-up but no cap. I had a 10uF ceramic through-hole in my drawer that I was able to easily solder on. That timing delay seemed to quiet the power on & early stage reset blips I was seeing on the GPIO.
On my next board spin, I’ll probably (1) bump up the 100K pull-down on the shifter input to 10K for a little extra insurance, and (2) switch GPIOs to get off the strapping pin.