Simple voltage level shifter questions...

Go To Last Post
35 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to interface a single bidirectional data pin cheaply and with as little components as possible.

 

On each side I have an AVR, so I can use the pullup on its GPIO pin if that helps/eliminates any external components.

 

One AVR will be running 5V from USB, the other AVR might be 2.5V-5V.  I plan on having each AVR switch between input with pullup enabled OR output ground.

 

The thing is that I only want a 2 pin connection to the 2.5V-5V AVR.  Ground and data.  I found this BSS138 shifter, but it shows LV coming from the lower voltage device which would be 3 pins which I don't want.

 

 

Any ideas?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
as little components as possible

so use an actual voltage translator chip: no faffing about; just one single component - you can't get any fewer than that!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I recall, those has a HV and LV pins which need to be driven too.

 

Is it possible to have a 2 pin connection only without providing the LV VCC?

 

Basically if neither side is grounded, each side is pulled up to its vcc.  If either side grounds, it takes the other side to ground.  Can this be done with the lower voltage side only connected with 2 pins???

Last Edited: Sat. Oct 28, 2017 - 07:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

each side needs to know what voltage it's working at!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How is the circuit supposed to guess the LV if it's between 2.5 and 5V? If it was fixed, you could supply it from the HV side. My suggestion is that you supply 3V, it's the absolute maximum tolerable at 2.5V, and the minimum that 5V can perceive as high. But I have a feeling it will be very unreliable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
How is the circuit supposed to guess the LV if it's between 2.5 and 5V?

Exactly!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
I am trying to interface a single bidirectional data pin cheaply and with as little components as possible.
debugWIRE is an instance of bidirectional two pin (dW, GND)

A proposal for 5V USB UART (or tinyAVR) to 2V AVR debugWIRE (Schottky diode with RC LPF) :

https://www.avrfreaks.net/forum/debugwire-usb-uart?page=1#comment-2290341

The software for the tinyAVR is a variant of Little Wire :
https://littlewire.github.io/

 

Correction:

Erroneous because 5V side doesn't meet 0.7*Vcc or 3.5V.

Will mull how-to tinyAVR equivalent the XMEGA E AVR one-wire half-duplex UART.

 

First mull:

USB megaAVR USART RX and TX each through 100R to get one-wire then BAT54 Schottky to rail tie it though would need to idle at either GND or hi-Z so as to not over-volt the 2V AVR's Vcc.

via https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/resources/AVR-ISP-MK2_sch.pdf (lower left for XMEGA PDI data)

Damn, that's three pins (one-wire, GND, target Vcc)

 

Edits: correction, first mull

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Oct 28, 2017 - 09:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The original circuit above would work on two pins if the AVR were the 5V and the programmer was the 2.5V-5V, right?  Directly above the 8 in bss138 is a single wire, so to the right of that could be an AVR with a pullup.  That is backwards from what I want though which is no extra parts on the device side.

 

If each side pulled itself up to its vcc, does the other side need to know its vcc?  Could it be HiZ or ground that tells the other side to go to ground or HiZ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
The original circuit above would work on two pins if the AVR were the 5V and the programmer was the 2.5V-5V, right?
Yes for programmer (USB side) at 5V and target AVR at 2.5V min.

BSS138 Vgs(th) is 1.5V max at 25C plus about 0.5V for max cold (2.0V total at -55C)

2.0V < 2.5V

alank2 wrote:
If each side pulled itself up to its vcc, does the other side need to know its vcc?
No

alank2 wrote:
Could it be HiZ or ground that tells the other side to go to ground or HiZ?
Yes

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the answers are No and Yes, then should I look to a different circuit than the bss138 one?
 

I suppose the really big deal is that I don't want any components on the device side (2.5-5).  I want to keep the programmer side simple, but enough to do the job...

Last Edited: Sat. Oct 28, 2017 - 09:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Place the converter on the high volt side, so the wire are at the low voltage. (you need to know the low voltage and be able to make that at the high volt side)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Second mull:

Now it's a two pin interface (one-wire, GND)

debugWIRE to USB UART

 

Programmer-side (USB side, variable)

Two 499R for current-limiting when target's Vdd pass transistor shorts to source

47pF with 499R to limit target-side to less than the absolute max of +/-500mV over the rails

Bus hold is the 10KR

BAT54 Schottky diode blocks current from high-side and forward voltage is less than 0.3*Vdd at -40C

Open drain

 

Target-side (1.6V to 5V)

Bus hold is the internal pull-up

Open drain

About 400mV over the rail (abs max is 500mV)

 

Defect :

Vaa must be variable and approx Vdd/0.7 (5V max)

 

Reference:

https://www.avrfreaks.net/forum/debugwire-usb-uart#comment-2287616

 

LTspice XVII schematic is attached.

 

Edits: LTspice, oops, defect

 

Attachment(s): 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sun. Oct 29, 2017 - 02:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1: use two resistors and form a resistor divider to get 2.5 to 3V on 5V side. Connect Gate to this point.

 

