Go Down

Topic: [SOLVED] Logic Level Shifter with 2N7000 not working (Read 2756 times) previous topic - next topic

PaulRB

#30
Aug 20, 2018, 10:24 pm Last Edit: Aug 20, 2018, 10:33 pm by PaulRB
  • 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.

TomGeorge

Hi,
This is the Sparkfun schematic;

BSS138
See attachment.

Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

allanhurst

An ordinary bipolar NPN would work pretty well...

Allan.

PaulRB

#33
Aug 21, 2018, 10:36 pm Last Edit: Aug 21, 2018, 10:36 pm by PaulRB
An ordinary bipolar NPN would work pretty well...
I tried that before I tried the 2n7000, but it would invert the signal. So I tried two npn, the second inverting the inverted signal but could not get it to work. A 'scope would have been useful at that point, but I keep putting off buying a 'scope...

Emitter-follower would avoid the inversion problem but cause too much voltage drop, I strongly suspect.

What npn circuit did you have in mind?

allanhurst

#34
Aug 21, 2018, 10:55 pm Last Edit: Aug 21, 2018, 10:56 pm by allanhurst
Something like this.

The  'low' will be at about 0.2-0.3v, but ought to do.

Allan

PaulRB

Yes, that's very close to what I tried. I used bc337. But the logic is inverted.

Wawa

But the logic is inverted.
No, it's not.

When emitter is pulled down (LOW) by the 3.3volt pin, the transistor is conducting,
so the collector is also LOW.

R2=10k might be too high if wiring to the 5volt strip is relatively long.
Can lower R2 to 1k if needed.
Leo..

TomGeorge

Hi,
You are loading the output of the original circuit down when you do the measurements?

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

PaulRB

No, it's not.

When emitter is pulled down (LOW) by the 3.3volt pin, the transistor is conducting,
so the collector is also LOW
Sorry Allan, I didn't look closely enough at your schematic. I have not tried that. I had the 3V3 logic connected to the base and the emitter to ground. Will give your suggestion a go.

ReverseEMF

#39
Aug 24, 2018, 05:16 pm Last Edit: Aug 24, 2018, 05:49 pm by ReverseEMF
Cool!  I'm glad you got it working.

Some follow up:

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.
Because it's not just about data rate.  At least where these addressable LEDs are concerned--rise and fall time are also critical.  That's why changing the output pull-up to 4.7k made the difference.  Also, when you touch the circuit, you are, more than likely, adding capacitance to the circuit, which is probably degrading the rise and fall times.  --or there's something else going on that I don't understand ;)

I think the reason rise & fall times are critical, in this application, is because all of the signaling information is conveyed by precise timing.  In other words, the difference between a 1, a 0 and noise is determined by specific timing intervals.  Rise and fall slope is used, in this case, to filter out "noise"--which is anything that is not the proper wave shape +/- some pretty persnickety tolerances!  From the WS2812B datasheet: ±150nS.  So, slow rise and fall times could skew the pulse timing out of that tight tolerance window.

Also, I think reducing the output pull-up resistance is only part of the solution.  The other part is using a MOSFET that functions at voltages lower than the typical for a 2N7000 [i.e. low enough to properly do the job].

I suggest you use the "Modify" button, and mark this thread "Resolved".
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

PaulRB

#40
Aug 26, 2018, 12:37 pm Last Edit: Aug 26, 2018, 03:34 pm by PaulRB
Something like this.

The  'low' will be at about 0.2-0.3v, but ought to do.
Got around to trying the npn like you suggested. Some data getting through, but mostly corrupt, all all manner of colours flashing at random intervals, none of the ones I wanted. Tried 10K, 4K7 and 2K2 for R1 R2 with no difference.

Thanks again everyone for your help. I have leaned a little more about mosfets and level converters.

And I have come to the conclusion that the simplest and quickest solution, for this little project at least, is the one I started with, the 4-channel board. Hang the wasted channels.

allanhurst

Changing R1 will make no difference. Try reducing R2.

Allan

PaulRB

Changing R1 will make no difference. Try reducing R2.
Sorry again Allan. I meant to say R2, the pull-up on the 5V side.

PaulRB

All, I got some 74HC14 to try and it works great, better than the 4-channel convertor board, with no erratic behaviour when touched. The chip is powered from 5V and of course I added a 0.1uF bypass cap and kept the 330R in series with the led data line.

Thanks again everyone who helped, especially Mike who suggested the 74LS14.

Go Up