[SOLVED] Logic Level Shifter with 2N7000 not working

So, can anyone suggest what I'm doing wrong?

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.

Video of project here:-

AN10441.pdf (52.4 KB)

Here's the circuit with the 2n7000

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.

Grumpy_Mike:
That circuit is based on level shifters for I2C buses.
See the attached application note.

Will study that. Thanks Mike.

Grumpy_Mike:
...the 300R resistor... try removing that

Unfortunately, no difference.

Grumpy_Mike:
I don't think that the FET you used is up to the job

Can you suggest something in to-92? Can you identify the mosfets on the 4-channel board? They seem to work OK. Perhaps they are available in to-92.

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.

Could someone remind me and help the OP?

Allan

Perhaps you can find a logic level MOSFET in a TO-92 package.

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.

PaulRB:
Can you identify the mosfets on the 4-channel board? They seem to work OK. Perhaps they are available in to-92.

Seems it's BSS138. Gate threshold voltage is max 1.5V, typically 1.3V. Does not appear to be available in to-92.

Grumpy_Mike:
This is my Raspberry Pi / Arduino oscilloscope, with a 58KHz sample rate you can measure up to about 20KHz waveforms.

The ws2811 signal is around 400KHz I think. Ws2812 is twice that. So, ideally, I would need a 'scope with around 2.5GHz sample rate?

2.5GHz sampling - yep - that'd be plenty. But 10x oversampling is generally considered adequate.

Allan

PaulRB:
Can you identify the mosfets on the 4-channel board? They seem to work OK. Perhaps they are available in to-92.

They are BSS138. They don't come in TO-92

Can you suggest something in to-92?

I think you will struggle to find one. However the BSS138 is easy enough to solder on strip board.

Looking at the level shifter provided by Adafruit, their description of the device recommends applications with signaling frequencies at or below 2MHz. And, level shifting on those addressable RGB LED modules is rather finicky. So, I'm guessing there just isn't enough bandwidth to convey a proper signal.

So, I recommend the following:

  • Change your 10k pull-ups [R1 and R2] to something more like 4.7k or even as low as 2.2k. This may speed the thing up.
  • As Grumpy_Mike suggested, a MOSFET designed for lower voltages might help [the Adafruit version uses BSS138 -- but that's not to92, so something similar in a through-hole package--like, maybe VN3205 or VN10K].
  • If none of that works, then. As larry_d suggested, do this in a common Source arrangement -- since it doesn't need to be bidirectional.

The 2N7000s you have might have a threshold voltage of >=3volt, making them useless for a 3.3volt level shifter.

Try to measure threshold voltage with a DMM.
Connect (short) gate to drain, and measure between drain (+ lead) and source (-lead) with the meter set to diode test.
You should get the threshold voltage on the meter, or nothing at all if Vgs(th) is >3volt.
Leo..

Remember the threshold voltage is just the point where it starts to switch on. Or more precisely the point where it turns off. You need to be able to exceed the threshold voltage not just match it.

The 2N7000 data sheet says the threshold voltage is lower for lower currents than 1mA so you need to increase that pull up resistor not decrease it.

allanhurst:
2.5GHz sampling - yep - that'd be plenty.

I made a typo, I meant to say 2.5MHz!

Wawa:
The 2N7000s you have might have a threshold voltage of >=3volt, making them useless for a 3.3volt level shifter.

Its the plateau voltage that counts, the threshold voltage is a useless parameter for switching use.

Try to measure threshold voltage with a DMM.
Connect (short) gate to drain, and measure between drain (+ lead) and source (-lead) with the meter set to diode test.
You should get the threshold voltage on the meter, or nothing at all if Vgs(th) is >3volt.
Leo..

That's not the threshold voltage, that's probably somewhere close to the plateau, but the current is probably
too low for reliable value.

Normally you've drive the gate with about twice the plateau voltage for good solid switching.

If you don't understand "plateau", just looking at the gate charge graph in any MOSFET datasheet will
explain.

MarkT:
That's not the threshold voltage, that's probably somewhere close to the plateau, but the current is probably
too low for reliable value.

The DMMs I have measure diodes with a constant current of about 1mA.
Vgs(th) of many mosfets (including the 2N7000) are specified at that current.

Was wrong about the maximum measuring voltage of those DMMs. It's 2volt max.
So you can't measure Vgs(th) of a 2N7000 (2.1volt typical).

Several other true logic level mosfets I have do measure Vgs(th) correctly, at about 1.5-1.8volt.
Could be a crude/easy way to test for logic level or not.
Leo..

Thanks everyone for the guidance and component suggestions.

I have known about the difference between logic level and other MOSFETs for years when it comes to power MOSFETs (to-220). Don't know why I did not think that difference would be equally important in lower current MOSFETs also.

I still don't quite understand why 2n7000 is so often used for 3.3-5V level conversion in i2c bus lines but does not work with ws2811 signal conversion. Data rates are if anything lower, and currents are also small.

I am considering buying a few bss138 and sot-23 breadboard adaptors for prototyping work. All readily available and cheap on eBay. On the other hand, I can buy the 4-channel adaptors for £4 for 4 also, from UK suppliers, and no fiddly soldering to do.

I looked up vn3205. 14A through a to-92 package? I didn't think it possible! Only 1W dissipation, so need to be very careful about minimising the on-resistance. But still, the thought of 14A through those tiny pins...

I wonder if you could cut one of those addressable LEDs from the strip, and power it from say 4-4.2volt.
Then the first LED is driven within specs, and translates levels for the first pixel in the string also within specs.

One normal diode or two schottky diodes on series between strip 5volt and single pixel VCC,
with a (~330ohm) resistor between single pixel VCC and ground could do it.
Leo..

ReverseEMF:

  • Change your 10k pull-ups [R1 and R2] to something more like 4.7k or even as low as 2.2k. This may speed the thing up.

Well, well, well... 4.7K works! Seems to be the pull-up on the higher-voltage side that is critical. The pull-up on the lower voltage side can be either 4K7 or 10K, or completely removed and it still works. But the pull-up on the high-side works at 4K7 but not 10K.

It is marginal, though. If I touch source and drain or gate and drain with my fingers, the data stream cuts off and the leds go out. Same with 2K2.