2: use DMN10H700S-7 instead which is twice the price the one you selected. So variant 1 is cheaper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
If the answers are No and Yes, then should I look to a different circuit than the bss138 one?
Yes if the low-side AVR's Vcc is 2V.

Reason: enough Vgs when very cold and NFET Vgs(th) process variation

 

Texas Instruments LSF level translators are pass FETs that have a reduced and controlled Vgs(th) but these need approx 1V difference between the two sides and would be a 3 pin target-side interface (D, target Vcc, GND) instead of the required 2 pin interface.

http://www.ti.com/product/LSF0101/datasheet/detailed_description#SDLS9667912

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wait, finally I can propose my JFET level shifter for a practical problem smiley

Since the gate is connected to GND instead of LV like the MOSFET version, and one of the wires is GND, this would solve the OP problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

angelu wrote:

2: use DMN10H700S-7 instead which is twice the price the one you selected. So variant 1 is cheaper.

 

Does this device somehow have a way of not using a voltage divider?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

Wait, finally I can propose my JFET level shifter for a practical problem smiley

Since the gate is connected to GND instead of LV like the MOSFET version, and one of the wires is GND, this would solve the OP problem.

 

Indeed - that looks very cool.  It looks like Digikey is obsoleting this part - is there a substitute.

 

One question I have with the HV/LV bss138 is, what if the LV side is 5V and just happens to be a little bit higher.  USB=4.9 (HV side), device=5.1 (device side).  Will it still work?

 

I like the voltage divider for the gate on the programmer side.  I wondered if that would work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
Indeed - that looks very cool. It looks like Digikey is obsoleting this part - is there a substitute.

 

Well, I bought some BF862 JFETs to test this idea in practice, but then I forgot about itblush

Unfortunately they are also being phased out... Soon there will be no JFETs...

 

edit: it seems 2SK3557 is not going away yet. It has the proper characteristics to work: low voltage threshold and high (for a JFET) current limit (tens of mA).

Last Edited: Sun. Oct 29, 2017 - 01:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

angelu wrote:

 

2: use DMN10H700S-7 instead which is twice the price the one you selected. So variant 1 is cheaper.

 

 

 

Does this device somehow have a way of not using a voltage divider?

 Yes, it only needs that MOSFET. The thing is that at G-S = 2.5V is still off.

 

I like the voltage divider for the gate on the programmer side.  I wondered if that would work.

   Why it should not work ?

 

One question I have with the HV/LV bss138 is, what if the LV side is 5V and just happens to be a little bit higher.  USB=4.9 (HV side), device=5.1 (device side).  Will it still work?

You have two diodes in series that at some point will start conducting: the one in the MOSFET and the one in the microcontroller pin, although some I2C pins does not have those diodes. I suspect that as long as the difference is less than 0.7 - 0.8V everything is ok. And even more, a 47k pull-up resistor will not do much harm on the other side.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
Soon there will be no JFETs...
Disagree; IIRC, ON Semi announced a few new JFETs within the past few months.

JFETs are wonderful for

... a combination of high input impedance, low noise, and good accuracy; [niche applications]

(page 170, middle of right column)

http://www.cambridge.org/us/academic/subjects/physics/electronics-physicists/art-electronics-3rd-edition?format=HB

ON-Semiconductor

ON Semiconductor

JFETs

http://www.onsemi.com/PowerSolutions/parametrics.do?id=806

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman I don't understand what you mean by Vaa must be variable...

 

Does R3 have to be 10K, or can it be an internal pullup?

Last Edited: Mon. Oct 30, 2017 - 03:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
gchapman I don't understand what you mean by Vaa must be variable...
That's the design's defect; signal has to reach 70% of the rail to be read as 1 in LVCMOS.

alank2 wrote:
Does R3 have to be 10K, or can it be an internal pullup?
Internal is usually adequate per (uni-directional)

Planet Analog

Planet Analog

SIGNAL CHAIN BASICS #66: How to interface a 5V transceiver to a 3V controller

Planet Analog, , 6/25/2012

https://www.planetanalog.com/document.asp?doc_id=528335

...

Figure 4. Final interface solutions using a Schottky diode and an external or internal pull-up resistor.

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

angelu wrote:

Yes, it only needs that MOSFET. The thing is that at G-S = 2.5V is still off.

 

Connect the gate to the USB 5V, right?

 

The Vgs from the datasheet says 2.0V min, 2.7V avg, 4.0V max.

 

If it is 4.0V, then if the gate is supplied 5.0V, then it would mean that conduction would start at 1.0V or below, right?

If it is 2.7V, then if the gate is supplied 5.0V, then it would mean that conduction would start at 2.3V or below, right?

If it is 2.0V, then if the gate is supplied 5.0V, then it would mean that conduction would start at 3.0V or below, right?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, connect gate to 5V.

 

I was looking to this graph:

and thought that at 2.5V the MOSFET would be off completely.

But now that you point out to Vgs down to 2V, I see this:

It looks like it may not work if the other side is powered at 2.5V. The clean solution is the one with the resistor divider (and cheaper) where Vgs goes to zero or even better, at negative voltage.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks angelu!  I appreciate everyone's help.

 

