Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:00 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Level-shifting modules

Author Message
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 06:48am 30 May 2022
Copy link to clipboard 
Print this post

I realise that they are often cited for such things as SPI and I2C so I was puzzled to find the following.

  Quote  
If you want to use Bi-directional level shifter module for any communication protocol, make sure the frequency is not too high.
In Serial communication between NodeMCU and Arduino, I have to reduce the baudrate from 115200 to 9600. Otherwise the message sent is corrupted (Character is unreadable).


Came from the comments section

Can anyone vouch for these things in a high-speed application?

Craig
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 06:58am 30 May 2022
Copy link to clipboard 
Print this post

Certainly work fine for me in I2C at 400KHz. Choice of mosfet is important and its not impossible that some modules may be out there with incorrect parts
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 07:26am 30 May 2022
Copy link to clipboard 
Print this post

Craig.

I2C is inter integrated circuit which means very short cables.
Level shifters use a resistor to charge cable capacitance.
So for long cables there will be a speed limit.

Peter(B)
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 07:32am 30 May 2022
Copy link to clipboard 
Print this post

  matherp said  Certainly work fine for me in I2C at 400KHz. Choice of mosfet is important and its not impossible that some modules may be out there with incorrect parts


Hmmm, I'm looking at MHz. I actually only need uni-directional.

Reading more and more claims of being "too slow".

I think I might go with the CD4050BE instead  


Craig
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 07:43am 30 May 2022
Copy link to clipboard 
Print this post

  PeterB said  Craig.

I2C is inter integrated circuit which means very short cables.
Level shifters use a resistor to charge cable capacitance.
So for long cables there will be a speed limit.

Peter(B)


Hi Peter,

I'm dealing with a bunch of 5v incremental encoders that I need to drop to 3v3. In most cases, we're talking a few hundred KHz but this can easily get up to MHz.



Craig
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 07:51am 30 May 2022
Copy link to clipboard 
Print this post

Craig. (again)

If cables are more than a foot or so it could well be worth while going to opto- couplers. That will also solve the level shifting problem.

Peter(B)

And you are in a high noise environment I think.
Edited 2022-05-30 17:54 by PeterB
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 08:00am 30 May 2022
Copy link to clipboard 
Print this post

  PeterB said  Craig. (again)

If cables are more than a foot or so it could well be worth while going to opto- couplers. That will also solve the level shifting problem.

Peter(B)


Cables are >10m. Encoders are equipped with differential line-drivers that feed my (MC3486) line-receivers. This is all standard stuff. It's the output from the 5v line-receivers that I need to drop to 3v3.



Craig
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 08:32am 30 May 2022
Copy link to clipboard 
Print this post

For input only, try a simple voltage divider between the line receiver and 3.3V input pin. Try 1k and 2.2k for a start. Lower values may allow higher speeds but need more drive current.
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 08:42am 30 May 2022
Copy link to clipboard 
Print this post

  phil99 said  For input only, try a simple voltage divider between the line receiver and 3.3V input pin. Try 1k and 2.2k for a start. Lower values may allow higher speeds but need more drive current.


Unfortunately, this is not something that I can experiment with because the entire machine needs to be powered-up. I cannot simulate with my desktop motor-rig. These are HUGE motors and mechanically decoupling (for safe testing) isn't an option.

I'm just gonna go with the CD4050s.  



Craig
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 09:06am 30 May 2022
Copy link to clipboard 
Print this post

Hi Tinine,

There are 2 different types of levels shifters

- unidirectional ones: these are the simplest and most reliable, and can be purchased in various speeds, up to the GHz range. A simple 74LVT04 part can perform these functions shifting UP and shifting DOWN. But also a simple voltage divider can succeed.

