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?
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!
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.
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.
CrossRoads:
So with 5V VCC, 3V would be good for a High as an Input.
Ok, thanks for the confirmation. I feel better.
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
liudr:
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?
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.
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).
MarkT:
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?
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:
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.
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.