I found a 2N7000 to play around with built a circuit.  I setup 2.5V on one side and 5V on the other.  I found that gate voltages between 2.1V and 4.1V allowed each side to go rail to rail.  Should I try to use a gate voltage in the middle at 3.1V?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, #19 is counting on the high gate threshold to make the level shifter work with the gate connected to HV instead of LV. That's smart.

But in case you want to try the JFET, I will point out that this circuit is symmetrical so it doesn't really matter which side is HV and LV, and also there is no body diode to take into consideration.

The disadvantage is that JFETs are more expensive than other transistor types, and certainly much more expensive than a diode...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found a MPF102 in my junk parts box to try the JFET!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps the MPF102 isn't well suited.  I have 3 of them and they each acted a bit differently (possible they could be damaged).  It seems they were somewhat conducting as the two voltages would be a bit towards each other.  2.5V and 5V might be 3.1V and 4.5V for example.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Should I try to use a gate voltage in the middle at 3.1V?

Yes. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:

Perhaps the MPF102 isn't well suited.  I have 3 of them and they each acted a bit differently (possible they could be damaged).  It seems they were somewhat conducting as the two voltages would be a bit towards each other.  2.5V and 5V might be 3.1V and 4.5V for example.

 

Yeah, that one has to much variability in cutoff voltages. But anyway, it seems you'll manage with a MOSFET.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
It seems they were somewhat conducting as the two voltages would be a bit towards each other.

With any FET switch it is important to provide a load resistance in the range of 1k to 100k in order to reduce capacitive feedthrough of the input signal that would otherwise occur during the OFF state.

(page 171, 3.4.1 FET analog switches)

http://www.cambridge.org/us/academic/subjects/physics/electronics-physicists/art-electronics-3rd-edition

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
The disadvantage is that JFETs are more expensive than other transistor types, ...
Agreed if manufacturing hundreds of items though JFETs are a part of the solution to some problems.

Three jellybean transistors per AofE :

  • 7000 NMOS
  • 5457 NJFET
  • 3904 NPN

 

http://www.cambridge.org/us/academic/subjects/physics/electronics-physicists/art-electronics-3rd-edition (page 170, Fig. 3.58, Noise voltage of three popular jellybeans, ...)

https://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkey2N7002LT3G

https://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyMMBF5457

https://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyMMBT3904LT3G

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
Yeah, that one has to much variability in cutoff voltages.
MMBF5457 would be better.

 

http://www.mouser.com/ds/2/308/mpf102-d-1193745.pdf

http://www.mouser.com/ds/2/308/MMBF5457-1125096.pdf

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I already tested the level shifter with BF862, which has a threshold of -0.3 to -1.2 (it needs to be low so that it turns fully off at the minimum required voltage, 2.5V in this case).

I think the 2SK3557-7 (there are 2 bins, -6 and -7) would be ideal, with a cutoff of about -0.7 to -1.2.

 

Anyway, here is a trace using the BF862, output is 2.5V open drain with 10k pull-up (from an ADUC7060 MCU), and 10k pull-up to 5V on the input side (input is a cmos device, in this case a TM1638 LED driver). This is a 5us pulse.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
I already tested the level shifter with BF862, which has a threshold of -0.3 to -1.2 (it needs to be low so that it turns fully off at the minimum required voltage, 2.5V in this case).
MMBFJ201 may be an alternate to BF862.

 

http://www.mouser.com/ds/2/308/MMBFJ201-1125148.pdf (page 3, Vgs(off) = -0.3V .. -1.5V)

https://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyMMBFJ201

https://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyBF862235

 


more:

MMBFJ201 should be functional as a level translator.

The high side does not reach zero volts (channel resistance) during low-side drive but is close enough.

Recommend a 1KR between MMBFJ201's source and the high-side data pin :

  • series termination (reducing transition speed reduces EMI)
  • current limiting

Change 1KR to 499R to get closer (200mV) to GND.

MMBFJ201 appears to be rugged so should survive a side's short and might survive a catastrophic failure.

Internal pull-ups on both sides is more than adequate unless both sides are XMEGA E one-wire half-duplex UART at max rate (4Mbps); if that's so then disable both internal pull-ups and add 10KR external pull-ups.

A defect is when the high-side is not powered (then MMBFJ201 is slightly on) and the low-side AVR drives (active low) the low-side AVR idles (inactive high) then the high-side AVR will exceed its max I/O pin voltage pin will be about 400mV above the power rail at room temperature and 600mV above the power rail at very cold temperatures; the current is well limited so the high-side AVR might should not be damaged. (forgot the AVR ESD diodes)

If USB VBUS is low impedance to GND then the low-side power will be drained; one solution is a Schottky diode from USB VBUS to the high-side AVR Vcc.

If the high-side AVR is not disconnected from the low-side AVR then it will be powered through an ESD diode causing a drain on the low-side power.

Work-around: enable internal pull-up; if the bus is not inactive (high) then the high-side AVR is not powered; disable the internal pull-up; poll until bus is inactive (high)

 

Edits: more, strikethrus, Schottky diode, defect artifact, work-around

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Nov 1, 2017 - 05:57 PM