- bidirectional level shifters. This is mainly I2C application, but we have seen SPI (as PS2 keyboard) and other applications. These level shifters typically have an active level, and a passive level. The level shifters discussed before have active low level, and passive high level.
The passive level is typically achieved by a pullup resistor. The active level by a FET. In case of the picomite, the active level is achieved by the (relatively weak) output pin of the RP2040 (50 ohm), in series with the FET (10 ohm) in the level shifter. And the combination of these should ensure a reliable LOW level, when driving the pullup resistor.
This determines the value of the pullup resistor (i.e. 10k, 5k or 2k).
The pullup resistor value (in combination with capacitance in the circuit) determines the maximum frequency you can use on this level shifter.

In practice you will see that 400kHz I2C will already violate the I2C specification when driving more that 1 I2C device on the bus. That does not say that it does not work. But you will see some devices that may not work, while many will.

Philips have developed special I2C driver chips for longer I2C busses that have very strong drivers that can work with 100 ohm or 500 ohm pullup resistors. These chips will allow longer I2C busses, and absorb more capacitive load. But these drivers also have speed limits.

Dear Tinine,

If you want to have a high speed level shifter, please make sure you design around unidirectional signals in your bus. So SPI using separate data in and data out (not PS2). Unless 400kHz is enough, and you have short (low capacitance) wiring.
PicomiteVGA PETSCII ROBOTS
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 09:07am 30 May 2022
Copy link to clipboard 
Print this post

  Tinine said  
  matherp said  Certainly work fine for me in I2C at 400KHz. Choice of mosfet is important and its not impossible that some modules may be out there with incorrect parts


Hmmm, I'm looking at MHz. I actually only need uni-directional.

Reading more and more claims of being "too slow".

I think I might go with the CD4050BE instead  


Craig


Only I2C is bidirectional (out of the two discussed) and maximum of 400KHz, so that you are asking for MHz tells me you are looking at SPI(?). If so, then the signal lines are uni-directional. Consider using a bus buffer chip. With VCC=5V, Vih of 3V is a high enough "1" to be recognised OK and you won't have the lag of a relying on a resistor for pull-up. It will go to several MHz but maybe not the 20MHz maximum specified for SPI. But I bet there is some variant that will or at least approach it... easy 10Mhz https://www.onsemi.com/pdf/datasheet/74vhc240-d.pdf
Edited 2022-05-30 19:21 by CaptainBoing
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 09:26am 30 May 2022
Copy link to clipboard 
Print this post

Tinine,

Look at AM26LV32E. This is a quad high speed diff line receiver (32MHz) for 3.3V
No need for level shifter....

Volhout
Edited 2022-05-30 19:29 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 09:41am 30 May 2022
Copy link to clipboard 
Print this post

  Volhout said  Tinine,

Look at AM26LV32E. This is a quad high speed diff line receiver (32MHz) for 3.3V
No need for level shifter....

Volhout


Many thanks, guys  

I have lots of pending orders for my controller and so the big problem right now is to design with components that are not in short supply:

-Propeller P2...no problem
-Pico...no problem
-Older DIP devices...no problem

Stuff that I would ideally like to use:





Problem  


Craig
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 09:57am 30 May 2022
Copy link to clipboard 
Print this post

if you can live with 10MHz (still pretty bleedin' quick) 74VHC240 in stock and available at many sources https://www.ebay.co.uk/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313&_nkw=74vhc240&_sacat=0
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 10:23am 30 May 2022
Copy link to clipboard 
Print this post

For a line-receiver, I'm really comfortable with the MC3486, been using it for years. For the level-shift, the big suppliers have plenty of CD4050Bs. I don't see much risk, here  






Craig
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 09:47am 31 May 2022
Copy link to clipboard 
Print this post

Have a look

Mouser


All my other distributors are many weeks too.
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 01:04pm 31 May 2022
Copy link to clipboard 
Print this post

These guys appear to be kicking butt right now:





I had a look on AE and grabbed 100 "CD4050"s, shipped for ten quid. Too risky for my controller but I'll test a few on my desktop rig.




Craig
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025