12/23/2012

Level-Shifter for XBee & Raspberry Pi

Some projects have mixed supply voltages (e.g. 5 Volt and 3.3 Volt) and sometimes integrated circuits don't work with those unequal signal levels - or worse get damaged by the higher level supply signals.
Level shifter pcb

In case of the XBee which is driven by 3.3 Volt up to now I added a simple resistor divider to get the signals down to the lower supply level (see this older post ). But even if you feed the XBee without translating the different supply levels, I never got any problems (but I wouldn't recommend).

It might look slightly different with the Raspberry Pi, so to be on the safe side I built a simple 2-bit bidirectional voltage-level translator circuit for the alleged thin-skinned RasPi. You just need four 10k resistors, two BSS138 (N-Channel Logic Level Enhancement Mode Field Effect Transistor) and two four-pin headers.

I etched the board by myself but if you want to take the short way, there are already breakout boards and ICs available (e.g. Sparkfun Logic Level Converter, TXS0102 from Texas Instruments or ADuM1250/ ADuM1251 from Analog Devices).

Anyway I wanted to do some practice with my favourite pcb layout software Eagle and designed this simple pcb.

How does the level shifting work? If nothing happens on the bus (in this special case on the I2C-bus, thats what the pcb is labled for, but it also works with RX/ TX or any other 2-bit bidirectional digital purposes) all signals are pulled high by the 10k resistors. If either side goes low, the N-Channel MOSFET steps in and also pulls the signal line low, either because it turns on (low level side) or passes through the body diode (high level side).

3 comments:

  1. I found that your post is very impressive. Xbee quick start
    tutorial is a good source for learning XBee.

    ReplyDelete
  2. When I choose from the list on the left The page displays the blog page I was previously looking at and then the one I have chosen under that. Strange fault in page loading Ty Tower

    ReplyDelete
  3. Do you have the eagle files available anywhere?

    ReplyDelete