Shop OBEX P1 Docs P2 Docs Learn Events
I2C Question — Parallax Forums

I2C Question

TheGrueTheGrue Posts: 114
edited 2011-11-23 11:13 in Propeller 1
I might be blind [my wife thinks so] but I haven't found any schematics on how to interface a 5V I2C sensor to the 3.3V Propeller. Do you use just the 5V pullup resistor and then the usual resistor between the Prop and the 5V bus?

Comments

  • Clive WakehamClive Wakeham Posts: 152
    edited 2011-11-23 00:11
    Put 1 kilo ohm resistors between the device and the Prop on the SDA and SCL lines. This will restrict the voltage to the Prop.

    There is also a specialised IC. The Texas Instruments PCA9306.
  • MagIO2MagIO2 Posts: 2,243
    edited 2011-11-23 00:25
    Did you try to simply pull-up to 3.3V instead? For my understanding I2C outputs usually are open collector, which means that no device will drive it with 5V even if it's a 5V device. They only pull it to low and let the pullup do the "drive-high".

    Inputs should also recognize 3.3V as high.

    Am I wrong here?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-11-23 04:46
    A pull-up to 3.3V will not guarantee the Vih for some 5V I2C chips which is a minimum of 0.7xVdd (=3.55V). Just use your usual 10K or so pullups to 5V and the current is limited already as I2C devices do not source current, they are open-drain. With the pull-ups tied to +5V the I2C lines will float to around 3.8V because of the substrate "diode" which is fine for both the Prop and the 5V I2C chip. The scheme with the series input resistors is absolutely redundant when you know that these I2C chips will not try to output 5V, only pull-down and also it's Vih is being met. Remember the minimums and maximums are guaranteed so it will always respond to 3.8V or even 3.6V so there is no need for those extra margins, they are already built-in.
  • yetiyeti Posts: 819
    edited 2011-11-23 04:51
  • RaymanRayman Posts: 14,851
    edited 2011-11-23 06:03
    It can be tricky... The DS1307 is a 5V device, but recognizes 3.3 V as logic high, so it works with just the pullup to 3.3 VDC.
    But, most chips won't recognize 3.3V as logic high reliably. There might be simple tricks to get it to work...
    My personal favorite way is to use the PCA9512 . This also allows the 5V I2C parts to be hot swappable...
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2011-11-23 09:31
    Take a look at this thread:
    "Low Cost PropStick variation for use with a PlugBoard"
    http://forums.parallax.com/showthread.php?134122-Low-Cost-PropStick-variation-for-use-with-a-PlugBoard&highlight=84805

    Voltage translation between I2C buses running at 3.3V and 5V is strait forward.
    See the schematic in the thread for theI2CLeverShifter. It uses 2 small MOSFETs and the pull up resisters on either side.

    Duane
  • JonnyMacJonnyMac Posts: 9,198
    edited 2011-11-23 10:26
    See the schematic in the thread for theI2CLeverShifter. It uses 2 small MOSFETs and the pull up resisters on either side.

    That circuitry is also useful for half-duplex, open-drain serial coms between 5v processors and the Propeller.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2011-11-23 11:13
    Yes.
    I also use this "Non-Inverting" circuit to interface to higher voltages, up to the voltage rating of the MOSFETs.
    Duane
Sign In or Register to comment.