Go Down

Topic: Using a NodeMCU with a 12V WS2811 (Read 552 times) previous topic - next topic

larrywal32

Aug 24, 2019, 06:45 am Last Edit: Aug 24, 2019, 07:40 am by larrywal32
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): https://www.hackster.io/remnis/controlling-neopixels-with-a-webserver-on-an-esp8266-0381c7)

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.


Paul__B



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.

septillion

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.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

larrywal32

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.

larrywal32

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...

Paul__B


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.

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.

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.

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.  :smiley-eek:

A very basic and fundamental principle of electricity and electronics.
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.  :smiley-roll:

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?

larrywal32

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.

wvmarle

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.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Paul__B


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:

illuxion

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.

SteveMann

#10
Nov 11, 2019, 05:51 am Last Edit: Nov 11, 2019, 05:51 am by SteveMann
... 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.

wvmarle

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.

Quote
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.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Paul__B

For simple 3.3v to 5v shifting an N-FET level shifter works fine at the speeds we're doing.
Maybe, maybe not.

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.

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.  :smiley-eek:

Go Up