Shop OBEX P1 Docs P2 Docs Learn Events
Tri-State Logic and a propeller input? — Parallax Forums

Tri-State Logic and a propeller input?

computer guycomputer guy Posts: 1,113
edited 2012-07-28 21:55 in Propeller 1
I am wanting to use the MCP73831 to charge the Li-Po battery running the propeller.
I then want to use the MCP73831's State line to tell the propeller when the battery is charging (so I can display a charging icon on an uOLED display).

The data-sheet for the MCP73831 states that the State line is tri-state logic (VSS-NC-VDD).
It also states that it can be connected to a microcontroller if pulled high (presumably to make it high when in the NC (floating) state.

My question is, what effect will this have on the propeller if the state pin switches between VSS, floating and 5V, and is then connected through a 10K pull-up to 3.3V and then to the propeller chip?

Should I put a 240ohm resistor on the prop pin to protect it from the 5V?



Thanks :)

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-07-28 06:32
    One can presumably draw up a 3x3 matrix 0/5/Tri along the x and 0/3.3/Tri along the y. There are lots of ways to consider all the possibilities but fortunately it all comes down to one simple solution - a 1k series resistor.

    There have been lots of discussions about the technicalities of this but it is the universal bidirectional 3.3V to 5V translator, as well as handling all the possibilities of the 9 combinations in that matrix.

    So you are very close to the answer - change that 240R to something a bit higher.

    Hmm - having said that, there may be those who will chime in to say that 2.7k is better. I guess for a more perfect technical answer - anything in series from 1k to 3.3k ought to work.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-28 08:15
    First of all, if you're running the MCP73831 from 5V, the pullup needs to go to 5V. You'll need at least a 2.2K resistor between the MCP73831's State line and the Prop I/O pin and the pullup will need to be a lot larger than the 2.2K. Use a 100K resistor.

    The 2.2K resistor is chosen based on Ohm's Law. The Prop I/O pin can handle 0.5mA through the protective diode and 5.0V - (3.3V + 0.6V) = 1.1V. R = E / I = 1.1V / 0.5mA = 2.2K. Since neither resistor values nor power supply voltages are exactly what's expected, you might pick a little higher resistor value, say 2.7K or 3.3K to "play it safe".
  • brianm734brianm734 Posts: 29
    edited 2012-07-28 09:07
    As an EE, I would not recommend you just use one resistor. When the Prop I/O pins are set to inputs they have high input impedance (>200K Ohm), so there would not be enough current flow through one resistor to cause a significant voltage drop. Even if you use a high value resistor (100K or more), this is still not good practice.

    I would do this (See below). This will give the Prop a 2.5V signal when the MCP73831 output goes high (5V).

    It should not matter if you pull the MCP73831 pin up or down, as long as it is a known state. The shematic below will pull the MCP73831 pin down, so you don't need to add anything else.

    Make sure the "GND" connection in the schematic connects to both the Propeller GND and the MCP73831 GND (Vss)

    You may need to change the Prop ina[pin] value appropriately.
    900 x 500 - 17K
  • AribaAriba Posts: 2,690
    edited 2012-07-28 10:46
    Here is a way to read all three possible states with a single 10k resistor and a bit of software:
    attachment.php?attachmentid=94563&d=1343497500
    Andy
    489 x 190 - 4K
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-07-28 11:00
    >not be enough current flow through one resistor to cause a significant voltage drop. Even if you use a high value resistor (100K or more).

    The prop have protection diodes that will shunt excessive voltages, so the 10k will keep the didoes from over currents.
    So in theory, one resistor is enough.
  • brianm734brianm734 Posts: 29
    edited 2012-07-28 11:18
    Yes, I understand, you can get away with only one resistor. Current is not the problem here because of the >200K ohm input impedance of the Prop pin. The voltage is the issue. If you exceed the breakdown voltage of the diode, you will loose function on the Prop I/O pin. I still do not recommend using one resistor. But it's your 8 bucks, so do as you wish.

    Ariba (Andy)- I like that code. Pretty sweet. The STATE pin on the MCP73831 is just designed to turn on an LED to indicate the charging state of the battery, so I don't think "Computer Guy" would need to do tri-state sensing, but it is pretty cool.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-28 18:53
    brianm734 wrote:
    Current is not the problem here because of the >200K ohm input impedance of the Prop pin.
    Current is indeed the issue here. The input impedance drops significantly as the input voltage begins to exceed 3.9V, due to the protection diodes. The datasheet specs a 500uA maximum current through these diodes in an overvoltage situation. A 3.3K series resistor, therefore, is more than adequate to protect against a 5V input.

    -Phil
  • computer guycomputer guy Posts: 1,113
    edited 2012-07-28 21:55
    brianm734 wrote: »
    It should not matter if you pull the MCP73831 pin up or down, as long as it is a known state.

    I don't think pulling it low would work, the state pin goes low to indicate charging, high to indicate charged and HiZ to indicate that the supply voltage is below the battery level (or no charge power is connected). With pulling it low, "no power" and "charging" would have the same state. Whereas you want "no power" and "charged" to have the same state.


    Thank you all for your input and advice, It's clear to me that there may be many ways of doing this however for this project I have decided to go with Mike Green's approach as it is closest to what I am familiar with. I will use a 100k pull-up to 5V and a 2.7K resistor in series to the prop pin.
Sign In or Register to comment.