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).

12/14/2012

Electronic compass

Just a note to a little project I'm building at the moment - an electronic/ digital compass:


There is no XBee involved - but a Nokia5110 lcd display, an Arduino Nano, a 2-axis compass module (HDMM01) and a HCF4050 for level-shifting. Of course you could add a XBee if you are using the compass for a robot or other mobile project.

And yes - the Halloween project is still to be posted. Just give me some more time.