Using a NodeMCU with a 12V WS2811

Hi - I have a 12V WS2811 neopixel strip - I have it hooked up and working properly with an Arduino Uno.

Now I am trying to swap the Arduino Uno for a NodeMCU and running into problems.

The uno setup is:

  1. VIN - +12V
  2. GND - ground
  3. Pin 6 - Data

(I have a capacitor and resistor hooked in per Adafruit best practices)

....and all is fine.

FOR THE NODE MCU

My understanding is I have to level shift the data pin to 5V since the NodeMCU runs at 3.3V.

So I have a level shifter (using two external power supplies - one 3.3V and one 5V, essentially according to the schematic here (this schematic is for a 5V neopixel and mine is 12V): Controlling NeoPixels with a Webserver on an ESP8266 - Hackster.io)

See super rough (sorry I'm learning Fritz but bad with it) schematic attached - the lights sort of respond but are flashing super fast, wrong colors, etc...

I've got my multimeter out - what are good things to measure and report back on? Measuring voltage drop between A8 and B8 is about 0.8V (which is weird to me)....and it also makes the lights slightly flash differently.

All ideas welcome. I'm several hours in and no closer to figuring out the NodeMCU issue.

schematic.png

Your diagram is both confused and incomplete. I am having trouble figuring it out. I cannot see a ground connection between the left hand and right hand sides, the lack of which would render it inoperable for a start.

The NodeMCU requires a 5 V supply to its "Vin" or USB port, it will figure out the 3.3 V for itself. You can provide that with a 7805 in which case you must provide the required input and output capacitors connected directly to the terminals of the 7805. That being the case, I would start by connecting the NodeMCU data output directly to the "NeoPixel" strip without the level converter and see if that works.

If it does, add a level converter just to make it entirely reliable. If it does not, then do try adding the level converter deriving the 5 V and 3.3 V from the NodeMCU, not an external supply. You have not specified which Adafruit level converter it is but I will say that in any case it is massive overkill and unnecessarily complicates matters. The most practical level converter is a single 74HCT14 (or failing that, a 74HC04) hex inverter with two gates cascaded and the other inputs grounded.

Why do you have an external "power supply board"? You already have 5V to the NodeMCU en 3V3 from the NodeMCU. Use use that as Vhigh and Vlow or VCCB and VCCA.

Thanks folks -

  • I was using an external supply board because the level shifter needs a 3.3V reference on vccb, and I don't have that.
  • I tried making tying VCCA to the 7805 output, but it didn't change the weirdness I'm seeing. What was also odd is even when I had VCCA disconnected, the neopixel was still on and displaying funkiness

I'm attaching an updated schematic that clarifies two things - the "left side" of the schematic is powered from my benchtop power supply. The "right side" power supply board is powered from a wall outlet 9V plug.

I'm thinking maybe a reason for the badness is there isn't a common ground between them? Open to thoughts on that - although if that's the reason, I'm not sure how to get a common ground between them....

Lastly, this is the level shifter I'm using (because I had on hand) and this is the power supply board.

Thanks so much folks - can't say enough about how helpful this board is.

Oh you’re right I do have the 3.3v out from NodeMCU and since I decided to use the 7805 I have a 5v. Let me try with both of those and get rid of external supply. I’ll report back...

schematicFull.png

larrywal32:
I was using an external supply board because the level shifter needs a 3.3V reference on vccb, and I don't have that.

And of course you do.

larrywal32:
I tried making tying VCCA to the 7805 output, but it didn't change the weirdness I'm seeing. What was also odd is even when I had VCCA disconnected, the neopixel was still on and displaying funkiness

No wonder.

larrywal32:
I'm attaching an updated schematic that clarifies two things - the "left side" of the schematic is powered from my benchtop power supply. The "right side" power supply board is powered from a wall outlet 9V plug.

With no ground connection.

larrywal32:
I'm thinking maybe a reason for the badness is there isn't a common ground between them? Open to thoughts on that -

Well, the thought is that an electrical circuit is just what it says - a continuous loop around which current can flow. By not connecting the grounds, you have no circuit, so you have effectively not connected the two parts together. :astonished:

A very basic and fundamental principle of electricity and electronics.

larrywal32:
although if that's the reason, I'm not sure how to get a common ground between them....

You connect a wire from the ground of the left hand side to the ground of the right hand side. :roll_eyes:

larrywal32:
Lastly, this is the level shifter I'm using (because I had on hand) and this is the power supply board.

As I say, that level shifter is workable, but absurdly overly complex and expensive where a 74HCT14 would be perfect.

The power supply board is OK, in fact, this is the sort of thing it is actually useful for as not much else.

I still suspect it would actually work if you just connected the NodeMCU to the LED strip without the level shifter at all. Did you ever try that?

Thanks much Paul - apologies I am just learning.

Long story short - it worked with a common ground.

And I was able to remove the power supply board and that still worked.

....and then (sadly?) I tried without the level shifter and that worked too. I could've sworn I tried that when I started. :(. My bad. I really appreciate the help.

As for the 74HCT14...I'd still love to learn more about it. I looked up hex inverters and started reading about them. I don't have an electronics background so I'm not sure from the datasheets how to infer why/how the voltage drop works as desired -- I could probably hook it up as you describe but if you can share more info on this:

hex inverter with two gates cascaded and the other inputs grounded.

I'd love to learn more. What do you mean two gates cascaded, and why would that work? Do you have a link you'd recommend I study up on or a circuit diagram I can study of what you're describing?

Again, very much appreciate everyone's willingness to help as I learn.

larrywal32:
I'd love to learn more. What do you mean two gates cascaded, and why would that work?

Two gates in series. You have two inversions to not invert the actual output signal. Propagation is of course 2x a single gate, but as that's in the order of 5-10 ns that doesn't make any difference.

Many other chips will do the same - have a look in your parts bin, see what you have on hand. E.g. two NAND gates (74HC00) in series will work, too. The HC series will do just fine, no need for HCT.

Do connect the unused inputs to GND or Vcc, doesn't matter which, just don't keep them floating. Unused outputs are best left unconnected.


You don't strictly need the 74HCT14 just as you don't necessarily need a level shifter at all, but that is what the 74HCT series are designed precisely to do. So it's the "right" way to do it.

Hex inverters:

Hopefully not too late the party, I've been snooping around for ideas for my light show this year and ran across this.

NodeMCU boards have a 3.3v regulator on them. Normally you feed it with USB right? That's 5v. Right next to the RST button the first pin should read Vin or 5V depending on the board rev. You can put 5v in there, it goes through the regulator and powers the ESP just fine. On the other side beside the flash button is 3.3v. When you're feeding it 5v on one side, you'll have 3.3 available on the other.

For simple 3.3v to 5v shifting an N-FET level shifter works fine at the speeds we're doing. The slew isn't the peppiest around, but it the same thing adafruit calls a level shifter. 4 N-FETs and a few pull down resistors gives you 2 channel bi-directional level shifting and it wiggles fast enough to drive a WS281x. Technically a single N-FET and a pull down is all you need for 1 string, but for the hassle of dealing with SOT23 parts, I'd rather just get a cheap prefab board.

For my 12v strings I'm using 12v PSUs, a little adjustable buck regulator board then a little FET shifter board with a NodeMCU running WLED for e1.31 control(some are running ESPixelStick). I'm cheap, so most of my stuff is fleabay, banggood, or ali. If I were to do it from scratch I'd use an optocoupler, but I'm lazy as well.

Here's a quick and dirty drawing, so it was clear I connected all of the grounds instead of just using earth symbols. You must tie all of the grounds together or individual systems can be anywhere they feel. Without the grounds tied there is no reference point. Please pardon my drawing, I usually do my best work on napkins then hand them off to the CAD team.

The level shifting boards were about .25 each and adjustable buck boards just a hair more than that. Here's their size compared to a NodeMCU.

Also, I'm curious what library you're using for the LEDs. D6 is the MISO pin, D4 is the UART1 TX pin and might be better depending on the library. You can't use UART0 as that's what the CP2102 or CH430 talk to for USB. WLED is a great beginner's firmware for the Node for WS281x. It gives E1.31, Alexa, and so many other bells and whistles. It's easy to build and tweak and there are super easy binaries if you don't feel like picking at it.

larrywal32:
... I'm learning Fritz...

Please don't.

Fritzing drawings are pretty. But pretty useless as schematics. I would much rather see a hand-drawn schematic like the one you attached than a Fritzing drawing.

illuxion:
NodeMCU boards have a 3.3v regulator on them. Normally you feed it with USB right? That's 5v. Right next to the RST button the first pin should read Vin or 5V depending on the board rev. You can put 5v in there, it goes through the regulator and powers the ESP just fine. On the other side beside the flash button is 3.3v. When you're feeding it 5v on one side, you'll have 3.3 available on the other.

You can likewise power it at 3.3V through the 3.3V pin.

For simple 3.3v to 5v shifting an N-FET level shifter works fine at the speeds we're doing. The slew isn't the peppiest around, but it the same thing adafruit calls a level shifter. 4 N-FETs and a few pull down resistors gives you 2 channel bi-directional level shifting and it wiggles fast enough to drive a WS281x.

But only barely so. Those LEDs can handle up to 900 kHz or so. The BSS138 based level shifters are fine for 100-400 kHz I2C but can barely if at all do the 900 kHz of the WS281x LEDs. Better use the 74HCT14 as mentioned above. Much faster, definitely up to the job, and you only need one-way level shifting anyway.

illuxion:
For simple 3.3v to 5v shifting an N-FET level shifter works fine at the speeds we're doing.

Maybe, maybe not.

illuxion:
The slew isn't the peppiest around, but it the same thing adafruit calls a level shifter.

Adafruit does in fact, not recommend it for this purpose.

illuxion:
4 N-FETs and a few pull down resistors gives you 2 channel bi-directional level shifting and it wiggles fast enough to drive a WS281x.

Bidirectional is meaningless in this case.

This might have worked for you, so far, in your particular application, but we cannot ethically afford to offer advice that will fail in a proportion of cases. :astonished:

I have virtually the same problem as the OP. I have reviewed this discussion and applied the recommendations to no avail.

I am attempting to use a Nodemcu to control both a 5 volt WS2812b and a 12 volt WS2812b strip simultaneously with the same data signal. In the diagram below the Nodemcu is powered by a 5 volt supply. The 3.3 volt logic data from pin D4 goes directly to thee 5 volt Neopixel strip which is grounded and gets power from a 5 volt supply. The nodemcu is flashed with WLED_0.9.0-b1_ESP8266.bin and the neopixel works as expected.
To provide the 5 volt logic data for the 12 volt Neopixels, a logic level shifter is added. The data from D4 is split to the TX1 pin on the level shifter. 3 volt power is supplied to the LV pin and ground is connected to the adjacent GND pin 5 volt power is supplied to the HV pin and ground is connected to the adjacent GND pin. The TX0 pin then supplies the 5 volt logic signal to the 12 volt Neopixels. All grounds are connected.
However when this arrangement if started with 3.3, 5 and 12 volt power, the 5 volt Neopixels still work well, but the 12 volt Neopixels Light up to white but do not ids play any of the patterns from the Nodemcu. Checking the voltage of the data signal from D6 shows about 0.1 volt and the same after passing through the level shifter. Disconnecting the 5 volt Neopixel does not enable the operation of the 12 volt strip.

I have tried the following variations to no avail.

  1. Using rx0/rx1 instead of tx1/tx0.
  2. Three different level shifters were tried
  3. 3.3 volt and 5 volt connections to level shifter were verified.
  4. Grounds were confirmed
  5. Disconnected 12 volt leds and 5 volt leds still worked.
    I have done a lot of googling about this issue and found no solution. Although I have researched level shifters extensible, I feel that the issue is how I have connected it.
    Hope someone can lead me in the right direction.

Which exact level shifter are you using?

The reference to "LV" and "HV" pins make it unfortunately clear that klrock is attempting to use one of the "bidirectional level shifters" that are specifically not recommended for this purpose (because they are reasonably likely not to work). :roll_eyes:

You need to use a 74HCT14 or failing that a 74HC04 with two cascaded gates for each channel to perform the level shifting as indicated in #8. (Unused gate inputs grounded or connected to the same 5 V Vcc as the chip.)

Use one inverter pair to drive each of the two LED strips.


And that was before I looked at his illustration which confirms the error. :sunglasses:
[

Zoom<](Using a NodeMCU with a 12V WS2811 - General Electronics - Arduino Forum)

I have tried three different shifters.

1 RobotDyn® 4 Channels Logic Level Converter High Speed Bi-Directional 3.3V-5V

  1. KeeYees 10pcs 4 Channels IIC I2C Logic Level Converter Bi-Directional Module 3.3V to 5V

  2. Geekcreit Bidirectional logic level converter

I also Have a 74HCT125 which I am currently researching how to install.

Keeyees.JPG

Robotdyn.JPG

All three those level shifters are the same type; bidirectional I2C level shifters. They're too slow for WS2811 LEDs.

The 74HCT125 should work just fine.

wvmarle:
The 74HCT125 should work just fine.

But you haven't explained to him how to use it!

At least with the 74HCT14 it is dead simple!

A quick Google search should explain that.

The key is of course the enable pins - they must be held to the correct state (high or low - see data sheet) to make it work. After that, it's just like the 74HC14 without the need of cascading two gates.