Shop OBEX P1 Docs P2 Docs Learn Events
Problem interfacing to a 5v I2C device. — Parallax Forums

Problem interfacing to a 5v I2C device.

edlikestoboogieedlikestoboogie Posts: 71
edited 2009-12-28 22:55 in Propeller 1
I am trying to interface the prop to a 4 channel 10 bit ADC, the AD7995. Problem is, the ADC requires 3.4v i believe to see a logic high, and the prop can't do that without swinging out of the range for a logic 0 for the prop. Is there yet a simple solution to this without using an expensive level shifter like suggested in the sticky thread? The mosfet solution looks okay, is there a really simple way to interface these two devices?

Any help would be greatly appreciated.

-Ed

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-12 15:56
    The MOSFET solution described in the sticky thread (and NXP's website) is the simplest reliable way to interface a Propeller I/O pin to a 5V I2C device that needs more than 3V to see a logic high.

    Tracy Allen's message in the sticky thread on 5/14 describes using a 1K series resistor and a 10K pullup on the 5V device side of the series resistor. That should work for most cases of a single 5V I2C device not far from the Propeller.
  • edlikestoboogieedlikestoboogie Posts: 71
    edited 2009-12-27 10:23
    Hey Mike or anyone else that can help me,

    The suggested mosfet by NXP is the BSN10. But that part number is no longer availible. What is the replacement part number for the BSN10 for interfacing with 5 volt I2C devices using the prop? I am looking at the BSP89. I can't find out what the replacement for BSN10 is.

    Thanks in advance to anyone who can help.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-12-27 13:04
    The AD7995 has standard CMOS thresholds of 0.3VDD max low and 0.7VDD min high which translates to 1.5V max low and 3.5V min high. This is an easy thing to use the resistor technique to essentially put an offset on the Prop signal to make it work. Using a value of 10K to +5V on the I2C side and fed from a 2K2 resistor from the Prop will give you around 900mv logic low and 3.6V logic high which should work well.

    EDIT: 900mv not 0.900mv

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*

    Post Edited (Peter Jakacki) : 12/27/2009 1:36:23 PM GMT
  • edlikestoboogieedlikestoboogie Posts: 71
    edited 2009-12-28 10:29
    Hi Peter,

    I am having a little bit of trouble picturing your description of what I should do. Are we still talking about Tracy Allen's circuit attached here?? Could you describe a bit more clearly?

    thank you,
    250 x 176 - 5K
  • wjsteelewjsteele Posts: 697
    edited 2009-12-28 11:40
    Basically what you are going to do is add an additional voltage to your pin output. So instead of having Low =0 and High = 3.3, you have Low=1.7 and High = 5.0. Here's how it works...

    If I have an output from the prop that is only from 0-3.3 volts, but you need it to be higher, you will need to add voltage to it to get it to your desired threshold level of 3.6 volts when the pin is pulled high.

    However, the ADC (or any device for that matter) doesn't care if it is 0-5 volts, it actually cares if it is 3.6 to 5.0 volts (High) or not (Low.) So, if there is 3.3 volts coming in, it won't trigger and it will read that as low, regardless of how the pin is pulled.

    So, we can use that as a part of our circuit by supplying a constant voltage to the pin which gets added to the voltage of the pin output.

    If we supply 3.3 contsantly to it, the ADC will see that as low. If we then add 3.3 volts to it and pass that into the ADC, it will now see 6.6 volts... which is above the threshold for it seeing High.

    The resisters are there just to keep the voltage down in the range that is accpetable. For example... 6.6 volts is too high... so we limit it to 5 (or slighly less for safety's sake.)

    Also, the input only needs to be a little higher than 3.3 volts, so instead of having a constant supply of 3.3 volts you add a resitor to the supply side which limits it down to a constant supply of 1.7 which gets added to the 3.3 when the pin is pulled High giving us our 5.0 volts. When the pin is Low, you only have 1.7 volts which is below the threshold.

    Bill
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-12-28 12:27
    Ok, the logic high and low levels need to be in range as I previously mentioned. Anything in between this range of 0.3VDD to 0.7VDD is indeterminate so 1.7V is "noise", not a logic level. Assuming you have a 10K pullup on the eeprom to +5V you would then connect this line to the Prop via a 2K2 resistor to make it work. Tracy's circuit is for a +5V logic output into the Prop which is not the same thing as an open-drain I2C line from the eeprom (The AD chip needs to see logic levels "from" the Prop valid for a +5V supply)

    +5V --------10K---------|
    PROP -------2K2---------|-I2C
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • RaymanRayman Posts: 14,876
    edited 2009-12-28 13:21
    I've used the PCA9512A (gives hot-swap ability) and the PCA9509 (easy pin arrangement)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • wjsteelewjsteele Posts: 697
    edited 2009-12-28 18:15
    Yeah, Peter, you're right. I had various "edits" of my message and posted the wrong one. That one should have stated that in reality the Low signal is lower... normally just .5v or so. And that the .5 get's added to the 3.3 for a High.

    Is that correct?

    Bill
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-12-28 22:38
    wjsteele said...
    Yeah, Peter, you're right. I had various "edits" of my message and posted the wrong one. That one should have stated that in reality the Low signal is lower... normally just .5v or so. And that the .5 get's added to the 3.3 for a High.

    Is that correct?

    Bill

    Basically that's correct but you don't get a constant offset due to the dual supply.
    When the prop is outputting a low there is 5 volts across the series resistor combination and 5/(10K+2K2) current flows.
    When the prop outputs are high then only 1.7V (5-3.3) appears across the resistors and 1.7/(10K+2K2) current flows.
    So only a small offset gets added to the 3.3V signal but a much larger offset is added to the 0V signal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • jbalatjbalat Posts: 96
    edited 2009-12-28 22:55
    I got 2 of these in the mail they are very cheap and user friendly
    www.sparkfun.com/commerce/product_info.php?products_id=8745

    In the end I did not have to use them for my interface.. I used a BC337 to boost the prop signal.. It was very easy
    http://forums.parallax.com/attachment.php?attachmentid=66034
Sign In or Register to comment.