Logic Level Converter -> XBee 3.3v / AtMega328p 5v

I have read a lot about this subject to safely interface my xbee to an atmega328p running on 5v. I have a logic level converter from sparkfun which its schema is available on http://www.sparkfun.com/datasheets/BreakoutBoards/Level-Converter-v10.pdf. It works perfectly of course.

But, I don’t want to use one of this on my final circuit so I made a circuit and I changed the BSS138 with a 2N2222 because I don’t want to do SMD soldering. So, my question is: is it safe?

My actual schema is attached.

Thanks,

Wagner Sartori Junior

logic_level_converter.png

Well, a MOSFET is not exactly interchangeable with a BJT, but you've got the right idea. I would move the 10k resistor to be in series with the transistor base, and then connected to +3.3V.

-- The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

Like this?

logic_level_converter_v2.png

Yes.

-- The Arduino Drum Machine: MIDI development system with 14-track MIDI drum machine sequencer / groove-box software

Ok, I'll make the circuit and test it before I plug my XBEE ;).

Thank you very much for your help.

TX part(transistor) is working fine.

The RX part(voltage divider) is not OK and I don’t know why. I tried using 2 x 10k, 10k+22k and 2.2k+3.3k resistors. None of them make it work.

Using sparkfun’s logic level converter, works perfectly. My circuit is exactly as showed onmy last schema uploaded to this thread.

Can you measure RX3V with a DMM? Is it about 2.5V when there is no serial activity?


The Quick Shield: breakout all 28 pins to quick-connect terminals

It's measuring 3.3v not 2.5(2 x 10k is half right?).

RX from atmega328p is measuring 4.62v. RX to xbee is measuring 3.3v.

Also I measured both resistors(they are 5%) and are OK.

It sounds like you have connected to an output on the XBee instead of an input.

Try disconnecting RX3V from the circuit then you should measure ~2.5V at the center of the two resistors. Then, check your wiring and see what's going on with that RX3V pin and why it's an output instead of an input.

-- The Aussie Shield: breakout all 28 pins to quick-connect terminals

you're righ. all my circuit are inverted(RX/TX) on both sides.

newbie error, sorry ;)

thank you it's working fine now.