Hello world
I am using WS2812 and NeoPixel module with ESP32 chips. In order to drive 5V LED input with 3V MCU GPIO I am using transistor (N-MOS). But that transistor inverts logical signals of the gpio pin. Sure I can use second complementary transistor but this should be also fairly simple to solve in firmware.
My question is does NeoPixel module support inverted logic?
If not is this because there are any objections or no one just wrote it yet?
This seems pretty popular and minimalistic solution..?
Any hints welcome
neopixel ws2812 3V to 5V transistor converter inverter din
Re: neopixel ws2812 3V to 5V transistor converter inverter din
I noticed that:
- neopixel module uses hardware dependant implementation of machine_bitstream() so we do not want to touch these.
- it is possible to use 255-n RGB values to get valid color even when input is inverted.
- the first LED does not seem to reset correctly, it stays dark, but because it is WS2812B is seems to reshape signal for the next LEDS so they light as expected.
- question is how to make also first LED light as expected with inverted input
--
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
Re: neopixel ws2812 3V to 5V transistor converter inverter din
- It seems that just pin.value(1) needs to be added before and after bitstream() call in neopixel.write() so DIN stays low on bitstream start and all LEDs works fine including the first one (yes I saw the "sacrifice the first led" kind of ideas on the internets)
- DIN inversion can be achieved by swapping timings definitions and none underlying MCU driver code needs to be touched
- I will provide PR on GitHub for verification by wider audience
--
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
Re: neopixel ws2812 3V to 5V transistor converter inverter din
Just for reference here is the inverted neopixel code PR: https://github.com/micropython/micropython/pull/8037
--
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info