Shop OBEX P1 Docs P2 Docs Learn Events
BS2, a pin as input and output — Parallax Forums

BS2, a pin as input and output

ArchiverArchiver Posts: 46,084
edited 2003-12-11 14:24 in General Discussion
I'm out of pins in my (now infamous) Alarm Clock project, and I'd like to
wedge in one more input pin. So now it's time to resort to a trick. Will
this work? My concern is damaging the BS2.

I have an output pin that goes through a 1k resistor, to an input on a
ULN2003A (Darlington pair base). The Darlington's output is a speaker, and
the output pin is used for occasional FREQOUT purposes. (The 1k resistor
reflects my obsessive fear of hurting pins - the darlington already has a
built in 2.2k resistor).

Periodically, I'd like to redeclare this BS2 pin as an input, and test it.
I'm assuming that base-emitter current from the darlington (through 1k
resistor) would make the pin appear low, without damaging the BS2. Now
assume +5v is applied, through a separate 1K resistor, to that same BS2 pin.
This would presumably drive the pin high (and also turn the darlington on,
but that will just make the speaker click and would be harmless.)

It's certainly possible that the +5v could be applied to the pin while it is
in an output state, during a FREQOUT or otherwise. This means an output pin
is connected through 1k to +5v. The output might be low or high (during a
FREQOUT). Any harm in that?

+
1K
switch
+5v
|
|
BS2 pin (sometimes in, sometimes out)
|
+
1K
darlington input

Comments welcome.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-12-11 05:55
    Why don't you try using a multiplexer/demultiplexer, 1 to 8 type. It
    works like selector switches and work in both direction. You just need
    3 pins for addressing. If you use the 1 to 16 type you need 4 pins for
    addressing. In this case you need to redesign your circuit a bit to
    free 3 or 4 pins but in the end you get more pins.

    - Johari

    --- In basicstamps@yahoogroups.com, "Scott" <scott@m...> wrote:
    > I'm out of pins in my (now infamous) Alarm Clock project, and I'd
    like to
    > wedge in one more input pin. So now it's time to resort to a trick. Will
    > this work? My concern is damaging the BS2.
    >
    > I have an output pin that goes through a 1k resistor, to an input on a
    > ULN2003A (Darlington pair base). The Darlington's output is a
    speaker, and
    > the output pin is used for occasional FREQOUT purposes. (The 1k resistor
    > reflects my obsessive fear of hurting pins - the darlington already
    has a
    > built in 2.2k resistor).
    >
    > Periodically, I'd like to redeclare this BS2 pin as an input, and
    test it.
    > I'm assuming that base-emitter current from the darlington (through 1k
    > resistor) would make the pin appear low, without damaging the BS2. Now
    > assume +5v is applied, through a separate 1K resistor, to that same
    BS2 pin.
    > This would presumably drive the pin high (and also turn the
    darlington on,
    > but that will just make the speaker click and would be harmless.)
    >
    > It's certainly possible that the +5v could be applied to the pin
    while it is
    > in an output state, during a FREQOUT or otherwise. This means an
    output pin
    > is connected through 1k to +5v. The output might be low or high
    (during a
    > FREQOUT). Any harm in that?
    >
    > +
    1K
    switch
    +5v
    > |
    > |
    BS2 pin (sometimes in, sometimes out)
    > |
    > +
    1K
    darlington input
    >
    > Comments welcome.
  • ArchiverArchiver Posts: 46,084
    edited 2003-12-11 14:24
    It can and has been done.
    However, in your case the input would be marginal, the output resistor should be
    at least 5 to 10 times the value of the input
    resistor.
    If the input and output resistors are of the same value the input would see
    2.5v.(which should be enough for the stamp, but is a bit
    low for a logic high in general)
    If you made the input resistor 330 ohms and/or increased the value of your
    output resistor you should be ok.

    - KF4HAZ -

    From: "Scott" <scott@m

    > I'm out of pins in my (now infamous) Alarm Clock project, and I'd like to
    > wedge in one more input pin. So now it's time to resort to a trick. Will
    > this work? My concern is damaging the BS2.
    >
    > I have an output pin that goes through a 1k resistor, to an input on a
    > ULN2003A (Darlington pair base). The Darlington's output is a speaker, and
    > the output pin is used for occasional FREQOUT purposes. (The 1k resistor
    > reflects my obsessive fear of hurting pins - the darlington already has a
    > built in 2.2k resistor).
    >
    > Periodically, I'd like to redeclare this BS2 pin as an input, and test it.
    > I'm assuming that base-emitter current from the darlington (through 1k
    > resistor) would make the pin appear low, without damaging the BS2. Now
    > assume +5v is applied, through a separate 1K resistor, to that same BS2 pin.
    > This would presumably drive the pin high (and also turn the darlington on,
    > but that will just make the speaker click and would be harmless.)
    >
    > It's certainly possible that the +5v could be applied to the pin while it is
    > in an output state, during a FREQOUT or otherwise. This means an output pin
    > is connected through 1k to +5v. The output might be low or high (during a
    > FREQOUT). Any harm in that?
    >
    > +
    1K
    switch
    +5v
    > |
    > |
    BS2 pin (sometimes in, sometimes out)
    > |
    > +
    1K
    darlington input
    >
    > Comments welcome.
Sign In or Register to comment.