Author Topic: Level shifter 5v supply  (Read 1640 times)

0 Members and 1 Guest are viewing this topic.

Offline scarr999Topic starter

  • Contributor
  • Posts: 38
  • Country: gb
Level shifter 5v supply
« on: April 11, 2022, 12:44:36 pm »
Hi,

Siure this is a quite one for someone, looking for a 5v powered bi-directional level shifter 5v one side 3.3v on the other.

Thanks
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19623
  • Country: gb
  • 0999
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4250
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics

Offline scarr999Topic starter

  • Contributor
  • Posts: 38
  • Country: gb
Re: Level shifter 5v supply
« Reply #3 on: April 12, 2022, 07:40:19 am »
Sorry, didn't clarify I ideally want a single 5v supply IC that is bi-directional between 3.3v and 5v saves me adding a 3.3v reg as the 3.3v device is powered from 5v but is only 3.3v tolerate on the I/O lines.

Thx

Steve
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6372
  • Country: ro
Re: Level shifter 5v supply
« Reply #4 on: April 12, 2022, 08:00:48 am »
Bi-directional level shifter for I²C-bus and other systems - PHILIPS AN97055
https://cdn-shop.adafruit.com/datasheets/an97055.pdf

Similar idea works with bipolar transistors, too.
http://www.hagtech.com/pdf/iic.pdf
« Last Edit: April 12, 2022, 08:12:59 am by RoGeorge »
 

Offline kjr18

  • Regular Contributor
  • *
  • Posts: 200
  • Country: pl
Re: Level shifter 5v supply
« Reply #5 on: April 12, 2022, 08:04:24 am »
I don't think you will find something like that, closest to what you need would be this module.. I think that depending on your needs it will be cheaper and easier using an LDO, than using something else. If your device uses 5V as supply voltage but needs 3,3V on data pins then it should have it's own LDO. Would it be possible to take it out from it to use for level shifting?
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4250
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Level shifter 5v supply
« Reply #6 on: April 12, 2022, 08:11:22 am »
the 3.3v device is powered from 5v

This sounds... unexpected. It would help to see the relevant portion of your schematic.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Level shifter 5v supply
« Reply #7 on: April 12, 2022, 09:49:53 am »
Also we need to know Vih.min of the 5V logic level device.   The easiest option to avoid much asking of questions and waste of time is to give us part numbers (and preferably datasheet links) for both devices, and if there's more than one signal involved, a schematic of their interconnects.

http://www.catb.org/~esr/faqs/smart-questions.html
 

Offline scarr999Topic starter

  • Contributor
  • Posts: 38
  • Country: gb
