Maker Pro
Maker Pro

Open collector problem

Jay Gee

Feb 7, 2018
6
Joined
Feb 7, 2018
Messages
6
Hi -

I'm trying to use an open collector circuit for a 3.3v arduino output to pass a bitstream to a 5v addressable LED. My circuit diagram is attached. (I'm using two n-channel mosfets since using only one will invert my signal and my software library (Neopixel) doesn't include an invert option.)

I'm using a 470 ohm resistor between my output pin and the gate on the first resistor.

The two pullup resistors are 10K ohms connected to my 5v rail.

The n-channel MOSFETs are IRF820A. According to the data sheet I can find on line they have a dv/dt of ~3.4V/ns. Should be plenty fast enough.

The final output shown in the diagram is the data pin on a single Neopixel 5v pth addressable LED.

I've also attached the capture from my logic analyzer.
Channel 0 is the gate on the first mostfet
Channel 1 is the gate on the second mosfet
Channel 2 is the data in pin on the LED.

Thanks for the help!

JayIMG_2139.JPGScreen Shot 2018-02-07 at 4.16.55 PM.png
 

AnalogKid

Jun 10, 2015
2,915
Joined
Jun 10, 2015
Messages
2,915
Nowhere in your post do you ask a question. I assume that the circuit is not working as you expected.

ak
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Why not just as a pull-up resistor to your open collector output?

The signal input to a string of neopixels doesn't require high power.

I done see the reason for your circuit unless it's to provide some form of protection to the microcontroller.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,765
Joined
Nov 17, 2011
Messages
13,765
Have a look at the data sheet
... and select a logic level MOSFET instead (Vgsth <= 2.5 V). Or follow Steve's recommendation. With a 10 kΩ pull-up at the output the drive capability of your circuit is low anyway.
 

Minder

Apr 24, 2015
3,479
Joined
Apr 24, 2015
Messages
3,479
I keep a qty of 2n7000 on hand for this purpose.
M.
 

Jay Gee

Feb 7, 2018
6
Joined
Feb 7, 2018
Messages
6
Have a look at the data sheet

http://pdf1.alldatasheet.com/datasheet-pdf/view/68304/IRF/IRF820A.html

page 5 and the switching time waveforms - noting the gate drive voltage - and compare to your 3.3V drive voltage.

Thanks. I'm about to demonstrate that I'm a bit of a noob, but I'm trying to learn, so ...

I saw on page 2 Gate Threshold Voltage min = 2.5 and max = 4.5, so I thought that I was right in range at 3.3.

As for timing, I saw the td(on)-tr and td(off)-tf on page 2, but noted that this was for a VDD of 250V so I guessed that the dv/dt of 3.4 ns would have indicated a fast enough response for my application. But even using the td(on) etc timing, it should probably still have been close enough for my application. As you can see in my analyzer output, the mosfets are responding in the many us range, not ns.

Any insight you can offer is appreciated!

Jay
 

Jay Gee

Feb 7, 2018
6
Joined
Feb 7, 2018
Messages
6
Why not just as a pull-up resistor to your open collector output?

The signal input to a string of neopixels doesn't require high power.

I done see the reason for your circuit unless it's to provide some form of protection to the microcontroller.

Thanks for the info. I'm just getting started in electronics, so not very knowledgable yet. What would this circuit look like? (drawing or description?)

Much appreciated, Jay
 

Jay Gee

Feb 7, 2018
6
Joined
Feb 7, 2018
Messages
6
... and select a logic level MOSFET instead (Vgsth <= 2.5 V). Or follow Steve's recommendation. With a 10 kΩ pull-up at the output the drive capability of your circuit is low anyway.

Thanks!

My arduino output is 3.3v, so wouldn't I want a vgsth min below that and max above that?

I looked at the 2n7000 that Minder suggested and that has vgsth min = 0.8 and max = 3.

Jay
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Agree with Steve, all you need is a pullup to 5V. And I suspect that a normal output at 3.3V would work as well, the datasheet says 0.7 of supply, so 3.5V is guaranteed to work.


Bob
 

Jay Gee

Feb 7, 2018
6
Joined
Feb 7, 2018
Messages
6
Agree with Steve, all you need is a pullup to 5V. And I suspect that a normal output at 3.3V would work as well, the datasheet says 0.7 of supply, so 3.5V is guaranteed to work.

Bob
Alas, 3.3v is not enough to reliably drive the data input - I tried. My same code works perfectly on a 5v arduino UNO.

On my 3.3v arduino, the spec sheet says that you must never expose the i/o pins to more than 3.3v. Even though the pin is set as a output, would simply using a pull-up resistor expose it to damage?

Thanks all!
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
There are protection diodes on the inputs that conduct at 0.3V above Vdd. With a pullup of, say 10K, they will conduct well below their max current, but check the datasheet to be sure.

Bob
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
OK, now I get what you want to do.

There are a number of options depending on what you're trying to optimise for.

Some options are board space, cost, "simplicity", and speed. The best solution may also be affected by what parts you happen to have on hand.

Here are a few options:
  1. Get an Arduino that operates at 5V.
  2. Use either a pair of inverters or a non-inverting buffer which operate from 5V and can be driven from 3.3V logic (available in small SOT-23-n outline devices)
  3. Use a pair of BJT's rather than a pair of mosfets
  4. Use an optocoupler
  5. Use a level converter circuit (there are about a bazzillion on offer.
So here are some more details demonstrating options 2 thru 5:

Additional logic (generally inverters or buffers)

There are all sorts of ways to do this, here are a few:

upload_2018-2-10_9-35-16.png

Note that the circuit on the left is powered from the 3.3V rail and the output is pulled up to 5V, where the circuits on the right are powered from 5V.

If you're interested in this, I can recommend some devices. I'd want to know if you are intending just 1 channel or multiple channels and whether you want surface mount or through-hole parts. For a single channel, I wouldn't recommend this using through-hole components because the single and dual gate options are not easily available.

Note that if you had a circuit that had spare gates available of the correct type, these may be able to be pressed into service, but I assume at this point that you don't.

The pull-up option is slightly slower than the other option, but the noise immunity is higher. Depending on the quantity, this option may be one of the more expensive, but it can also be very small in SMT.

A pair of BJT's

Your original circuit is typically built using BJT's (hence the term open-collector). Your design is open-drain, which is similar in theory, but the input voltage required is generally higher.

Note that your design could be made to work with appropriate mosfets, and that your first resistor is not actually required.

upload_2018-2-10_9-55-19.png

In these diagrams I've shown two rails for the pullups, but it is perfectly OK to use the higher supply rail for both. What is critically important is that both power rails share the same ground.

For the circuit using the mosfets, the power supplies must also be below Vgs(max), a value that is typically 10V to 20V, but in your application this is unlikely to be a concern.

Note that one of the resistors in the BJT version (on the right) is optional.

This circuit (especially the BJT version) is likely to use parts many people will have on hand or are very cheaply and readily available. It can be a little large when made using through-hole parts. If you need a lot of speed, there are modifications that can be made to both circuits. Since both employ pull-ups both the rising and falling edges can be a little slow.

The output will swing almost rail to rail for the mosfet version, and from about 0.2V to 5V for the BJT version.

optocoupler

This provides a lot of protection for your circuit, and the grounds can be independent.

upload_2018-2-10_10-8-33.png

The main problem with the optocoupler solution is cost. It's probably the most expensive solution. Optocouplers are generally designed to allow a high voltage (up to 5kV) between the input and output side, so they are necessarily large.

Note that there are optocouplers with a logic outputs which can remove the need for one resistor on the output side and improve certain aspects of the operation of the circuit.

This will give an output swing of 0V to about 4.8V.

Other circuits

If you google "3.3V to 5V level shifting circuit" you'll find a heap more options. Here are a few that you'll probably see:

upload_2018-2-10_10-29-17.png

These can be both small and cheap, but they're not especially fast (anything with a pull-up has problems in this area). The operation of these (especially the one on the right) is not particularly obvious, but I can explain if you're interested.

With the addition of the optional resistor, the circuit on the right is bidirectional, however you need to choose a mosfet with an appropriate Vgs(th).

the output will vary from about 0.2V to 5V for the BJT version, and you can get an almost rail to rail output for the mosfet version. Whilst the ground is not shown in this circuit, it is assumed to be common.

The operation of the following circuit is also a little subtle:

upload_2018-2-10_10-30-44.png

This circuit essentially lifts the 3.3V logic by a diode drop, so the output is 0.3V to 4V. The diode to the 3.3V Vdd protects the input from current and may not be needed in all cases. And again, whilst the ground is not shown in this circuit, it is also assumed to be common.
 
Top