Connect with us

easy basic stamp question

Discussion in 'Electronic Basics' started by Mike_in_SD, Jan 24, 2007.

Scroll to continue with content
  1. Mike_in_SD

    Mike_in_SD Guest

    Having a brain burb here.

    I need a basic stamp (actually a basic atom) to know when I step on the
    brake pedal of my car.

    I have to change the 12v into a 5v/high for the stamp.

    Using a 7805 seems like way overkill

  2. Series resistor and zener.

  3. Jamie

    Jamie Guest

  4. Overkill for a sense input.
  5. Mike_in_SD

    Mike_in_SD Guest

    (Homer J Simpson) wrote in
    My ohms law isnt totally gone .. but is it

    R = 12v_source/30ma sinking capacity of stamp pin


    R = 7v_needed to get rid of/30ma sinking capacity of stamp pin

    and what about the zener ?

    sorry about the hand holding .. but .. this is "basic electro" grin

  6. Use the lowest current you can reasonably find and a resistor that is enough
    to turn it on. You don't need to dump max current into the pin for input.

  7. feebo

    feebo Guest

    it depends on your car's system... some have 12v at the switch and
    when the switch closes, the "output" of the switch puts the 12v on the
    wire to the brake lights. If this is the case, see the following link

    this gives you a HI on the output when 12V appears at the input. This
    is OK, but you might like to replace the zener set-up with an
    opto-coupler just to be doubly safe - only about $0.50 for a suitable
    6 pin device


    if your car has 12V on the light cluster and when you press the brake
    the switch provides a link to ground, see this link

    this gives you a LO when you press the brake (deal with the ac tive LO
    in software).

    both circuits will provide a jittery output as no debouncing is done -
    that is the signal will not switch cleanly but have some spikes when
    you first press and then release the pedal - this could be sorted with
    small capacitor between the outupt to the PI and ground
  8. Mike_in_SD

    Mike_in_SD Guest

    Im using it as an interrupt so jittery is ok ...

    thanks so much for the diagrams ...

  9. feebo

    feebo Guest

    hmmm... I suspect the non-debounced output will cause multiple
    triggering of your interrupt - is this OK?
  10. Mike_in_SD

    Mike_in_SD Guest

    yea .. Im pretty sure it will be ok.

    What I am doing is ... I put a modern a500 automatic tranny in my
    34 ply street rod. Normally this tranny is computer controled as to
    when it shifts into overdrive and locks up the torque converter etc.

    So I am building a controller to control when it shifts etc, and when
    it senses that I touched the brake, it should disingauge the converter
    immediately ... so I dont care if it bounces.

    they should make a 7805-5 where you have 5 7805's all on one chip
    ... for just this scenario, where you just want to do a ttl level
    "sense" of the 12v.

    anyways .. thanks for the help
  11. Wim Lewis

    Wim Lewis Guest

    That would be what you would want if the stamp pin were acting as an
    output, and you wanted to avoid burning it out. But that's not
    what you're doing. Instead you're using it as an input. You don't
    really care how much current flows, as long as the stamp can sense
    the voltage correctly and nothing gets damaged.

    There's a common trick for this. All you need is a largish resistor.
    You don't actually need a zener or anything remotely as complex as
    a 7805. I'll explain.

    Logic inputs normally don't let any current flow (they're just
    voltage-sensitive) but they have a pair of "protection diodes" on
    the chip, going to the positive and negative (ground) rails, to
    keep the input voltage from going out of bounds and damaging the
    actual logic gate. The protection diodes aren't designed to take
    very much current, but they can take some. So, let's say you simply
    connect your stamp input to the 12v signal through a resistor, which
    I will randomly choose a value for, of 100K. Some current will flow
    through the resistor, into the input pin, through the protection
    diode, and onto the +5v supply. How much current? Well, (12v - 5v)/100K,
    or 0.07 milliamps. Not very much! (Actually, it will be a little
    less, since the protection diode will have some voltage drop
    associated with it.) 0.07 mA is small enough that it won't hurt
    anything to have that much current going through the protection
    diodes. So this ought to work fine.

    Going into more detail, though, what values of resistor are OK?
    There'll be a lower limit and an upper limit. If the resistor is
    too small, then too much current will flow through the protection
    diodes (which, remember, really aren't intended to carry very much
    current) and burn them out, probably followed by burning out the
    rest of the chip. If you look in the datasheet for the PIC on the
    Stamp, in the "Electrical Characteristics" section it lists the
    maximum "input clamp current". The particular PIC I just looked at
    says it can handle 20mA there. (That's more than I thought!)
    I'd be conservative and limit it to 2 mA, which works out to a resistor
    value of (12v - 5v)/2mA = 3.5K. So any resistor larger than 3.5K
    should be safe.

    What's the upper bound? How large of a resistor can you use before something
    stops working right? This is mostly determined by the capacitance of the
    input pin, and its leakage current. The capacitance will bite us first
    so I'll just calculate based on that. The datasheet says the IO pins
    have at most 50 pF of capacitance. When the signal voltage changes, that
    50 pF has to charge or discharge through the resistor. To a *very* rough
    approximation, the time it takes for that to happen is R*C, the resistance
    times the capacitance (if you work out all the units, you'll find that
    ohms times farads equals seconds, so this makes sense). If you make the
    resistor too large, then the input won't see changes quickly enough.
    For the 100K resistor I mentioned earlier, R*C = 100K * 50p = 5 microseconds.
    That's much faster than you need if you're just sensing a brake pedal.
    In fact, you might want to hang an extra capacitor onto the input pin
    (after the resistor) to slow down the input to (say) 5 millisconds, which
    could also filter out small glitches and spikes on the line and help
    to "debounce" the input a little.

    I hope this explanation helps a little.
  12. feebo

    feebo Guest

    but the 7805 is a voltage regulator - it's designed to give steady
    power - dunno how it will like being switched. just use an interface
    circuit similar to those I posted - gotta be cheaper too.
  13. Rich Grise

    Rich Grise Guest

    What overkll? It gets the job done in one part. Have you ever seen
    an L05? They come in TO-92 (or something very much like that.)

  14. Byron A Jeff

    Byron A Jeff Guest

    Probably not enough. The Stamp is expensive enough that you'd want to
    protect it from the harsh electrical environment of the typical auto.

    Use the 7805. Then at the very least put a current limiting resistor and
    a hefty zener diode in front of it.

    Think about the fact that car electrical systems can load dump and voltages
    of upwards of 60V can be placed on the system, frying everything in sight.

    Be prepared to sacrifice a dime zener or a 50 cent 7805 instead of the
    pricey stamp.

  15. Mike_in_SD

    Mike_in_SD Guest

    Im thinking you may be right feebo. The speed sender sends pulses that
    I have to interpret ... so I havent looked at the pulses under a scope
    yet .. but .. I would think that it will be 12v switched very fast so
    I really doubt that the 7805 would work as a signal conditioner to
    the pic. your diagram is probably the ticket.

    thanks again
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day