Re: Level shifter 5v supply
« Reply #8 on: April 12, 2022, 12:42:50 pm »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Level shifter 5v supply
« Reply #9 on: April 12, 2022, 01:05:51 pm »
ATmega328P Vih.min is 0.6 x Vcc, which is 3.0V @5V Vcc, so you may not need level shifting (but only 0.3V margin isn't good for EMI resistance).  Series resistors + precision clamping to 3.3V on the IoD-09TH side may be sufficient.  Unless this is a low power design, I would suggest a TL431 to shunt regulate the clamping rail.

OTOH if you do need 'real' level shifting we'd need to know what signals are involved, and how fast they are.
« Last Edit: April 12, 2022, 03:06:40 pm by Ian.M »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2053
  • Country: us
Re: Level shifter 5v supply
« Reply #10 on: April 12, 2022, 02:30:30 pm »
The datasheet  for the IoD-09 says it uses a nominal 5V supply, but requires a minimum of 4V.  So is it the Atmega328P that's running at 3.3V?  It seems you could just run everything at 5V.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Level shifter 5v supply
« Reply #11 on: April 12, 2022, 03:02:30 pm »
Its ESP8266 based with an in-module 3.3V regulator so I *ASS*U*ME* the 5V device is the ATmega328P . . .
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19623
  • Country: gb
  • 0999
Re: Level shifter 5v supply
« Reply #12 on: April 12, 2022, 04:18:09 pm »
A BJT will work in both directions, although the hFE is lower in reverse, but that doesn't matter with this circuit.  The base is biased to just above 3.3V, by R1 & R2, to the emitter floats are just over 3V. When IO1 is pulled low, current flows through R1 to Q1's base, turning it on and pulling IO2 to 0V. When IO2 is pulled low, Q1's bas-collector junction acts as a diode, pulling R2 to 0.6V, but the voltage on IO2 is even lower. The small parasitic capacitance on IO1 will discharge, as Q1 will work in reverse.
« Last Edit: June 30, 2022, 05:12:56 pm by Zero999 »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2053
  • Country: us
Re: Level shifter 5v supply
« Reply #13 on: April 12, 2022, 04:54:44 pm »
Its ESP8266 based with an in-module 3.3V regulator so I *ASS*U*ME* the 5V device is the ATmega328P . . .

Yes, I didn't read far enough.  All of the I/O pins are 3.3V.  So maybe the ATmega328P could be run at 3.3V.  Anyway, I just have no good experience trying to do bidirectional level shifting, and always ended up makng each line unidirectional. 
 
The following users thanked this post: Ian.M

Offline tepalia02

  • Regular Contributor
  • *
  • Posts: 100
  • Country: bd
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6016
  • Country: es
Re: Level shifter 5v supply
« Reply #15 on: April 26, 2022, 01:50:23 pm »
TXS0108E
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2451
  • Country: gb
  • Recovering Electrical Engineer
 

Offline kjr18

  • Regular Contributor
  • *
  • Posts: 200
  • Country: pl
Re: Level shifter 5v supply
« Reply #17 on: April 27, 2022, 01:21:19 pm »
Atmega328p can run on 3.3V just fine, but only at 8MHz. What are you going to use? SPI, I2C or serial? How about using one of these transistor based boards and using one of unused IoD-09TH pins set to provide 3.3V for level shifting? You don't need much current for this?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Level shifter 5v supply
« Reply #18 on: April 27, 2022, 02:20:34 pm »
OTOH those 'transistor' (actually MOSFET) level shifter boards (based on the classic Philips I2C level shifter app note) are actually fairly useless for fast signals.  They typically have 10K pullups either side of the MOSFET which interacting with the MOSFET gate and Miller capacitance results in rather slow risetimes.  As-is, its probably usable for a few tens of Khz signals without grossly excessive duty cycle distortion, or with much lower pullups e.g. 1K you can push it to a few hundred KHz.  Don't expect it to 'play well' with fast SPI!

Have a play with this LTspice sim which shows a 3.8us risetime on the 5V side just due to the MOSFET miller capacitance without any additional wiring capacitance :(
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19623
  • Country: gb
  • 0999
Re: Level shifter 5v supply
« Reply #19 on: April 27, 2022, 02:56:28 pm »
OTOH those 'transistor' (actually MOSFET) level shifter boards (based on the classic Philips I2C level shifter app note) are actually fairly useless for fast signals.  They typically have 10K pullups either side of the MOSFET which interacting with the MOSFET gate and Miller capacitance results in rather slow risetimes.  As-is, its probably usable for a few tens of Khz signals without grossly excessive duty cycle distortion, or with much lower pullups e.g. 1K you can push it to a few hundred KHz.  Don't expect it to 'play well' with fast SPI!

Have a play with this LTspice sim which shows a 3.8us risetime on the 5V side just due to the MOSFET miller capacitance without any additional wiring capacitance :(
A MOSFET is a type of transistor, so the name is correct.

The BJT circuit I posted is faster, even with the resistor values I posted above. Reducing them makes it faster.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Level shifter 5v supply
« Reply #20 on: April 27, 2022, 03:17:17 pm »
Yes, 'transistor' is correct for both but as their characteristics are notably different, its worth recognizing the distinction between BJT and MOSFET level shifters.

I've modded your sim to use my switched sources (tristatable push-pull output equivalent) for test signals , at ten times the speed, and changed the R3 pullup to 10K,  to enable an 'apples to apples' comparison with my MOSFET sim.   Its also worth noting that if you have a 3.3V rail available the R1:R2 potential divider can be replaced with a single resistor, giving your circuit the cost advantage as well as the speed advantage.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19623
  • Country: gb
  • 0999
Re: Level shifter 5v supply
« Reply #21 on: April 27, 2022, 05:38:34 pm »
The original poster needs it to run off a single 5V supply. Either way, small BJTs are cheaper than the 2N7000, so my circuit has a cost advantage, regardless of whether two or three resistors are used.

Heck, use a digital transistor which costs the same as an ordinary BJT and only two or one resistor(s) need to be added, depending on whether a 3.3V rail is available, or not.
https://uk.rs-online.com/web/p/bipolar-transistors/0287667
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Level shifter 5v supply
« Reply #22 on: April 27, 2022, 05:46:54 pm »
Thanks for reminding me of the single supply requirement.  That makes the MOSFET version even less attractive as it requires a fairly 'stiff' 3.3V rail.  If using a potential divider its going to need good decoupling on the tap, as even 1K Thevenin equivalent resistance will make the edges *fugly*.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf