Go Down

Topic: Does xbee or Bluetooth not need voltage conversion with 5V arduino? (Read 6891 times) previous topic - next topic

liuzengqiang

I was just reading the schematic of this xbee shield and was a bit shocked to see the DIN and DOUT, both 3.3V logic, were directly connected to 5V arduino pins 0 and 1 without any voltage conversion. Am I right?

Product page:
http://iteadstudio.com/store/index.php?main_page=product_info&cPath=18&products_id=348

Schematic:
http://iteadstudio.com/store/images/produce/Shield/XBeeshield/sch-XBeeShield-V1.1.pdf

Here is a similar product. It has only a voltage divider on its RX and direct link of TX to arduino RX:
http://www.seeedstudio.com/depot/xbee%C3%82%C2%AE-shield-p-419.html?cPath=132_134

http://www.seeedstudio.com/wiki/images/0/05/Xbee_Shield_Schematic.jpg

I'm just not able to understand this. I thought 3.3V may not be enough for 5V arduino to register a logic HIGH and 5V is too much for 3.3V device for a HIGH. Any help? Thanks!
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

MarkT

I've looked at a few XBee datasheets and they don't seem to mention the max voltages for IO pins...  The UART is described as "3V3 CMOS".  It doesn't say if its input is 5V tolerant though.  I think this is an area where some people have been "lucky".  Its quite possible that different XBee's are different too, so I'd recommend level-shifting.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

liuzengqiang

Thanks Mark. I am considering integrating Bluetooth into my PCB so I will look at spark fun's level shifter design. They have MOSFET in a simple arrangement for level shifting.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

Brad Burleson


I thought 3.3V may not be enough for 5V arduino to register a logic HIGH


I've always operated with the thought that anything higher than 3v is a logic HIGH (ala http://dangerousprototypes.com/2011/04/25/voltage-threshold-chart/)

While I've never had a problem I'd be interested if this correct or not.

Brad (KF7FER)

CrossRoads

@Brad,
Input High Voltage, except XTAL1 and RESET pins:
Condition: VCC = 2.4V - 5.5V.
Minimum = 0.6VCC

So with 5V VCC, 3V would be good for a High as an Input.

However,
Output High Voltage except Reset pin:
Condition:  IOH = -20 mA, VCC = 5V
Minimum: 4.2V.

So if you're driving a part that is expecting 3.0 to 3.6V, and 3.3V typical, you could blow it out.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Brad Burleson


So with 5V VCC, 3V would be good for a High as an Input.


Ok, thanks for the confirmation. I feel better.

Quote

So if you're driving a part that is expecting 3.0 to 3.6V, and 3.3V typical, you could blow it out.


As I'd expect.  So sorry to hijack the OP's thread, but does that mean in general, when discussing the UART, that level conversion between 5V and 3.3V devices can be done simply with a pair of resistors?

Thanks again,

Brad.

PS I did mean to originally add that the XBee stuff I've bought in the past has always had some sort of level conversion (specifically the Adafruit boards).  Given what the modules cost, I would never consider anything else :-)

JChristensen


I was just reading the schematic of this xbee shield and was a bit shocked to see the DIN and DOUT, both 3.3V logic, were directly connected to 5V arduino pins 0 and 1 without any voltage conversion. Am I right?


You are right to be a bit shocked. XBee inputs are not 5V tolerant:
http://www.digi.com/support/kbase/kbaseresultdetl?id=2160

For breadboarding, I usually use an Adafruit XBee adapter, which level-shifts the input lines with a 74AHC125. For permanent projects, I use a diode and resistor to level-shift DIN, and I just connect DOUT directly to RX on the MCU. The latter may be a little sloppy, as the worst-case logic level specs don't line up exactly, but in practice it has worked well, and at least won't hurt anything, where I would be concerned about damage if an input were not level-shifted.

I can't find anything about 5V tolerance in the XBee product manual, I think that is a serious omission.

MarkT

Incidentally there is a way to measure if a 3V3 chip/module is likely to tolerate 5V inputs:

Normally all CMOS inputs have protection diodes to guard against stray static electricity taking the pin outside the voltage range it can handle - these diodes clamp the input in the range -0.5V to Vdd+0.5V approx, where Vdd is the supply voltage to the chip.  If you connect 5V via a highish value resistor (10k to 22k sort of range) to the input pin, the diode will clamp the voltage at the pin to about 3.8V if there is a diode.

If there is no diode the pin voltage will be 5.0V... If so this could be because the chip is designed to support 5V inputs.  But if not you may have already taken it past its limits.

Protection diodes are small and easy to burn-out, hence the 10k resistor to limit the current.

If you connect a 5V logic output directly to a diode-protected 3V3 input then the output stage of the 5V chip will try to push lots of current through the protection diode, which could lead to failure/deterioration of the diode and/or the output stage.

Putting a 10k resistor in series will act as a rough-and-ready level shifter (in conjunction with the protection diode).  the relatively high resistance means somewhat slower edges, sometimes this might matter (fast SPI for instance).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

JChristensen


Normally all CMOS inputs have protection diodes to guard against stray static electricity taking the pin outside the voltage range it can handle - these diodes clamp the input in the range -0.5V to Vdd+0.5V approx, where Vdd is the supply voltage to the chip.  If you connect 5V via a highish value resistor (10k to 22k sort of range) to the input pin, the diode will clamp the voltage at the pin to about 3.8V if there is a diode.

If there is no diode the pin voltage will be 5.0V... If so this could be because the chip is designed to support 5V inputs.  But if not you may have already taken it past its limits.


This doesn't mean that if a 3V3 chip does have 5V tolerant inputs, then it cannot also have static protection?

CrossRoads

Resistors as voltage divider can work if the data rates aren't fast.
For higher speeds, like SPI to an SD card, then an active driver is needed.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

liuzengqiang

Wow! Thanks to EVERYONE!  XD XD XD

So for lower speed communications I will take Jack's circuit with the diode and resistor circuit for Bee Din and just connect Bee's Dout to arduino.

Jack, is there any reason I can't use say 2.1Kohm resistor on the R4, except the current will double when the signal is low?

Does this diode-resistor converter have similar slew rate to a voltage divider due to the resistors? What is the advantage of the diode compared to a resistor in a voltage divider?

If I need higher speed I might have to use this circuit (from NXT document) like what sparkfun sells:

Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

CrossRoads

That, or a simple chip like this
http://www.dsscircuits.com/i2c-level-converter.html
or TXB0101, 0102, 0104, 0106, 0108.
http://www.ti.com/lit/ds/symlink/txb0101.pdf
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

runaway_pancake

The Xbee stuff doesn't have clamping diodes, so the series-resistor head-fake won't work.
That Philips 3V/5V is it for interfacing 5V outputs to 3V inputs.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

JChristensen


Wow! Thanks to EVERYONE!  XD XD XD

So for lower speed communications I will take Jack's circuit with the diode and resistor circuit for Bee Din and just connect Bee's Dout to arduino.

Jack, is there any reason I can't use say 2.1Kohm resistor on the R4, except the current will double when the signal is low?

Does this diode-resistor converter have similar slew rate to a voltage divider due to the resistors? What is the advantage of the diode compared to a resistor in a voltage divider?

If I need higher speed I might have to use this circuit (from NXT document) like what sparkfun sells:


I would think the diode-resistor approach would be superior to a resistive voltage divider. I can think of no advantage whatsoever that a voltage divider would have, personally I wouldn't use it.

I don't have a scope, so have no idea on slew rates. There should be no problem with a smaller pullup resistor, smaller should improve the slew rate. The only worry would be not to exceed the current sink rating for the MCU, but that'd take a pretty small resistor that might be past the point of diminishing slew-rate returns anyway.

BTW I use the diode circuit at 115200 bps with no apparent difficulty.

liuzengqiang


BTW I use the diode circuit at 115200 bps with no apparent difficulty.


Ah, this fact really helps. I'll do it with the diode way :) Thanks.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

Go Up