I have been using one of the commonly available 4-channel logic level shifter boards between a Wemos Mini and a string of 50 ws2811 leds. Works great, all leds animating as desired, but I don't have any use for the other 3 channels in this circuit, so a bit of a waste.
Instead, I have attempted to level shift with a 2N7000 mosfet. The leds are resolutely dark. If I swap back to the 4-channel level shifter, everything works as before.
I am using a 5A 5V external PSU.
I don't have a 'scope, but I probed around a bit with my multimeter:
The mosfet gate is at 3.3V. Good.
The 5V supply reads 5.15V. Fine.
The mosfet source is around 0.58~0.60V. Obviously I am reading the average of a data stream.
The mosfet drain is at around 0.62~0.64V. Again, the average of a data stream. Higher than the source, but I expected something higher still, maybe around 0.85~0.90V, i.e. higher than the source by 5/3.3 = ~150%.
The 4-channel logic level shifter seems to contain only 4 mosfets (I assume that's what they are, labels say "J1Y" with the "Y" written sideways) and a few 10K resistors.
The board has ground pins in addition to pins for the 3V3 and 5V supplies. If it uses a similar circuit to the above, why does it need ground pins?
I have not seen a schematic of that board.
The GNDs on both sides of the board, would be convenient soldering pads to connect the commons between circuits.
larryd:
I have not seen a schematic of that board.
The GNDs on both sides of the board, would be convenient soldering pads to connect the commons between circuits.
Thanks for replying Larry. I haven't seen a schematic of them either. I suppose the ground pins might be there for the sole purpose of grounding the ground plane, for safety reasons or for interference prevention at higher frequencies.
Anyway, the important question is why my 2N7000 shifter is not working!
PaulRB:
I tried replacing with a couple of others. I could, of course, have 20 bad ones! Purchased x20 from eBay...
I will re-build and photograph soon, maybe tomorrow evening.
That circuit is based on level shifters for I2C buses.
See the attached application note.
Now what happens with an I2C bus is that the active device pulls down the bus line. However what you have here is that the pull down signal has the 300R resistor in series with it. I would try removing that for the time being.
The only time I use a FET for a WS2812 LED strip was in the Magnetic Bounce article in MagPi 69, but that was in a conventional configuration. It was successful in that the LEDs were turned on but I wasn't impressed with the waveform it produced. I used the option of an inverted clock the the Adafruit library gives you.
I think the problem with the 2N7000 is that the gate threshold can be anywhere between 0.8 and 3V, with a typical value of 2.1V with a drain current of 1mA. So I don't think that the FET you used is up to the job.
allanhurst:
Your average voltage measurements are pretty meaningless.
Agreed, in absolute voltage terms, but I would imagine that with the same data signal going in and out, the logic level shifter should give a rise in the average voltage corresponding to 3V3 vs 5V.
allanhurst:
Get a scope.
Well, I have one on my Amazon wish list...
allanhurst:
Or write a solid '0' and '1' to D5 and see what you get.
Good suggestion, will try that asap.
larryd:
I do not see a wire connecting the two black GND busbars.
The red busbar has a gap which needs a wire link to bridge it, but the black one is continuous.
allanhurst:
The arduino scope + pc software is amazingly good up to a few KHz - 0-5v input range - I downloaded it free from somewhere but have forgotten where.
This is my Raspberry Pi / Arduino oscilloscope, with a 58KHz sample rate you can measure up to about 20KHz waveforms.