Shop OBEX P1 Docs P2 Docs Learn Events
Charge/Low Voltage Sensing Circuit: Will This Fry a Pin? Do I need the schmitt? — Parallax Forums

Charge/Low Voltage Sensing Circuit: Will This Fry a Pin? Do I need the schmitt?

ZootZoot Posts: 2,227
edited 2006-10-05 17:47 in BASIC Stamp
I cribbed this charge-sensing circuit from an old (~70s) book on electronics and robots, and since I had the parts, I wired it up.

It works perfectly -- I get a logic 0/1 on PIN when the charger is hooked up to my bot, and I've bench tested the short-circuit diode (D1) and fuse protection.

However, before I hook it up to an actual pin on my Stamp, I want to know if it's OK. I'm a little concerned that the R2 pull-up should be a higher value? and maybe I should put in a 220 protection resistor between the circuit and the Stamp pin? Any other possible problems? I'm still pretty much a newbie at circuit design.

I'm using this because eventually I'm going to have my bot seek out it's charger and then it needs to know that it's hooked up. I use a trickle charger and when the current drops to, well, a trickle, the output of this circuit goes back to logic 0. There are charging prongs on the front of the bot, hence the need for short-circuit protection across those terminals.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

Post Edited (Zoot) : 10/4/2006 10:51:26 PM GMT
729 x 419 - 7K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-09-26 21:04
    The Zener diode and series 470 ohm resistor is already a pretty good protection system. It's always better to put a resistor between that point and the Stamp pin. I'd suggest 10K since you're only voltage sensing. No significant current has to flow through it
  • ZootZoot Posts: 2,227
    edited 2006-09-26 21:08
    When you mean voltage sensing, you mean that I'm just sensing the 1/0 logic voltage at my Stamp PIN, right? smile.gif -- the circuit is supposedly checking whether or not significant chage current is coming across the charging terminals.

    I'll plug it into a pin with 10K resistor and try it out. Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • ZootZoot Posts: 2,227
    edited 2006-10-04 22:58
    OK -- I breadboarded and then transferred to a protoboard the circuit attached below EXCEPT FOR the Schmitt inverter, which I'll be putting right next to the pins of my BS2p40. I tested the circuit with 5V, 12V and charger power supply and it works great, and I get good logic levels when the "battery" voltage drops below a preset 10.9v and when >= 12V is coming in to the charger terminals.

    I have a few questions because I realized that while the circuit works great, I don't understand everything about it.

    - do I need the Schmitt inverter that goes to my low voltage pin if I account for invalid logic levels in software (i.e., a kind of "debounce" or count on the pin before declaring that a real low voltage state on my battery exists)?

    - if I omit the schmitt inverter, would I need to put a limiting resistor between the Norton IC and my Stamp pin?

    - related -- if you use the output of a Schmitt, do you never need a limiting resistor between the inverter output and a Stamp pin? I guess what I'm asking is if you had bad voltage/current on the input to the Schmitt, I guess you could fry the Schmitt, but you wouldn't fry the Stamp pin?

    Any commentary or advice is greatly appreciated in advance.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
    1451 x 727 - 60K
  • terahertzterahertz Posts: 55
    edited 2006-10-05 03:03
    Without using a simulator or anything, I read this circuit like this. Assuming the battery stays at 12V and (-charger) stays grounded then there are ony 2^2 = 4 options:

    1)···if· charger··=·· < 12.7V·····and · PIN= 5V····then· PIN·· outflows 5/470 amps and no current flows into battery



    2)·· if charger =· >12.7V····· and·· PIN = 5V·· then·· PIN· doesn't source or sink current and there is unknown·current flow into battery from (+CHARGER)



    3)·· if charger = < 12.7V··· and·· PIN = 0V·· then· nothing happens



    4)·· if charger = > 12.7V and PIN = 0V·· then· PIN·· has a miniscule amount of sinked current·· ZD1 has exceeded breakdown voltage and is conducting
  • ZootZoot Posts: 2,227
    edited 2006-10-05 15:24
    Not sure if I was clear (probably not) -- PIN 13 and PIN 14 are always inputs. I read PIN 14 to see if battery voltage is low, so the bot can seek out it's charger; I read PIN 13 to see if the bot has managed to actually hook up to the charger. The circuit works great, but I am hoping to a) eliminate the schmitt inverter to save some board real estate, and b) to figure out some ground rules about when it is truly necessary to protect a Stamp pin with a limiting resister. Does that make sense?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • DaveGDaveG Posts: 84
    edited 2006-10-05 16:59
    Zoot,

    Regarding the Schmitt trigger, I think you can easily combine the comparator and the Schmitt trigger
    with the addition of a single resistor. Take a look at the National LM3900 data sheet. It shows a Schmitt
    trigger diagram.

    However, a software Schmitt trigger will do the same job.

    Regarding protecting a Stamp pin, I would suggest using a series resistor of at least 220 ohms whenever
    you are connecting a Stamp pin to the output of another device, such as a comparator or logic gate. This will
    prevent an accidental overload on the Stamp pin in case you inadvertently make Pin 14 an output.

    DaveG
  • ZootZoot Posts: 2,227
    edited 2006-10-05 17:47
    Thank you, thank you.
    DaveG said...
    I would suggest using a series resistor of at least 220 ohms whenever
    you are connecting a Stamp pin to the output of another device, such as a comparator or logic gate. This will
    prevent an accidental overload on the Stamp pin in case you inadvertently make Pin 14 an output.

    This answers such a basic newbie question for me, thanks again. I have been wondering why on some circuits I see there is protection between the Stamp and a TTL circuit and sometimes there isn't....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
Sign In or Register to comment.