Shop OBEX P1 Docs P2 Docs Learn Events
Any way to Add Additional in/out Pins to a BS2? — Parallax Forums

Any way to Add Additional in/out Pins to a BS2?

ArchiverArchiver Posts: 46,084
edited 2001-07-06 04:48 in General Discussion
I've got a BS2 based circuit that has grown as it has matured and I'd
like to squeeze a couple more pins out of it...I'm certain this is a
common desire (fantasy?).

This is for controlling 6 solenoids: a project that I've made some
scattered postings about in the past (btw, a fellow Stampgroup member
has graciously and generously offered to assist me with the circuit
design and has been mentoring me daily via e-mail for the past several
weeks on the Stamp and ALL related areas of electronic knowledge,
thanks Gerry!).

Essentially:
BS2 has 16 usable pins:
I've got 6 inputs (switches), 6 outputs (to SSRs), 2 'mode selection'
inputs (a three position rotary switch...hopefully will get 3 seperate
inputs out of 2 input pins with some code)...that leaves me with ONE
precious little pin left.

-I was thinking of including a 3-character, 7-section LED display (or
possibly an LCD).
-I also wanted to consider work on an external remote battery powered
motion sensor that would send a signal to turn off or disconnect the
BS2's output. I've got an X10 Firecracker and an X10 Hawkeye ll motion
detector (although I'm not certain the Hawkeye ll will work reliably
and within the defined parameters). I'm not certain how many pins this
latter addition would demand (nor am I at all clear as to how to
implement this and with what hardware).

Although my main focus is on driving the solenoids, the display and
remote sensor are considerations and I was condering what one does when
one hits the wall of pin limitations with the BS2 (other than scale
back one's ambitions...which of course is always an option)?

This is a timely moment to breech the question, as I'm just now
starting to dig my heels into the nitty gritty of the code writing
(good god!).

Thanks for any tips,
Cheers,
-Neal

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 14:03
    Hi Neal,

    There are several ways you can go:

    1) Use a shift register. Depending on how you do this, you can get lots of
    inputs or outputs (but usually not both).

    2) Use a coprocessor. Our PAK-III or PAK-IV chips give you 8 or 16 I/O from
    2 Stamp pins. These I/O can do most things the Stamp can do (like pulse
    input or pulse output) and you don't have to wait around while they complete
    their task (you do have to wait before sending a new task, though). Also,
    our math coprocessors (PAK-I, II, and IX) add floating point math and either
    8 or 16 general-purpose I/O pins. So for 2 pins you get floating point math
    and extra I/O.
    Start at http://www.al-williams.com/awce/pak3.htm

    3) Do something tricky. For example, if you only press 1 of your 6 switches
    at a time, you can make a "pushbutton potentiometer" and read all of them on
    1 pin with the RCTime command. You can find a BS1 example of this in the
    Stamp manual and a BS2 example in my book Microcontroller Projects with
    Basic Stamps. That would free up 5 more pins.
    http://www.al-williams.com/awce/sbook.htm

    4) Use a BS2P/40 which has more I/O.

    Hope that helps!

    Al Williams
    AWC
    * Control 8 servos at once: http://www.al-williams.com/awce/pak8.htm

    P.S. You can find many answers in our Stamp FAQ at
    http://www.al-williams.com/wd5gnr/stampfaq.htm
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 14:03
    Hi Neal,

    I assume the 6 solenoids are controlled by 6 stamp I/O pins.
    In that case you could consider a HC595 serial in / parallel out
    shiftregister.
    The solenoids would then be controlled from the HC595, that is controlled by
    the stamp using shiftout and occupying 3 I/O lines. This would free up 3 I/O
    lines, together with the free one you have, the 4 free I/O lines should be
    enough for a serial LED/LCD display and a X10 interface.

    Greetings peter


    Oorspronkelijk bericht
    Van: lovegasoline@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=W9KzXKda2QgCNKInK4FMD4wHkXjxY2oc6or0qyoePl1SR6Tk7NS5dt8I0wc6Bqc4dQRfNmhUN2ln6TOSDP1waQ]lovegasoline@y...[/url
    Verzonden: donderdag 5 juli 2001 13:20
    Aan: basicstamps@yahoogroups.com
    Onderwerp: [noparse][[/noparse]basicstamps] Any way to Add Additional in/out Pins to a BS2?

    I've got a BS2 based circuit that has grown as it has matured and I'd
    like to squeeze a couple more pins out of it...I'm certain this is a
    common desire (fantasy?).

    This is for controlling 6 solenoids: a project that I've made some
    scattered postings about in the past (btw, a fellow Stampgroup member
    has graciously and generously offered to assist me with the circuit
    design and has been mentoring me daily via e-mail for the past several
    weeks on the Stamp and ALL related areas of electronic knowledge,
    thanks Gerry!).

    Essentially:
    BS2 has 16 usable pins:
    I've got 6 inputs (switches), 6 outputs (to SSRs), 2 'mode selection'
    inputs (a three position rotary switch...hopefully will get 3 seperate
    inputs out of 2 input pins with some code)...that leaves me with ONE
    precious little pin left.

    -I was thinking of including a 3-character, 7-section LED display (or
    possibly an LCD).
    -I also wanted to consider work on an external remote battery powered
    motion sensor that would send a signal to turn off or disconnect the
    BS2's output. I've got an X10 Firecracker and an X10 Hawkeye ll motion
    detector (although I'm not certain the Hawkeye ll will work reliably
    and within the defined parameters). I'm not certain how many pins this
    latter addition would demand (nor am I at all clear as to how to
    implement this and with what hardware).

    Although my main focus is on driving the solenoids, the display and
    remote sensor are considerations and I was condering what one does when
    one hits the wall of pin limitations with the BS2 (other than scale
    back one's ambitions...which of course is always an option)?

    This is a timely moment to breech the question, as I'm just now
    starting to dig my heels into the nitty gritty of the code writing
    (good god!).

    Thanks for any tips,
    Cheers,
    -Neal





    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 15:50
    Hi Neil,

    One way that I've expanded the output capability of the BS2's
    is by using 8-bit latches configured by hanging them off of 8 pins of
    the BS2, but their "latch" command dedicated to another output pin.
    If you were to use two 74LS374's for example, with their input pins connected
    in parallel with each other, and to the 8 BS2 pins, you would need two extra
    BS2 pins for control of the latches. This technique would give you 16 outputs,
    while using up only 10 of the "precious" BS2 pins, leaving the other 6 BS'2
    open,
    for a total of 22 I/0. If you had momentary uses for the 8 bits coming from the
    BS'2, you could also use them and just not enable either of the two latches,
    thereby adding 8 more for a total of 30 Outputs. Please bear in mind that the
    74LS374's are not bi-directional and therefore cannot be used as inputs, but
    they're perfect for driving your solenoid drivers and 7-segment display.

    Hope this helps,

    Russ


    Original Message
    From: Peter Verkaik <peterverkaik@b...>
    To: <basicstamps@yahoogroups.com>
    Sent: Thursday, July 05, 2001 9:03 AM
    Subject: RE: [noparse][[/noparse]basicstamps] Any way to Add Additional in/out Pins to a BS2?


    | Hi Neal,
    |
    | I assume the 6 solenoids are controlled by 6 stamp I/O pins.
    | In that case you could consider a HC595 serial in / parallel out
    | shiftregister.
    | The solenoids would then be controlled from the HC595, that is controlled by
    | the stamp using shiftout and occupying 3 I/O lines. This would free up 3 I/O
    | lines, together with the free one you have, the 4 free I/O lines should be
    | enough for a serial LED/LCD display and a X10 interface.
    |
    | Greetings peter
    |
    |
    |
    Oorspronkelijk bericht
    | Van: lovegasoline@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=X463Brx51aA_x8IyOLUoS5tBLoKP2xEK_lZYV3pRI5-y20lcMs5nULFmmaZYDnXNXSUI4jMglHvMXOlF1Ek]lovegasoline@y...[/url
    | Verzonden: donderdag 5 juli 2001 13:20
    | Aan: basicstamps@yahoogroups.com
    | Onderwerp: [noparse][[/noparse]basicstamps] Any way to Add Additional in/out Pins to a BS2?
    |
    | I've got a BS2 based circuit that has grown as it has matured and I'd
    | like to squeeze a couple more pins out of it...I'm certain this is a
    | common desire (fantasy?).
    |
    | This is for controlling 6 solenoids: a project that I've made some
    | scattered postings about in the past (btw, a fellow Stampgroup member
    | has graciously and generously offered to assist me with the circuit
    | design and has been mentoring me daily via e-mail for the past several
    | weeks on the Stamp and ALL related areas of electronic knowledge,
    | thanks Gerry!).
    |
    | Essentially:
    | BS2 has 16 usable pins:
    | I've got 6 inputs (switches), 6 outputs (to SSRs), 2 'mode selection'
    | inputs (a three position rotary switch...hopefully will get 3 seperate
    | inputs out of 2 input pins with some code)...that leaves me with ONE
    | precious little pin left.
    |
    | -I was thinking of including a 3-character, 7-section LED display (or
    | possibly an LCD).
    | -I also wanted to consider work on an external remote battery powered
    | motion sensor that would send a signal to turn off or disconnect the
    | BS2's output. I've got an X10 Firecracker and an X10 Hawkeye ll motion
    | detector (although I'm not certain the Hawkeye ll will work reliably
    | and within the defined parameters). I'm not certain how many pins this
    | latter addition would demand (nor am I at all clear as to how to
    | implement this and with what hardware).
    |
    | Although my main focus is on driving the solenoids, the display and
    | remote sensor are considerations and I was condering what one does when
    | one hits the wall of pin limitations with the BS2 (other than scale
    | back one's ambitions...which of course is always an option)?
    |
    | This is a timely moment to breech the question, as I'm just now
    | starting to dig my heels into the nitty gritty of the code writing
    | (good god!).
    |
    | Thanks for any tips,
    | Cheers,
    | -Neal
    |
    |
    |
    |
    |
    | To UNSUBSCRIBE, just send mail to:
    | basicstamps-unsubscribe@yahoogroups.com
    | from the same email address that you subscribed. Text in the Subject and
    | Body of the message will be ignored.
    |
    |
    | Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    |
    |
    |
    | To UNSUBSCRIBE, just send mail to:
    | basicstamps-unsubscribe@yahoogroups.com
    | from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    |
    |
    | Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    |
    |
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 15:52
    Hi Neil,

    One way that I've expanded the output capability of the BS2's
    is by using 8-bit latches configured by hanging them off of 8 pins of
    the BS2, but their "latch" command dedicated to another output pin.
    If you were to use two 74LS374's for example, with their input pins connected
    in parallel with each other, and to the 8 BS2 pins, you would need two extra
    BS2 pins for control of the latches. This technique would give you 16 outputs,
    while using up only 10 of the "precious" BS2 pins, leaving the other 6 BS'2
    open,
    for a total of 22 I/0. If you had momentary uses for the 8 bits coming from the
    BS'2, you could also use them and just not enable either of the two latches,
    thereby adding 8 more for a total of 30 Outputs. Please bear in mind that the
    74LS374's are not bi-directional and therefore cannot be used as inputs, but
    they're perfect for driving your solenoid drivers and 7-segment display.

    Hope this helps,

    Russ



    Original Message
    From: <lovegasoline@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Thursday, July 05, 2001 8:19 AM
    Subject: [noparse][[/noparse]basicstamps] Any way to Add Additional in/out Pins to a BS2?


    | I've got a BS2 based circuit that has grown as it has matured and I'd
    | like to squeeze a couple more pins out of it...I'm certain this is a
    | common desire (fantasy?).
    |
    | This is for controlling 6 solenoids: a project that I've made some
    | scattered postings about in the past (btw, a fellow Stampgroup member
    | has graciously and generously offered to assist me with the circuit
    | design and has been mentoring me daily via e-mail for the past several
    | weeks on the Stamp and ALL related areas of electronic knowledge,
    | thanks Gerry!).
    |
    | Essentially:
    | BS2 has 16 usable pins:
    | I've got 6 inputs (switches), 6 outputs (to SSRs), 2 'mode selection'
    | inputs (a three position rotary switch...hopefully will get 3 seperate
    | inputs out of 2 input pins with some code)...that leaves me with ONE
    | precious little pin left.
    |
    | -I was thinking of including a 3-character, 7-section LED display (or
    | possibly an LCD).
    | -I also wanted to consider work on an external remote battery powered
    | motion sensor that would send a signal to turn off or disconnect the
    | BS2's output. I've got an X10 Firecracker and an X10 Hawkeye ll motion
    | detector (although I'm not certain the Hawkeye ll will work reliably
    | and within the defined parameters). I'm not certain how many pins this
    | latter addition would demand (nor am I at all clear as to how to
    | implement this and with what hardware).
    |
    | Although my main focus is on driving the solenoids, the display and
    | remote sensor are considerations and I was condering what one does when
    | one hits the wall of pin limitations with the BS2 (other than scale
    | back one's ambitions...which of course is always an option)?
    |
    | This is a timely moment to breech the question, as I'm just now
    | starting to dig my heels into the nitty gritty of the code writing
    | (good god!).
    |
    | Thanks for any tips,
    | Cheers,
    | -Neal
    |
    |
    |
    |
    |
    | To UNSUBSCRIBE, just send mail to:
    | basicstamps-unsubscribe@yahoogroups.com
    | from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    |
    |
    | Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    |
    |
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 15:59
    The best thing I have found to expand inputs are 74hc165. I have 32 inputs
    while only using 3 lines from the stamp. You just cascade them together and
    read them in as two words. Then I can name each bit of a word and associate
    it with a certain switch.

    for outputs I use the 74hc595 using the same principal.
    Original
    Message
    From: <lovegasoline@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Thursday, July 05, 2001 7:19 AM
    Subject: [noparse][[/noparse]basicstamps] Any way to Add Additional in/out Pins to a BS2?


    > I've got a BS2 based circuit that has grown as it has matured and I'd
    > like to squeeze a couple more pins out of it...I'm certain this is a
    > common desire (fantasy?).
    >
    > This is for controlling 6 solenoids: a project that I've made some
    > scattered postings about in the past (btw, a fellow Stampgroup member
    > has graciously and generously offered to assist me with the circuit
    > design and has been mentoring me daily via e-mail for the past several
    > weeks on the Stamp and ALL related areas of electronic knowledge,
    > thanks Gerry!).
    >
    > Essentially:
    > BS2 has 16 usable pins:
    > I've got 6 inputs (switches), 6 outputs (to SSRs), 2 'mode selection'
    > inputs (a three position rotary switch...hopefully will get 3 seperate
    > inputs out of 2 input pins with some code)...that leaves me with ONE
    > precious little pin left.
    >
    > -I was thinking of including a 3-character, 7-section LED display (or
    > possibly an LCD).
    > -I also wanted to consider work on an external remote battery powered
    > motion sensor that would send a signal to turn off or disconnect the
    > BS2's output. I've got an X10 Firecracker and an X10 Hawkeye ll motion
    > detector (although I'm not certain the Hawkeye ll will work reliably
    > and within the defined parameters). I'm not certain how many pins this
    > latter addition would demand (nor am I at all clear as to how to
    > implement this and with what hardware).
    >
    > Although my main focus is on driving the solenoids, the display and
    > remote sensor are considerations and I was condering what one does when
    > one hits the wall of pin limitations with the BS2 (other than scale
    > back one's ambitions...which of course is always an option)?
    >
    > This is a timely moment to breech the question, as I'm just now
    > starting to dig my heels into the nitty gritty of the code writing
    > (good god!).
    >
    > Thanks for any tips,
    > Cheers,
    > -Neal
    >
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 17:24
    For lovegasoline@yahoo

    Good morning

    I have designed a circuit board - URIO Jr. - that has six SPDT relays with
    isolated Common and NO contacts. By jumpering all the C contacts together
    and tying to a supply voltage each relay can turn a solenoid on or off by
    taking the associated Stamp pin high or low. It also has a seventh relay, a
    DPDT with isolated C, NC and NO contacts which can be jumpered to your supply
    voltage. This relay was designed to supply 6 and 12VDC to external devices
    or to provide polarity reversal to devices that all use the same voltage. You
    might be able to use it for your "mode" control. If you ignored this relay,
    the board would require 6 pins from an external Stamp. The board requires a
    12volt power supply which would plug into a jack on the board.

    The schematic is in my head, which has no interface to my printer. I do,
    however, has the PC board layout, which is almost as good as a schematic. It
    is sort of proprietary at the moment since I am hoping for a commercial
    application. Nontheless, I guess I could share that with you if you think it
    would help. Since I am looking for help in other areas perhaps sharing with
    you will have its own reward.

    If you choose to respond to this e-mal please make the first line "For
    Newzed". That way I'll know yiou are talking to me.

    Regards
    Sid - W4EKQ
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 18:43
    Hi,

    In Projects i use I2C-Components for example Philips PCF8574 to
    (Remote 8-bit I/O-Expander for I2C-Bus)expand Basicstamp´s I/O-
    Capabilities. You can connect up to 8 PCF8574 on 2 Basicstamp I/O´s,
    so have 8 x 8 = 64 I/O´s.

    Datasheet you can find here:

    http://www.semiconductors.philips.com/acrobat/datasheets/PCF8574_2.pdf

    Here a testcode I´m running on my BS2SX using a serial 2x16 LCD. It
    also works on BS2.

    '{$STAMP BS2sx}

    i2data var byte 'byte for I2C I/O
    i2io var byte 'byte of I/O port 8574
    i2iop0 var i2io.bit0 'port 0 of 8574
    i2iop1 var i2io.bit1 'port 1 of 8574
    i2iop2 var i2io.bit2 'port 2 of 8574
    i2iop3 var i2io.bit3 'port 3 of 8574
    i2iop4 var i2io.bit4 'port 4 of 8574
    i2iop5 var i2io.bit5 'port 5 of 8574
    i2iop6 var i2io.bit6 'port 6 of 8574
    i2iop7 var i2io.bit7 'port 7 of 8574
    i2ack var bit 'I2C acknowledge bit
    t var byte
    dpin con 0
    N9600 con 16624
    I con 254
    CLR con 1
    i2dt con 1 'I2C data pin
    i2clk con 7 'I2C clock pin

    i2ioWR con %01000000 'I2C I/O write control byte
    i2ioRD con %01000001 'I2C I/O read control byte

    serout dpin,N9600,[noparse][[/noparse]I,CLR]

    pause 20 'give the system time to
    settle

    ' Test1 tests the PCF8574. Port 0 has a buzzer & port 2 an LED.
    ' Port 4 has a button. When you press the button down the LED and
    ' the buzzer turn on. When depress the button they turn off.
    low 8
    test1:
    i2io=%11111111 'init he PCF8574 alle I/O´s
    Eingänge
    gosub wrio
    chkio1:
    t=0
    gosub rdio
    'debug "1: ",ibin8 i2io,cr 'check for button
    if i2iop7=%1 then ND5
    t=5
    goto Taste:
    ND5:
    if i2iop6=%1 then ND4
    t=4
    goto Taste:
    ND4:
    if i2iop5=%1 then ND3
    t=3
    goto Taste:
    ND3:
    if i2iop4=%1 then ND2
    t=2
    goto Taste:
    ND2:
    if i2iop3=%1 then ND1
    t=1
    goto Taste:
    ND1:
    goto chkio1
    Taste:
    i2iop0=%0 'if press LED & buzzer on
    i2iop2=%0
    serout dpin,N9600,[noparse][[/noparse]I,128]
    serout dpin,N9600,[noparse][[/noparse]"Button",dec t," pressed"]
    debug ? t," Taste",cr
    pause 200
    i2io=%11111111
    gosub wrio

    i2iop7=%1
    i2iop6=%1
    i2iop5=%1
    i2iop4=%1
    i2iop3=%1
    gosub wrio

    chkio2: gosub rdio
    'debug "2: ",ibin8 i2io,cr 'if pressed continue
    if t=5 then t5
    if t=4 then t4
    if t=3 then t3
    if t=2 then t2
    if t=1 then t1
    goto taste1
    t5:
    if i2iop7=%0 then chkio2
    goto taste1
    t4:
    if i2iop6=%0 then chkio2
    goto taste1
    t3:
    if i2iop5=%0 then chkio2
    goto taste1
    t2:
    if i2iop4=%0 then chkio2
    goto taste1
    t1:
    if i2iop3=%0 then chkio2

    Taste1:
    serout dpin,N9600,[noparse][[/noparse]I,128]
    serout dpin,N9600,[noparse][[/noparse]REP " "\16]
    i2iop0=%1 'if not turn off LED & buzzer
    i2iop2=%1
    pause 200
    i2io=%11111111
    gosub wrio
    i2iop7=%1 'reset the button port
    i2io=%11111111
    goto chkio1 'goto check for button


    goto test1

    '* I2C Routines begin here *

    '* (wrio) I2C I/O 8574 write *
    'Before you call wrio
    'load i2io or i2iop0-i2iop7

    wrio:
    'debug "WRIO",cr
    gosub i2start 'send start condition
    i2data=i2ioWR 'send wr command
    gosub i2tx
    gosub ackrx
    i2data=i2io 'send byte
    gosub i2tx
    gosub ackrx
    gosub i2stop 'send stop condition
    return

    '* (rdio) I2C I/O 8574 read *
    'Returns i2io (I/O status byte)

    rdio:
    'debug "RDIO",cr
    gosub i2start 'send start condition
    i2data=i2ioRD 'send rd command
    gosub i2tx
    gosub ackrx
    gosub i2rx
    i2io=i2data 'get data
    gosub i2stop 'send stop condition
    return


    '* (i2start) I2C start contition *

    i2start:
    'debug "I2C Start",cr
    high i2dt 'I2C data line high
    high i2clk 'I2C clock line high
    low i2dt 'I2C data line low
    return


    '* (i2stop) I2C stop contition *

    i2stop:
    'debug "I2C Stop",cr
    low i2dt 'I2C data line low
    high i2clk 'I2C clock line high
    high i2dt 'I2C data line high
    return


    '* (i2tx & i2rx) I2C byte tensmit & receive *

    i2tx: shiftout i2dt,i2clk,1,[noparse][[/noparse]i2data] 'shift out byte to I2C
    'debug "3 OUT : ",ibin8 i2data,cr
    return


    i2rx: shiftin i2dt,i2clk,0,[noparse][[/noparse]i2data] 'shift in byte from I2C
    'debug "4 IN : ",ibin8 i2data,cr
    return


    '* (acktx & ackrx) I2C acknowledge transmit & receive *

    acktx:
    'debug "Send ACK",cr
    shiftout i2dt,i2clk,1,[noparse][[/noparse]%0\1] 'send acknowledge to I2C
    return

    ackrx:
    'debug "Receive ACK",cr
    shiftin i2dt,i2clk,0,[noparse][[/noparse]i2ack\1] 'receive acknowledge from I2C
    'debug ? i2ack,cr
    return

    end
    Best Greetings
    Wolfgang
    Vienna/Austria

    --- In basicstamps@y..., lovegasoline@y... wrote:
    > I've got a BS2 based circuit that has grown as it has matured and
    I'd
    > like to squeeze a couple more pins out of it...I'm certain this is
    a
    > common desire (fantasy?).
    >
    > This is for controlling 6 solenoids: a project that I've made some
    > scattered postings about in the past (btw, a fellow Stampgroup
    member
    > has graciously and generously offered to assist me with the circuit
    > design and has been mentoring me daily via e-mail for the past
    several
    > weeks on the Stamp and ALL related areas of electronic knowledge,
    > thanks Gerry!).
    >
    > Essentially:
    > BS2 has 16 usable pins:
    > I've got 6 inputs (switches), 6 outputs (to SSRs), 2 'mode
    selection'
    > inputs (a three position rotary switch...hopefully will get 3
    seperate
    > inputs out of 2 input pins with some code)...that leaves me with
    ONE
    > precious little pin left.
    >
    > -I was thinking of including a 3-character, 7-section LED display
    (or
    > possibly an LCD).
    > -I also wanted to consider work on an external remote battery
    powered
    > motion sensor that would send a signal to turn off or disconnect
    the
    > BS2's output. I've got an X10 Firecracker and an X10 Hawkeye ll
    motion
    > detector (although I'm not certain the Hawkeye ll will work
    reliably
    > and within the defined parameters). I'm not certain how many pins
    this
    > latter addition would demand (nor am I at all clear as to how to
    > implement this and with what hardware).
    >
    > Although my main focus is on driving the solenoids, the display and
    > remote sensor are considerations and I was condering what one does
    when
    > one hits the wall of pin limitations with the BS2 (other than scale
    > back one's ambitions...which of course is always an option)?
    >
    > This is a timely moment to breech the question, as I'm just now
    > starting to dig my heels into the nitty gritty of the code writing
    > (good god!).
    >
    > Thanks for any tips,
    > Cheers,
    > -Neal
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 22:41
    --- In basicstamps@y..., "Peter Verkaik" <peterverkaik@b...> wrote:

    > I assume the 6 solenoids are controlled by 6 stamp I/O pins.

    Hi ya Peter,

    Correct.
    6 Solenoids controlled by 6 SSR inputs; the 6 SSR inputs controlled by
    6 BS2 output pins.
    Also, 6 toggle switches control these 6 respective BS2 output pins.
    I should add that the circuit needs to have the capacity for all 6
    switch inputs to be controlled simultaeniously [noparse][[/noparse]sic?].

    > In that case you could consider a HC595 serial in / parallel out
    > shiftregister.

    What's a "HC595"? Is this a hardware item or code protocol?
    Please elaborate.

    Thanks.
    Cheers,
    -Neal
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 23:06
    --- In basicstamps@y..., "Russ Bassani" <RussBassani@a...> wrote:

    >
    > One way that I've expanded the output capability of the BS2's
    > is by using 8-bit latches configured by hanging them off of 8 pins of
    > the BS2, but their "latch" command dedicated to another output pin.
    > If you were to use two 74LS374's for example, with their input pins connected
    > in parallel with each other, and to the 8 BS2 pins, you would need two extra
    > BS2 pins for control of the latches.


    Please bear in mind that the
    > 74LS374's are not bi-directional and therefore cannot be used as inputs, but
    > they're perfect for driving your solenoid drivers and 7-segment display.

    Hi ya Russ,
    Can we back up for just a moment?
    Forgive my lack of sophisitication, but this is my first Stamp Project,
    and I'm a novice with electronics in general.

    I'd like to understand your ideas better and would appreciate some
    assistance in the definition of terms used:

    a)"8-bit latches". What's a latch?

    b)"74LS374's are not bi-directional". What's a 74LS374?

    Thanks a bunch.
    Cheers,
    -Neal

    |
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 23:07
    From: <lovegasoline@y...>
    > > In that case you could consider a HC595 serial in / parallel out
    > > shiftregister.
    >
    > What's a "HC595"? Is this a hardware item or code protocol?
    > Please elaborate.

    Generic name = SN74HC595 or SN54HC595
    http://focus.ti.com/docs/prod/productfolder.jhtml?genericPartNumber=SN74HC59
    5
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 23:20
    --- In basicstamps@y..., "Ricky Konvicka" <ricky@m...> wrote:
    > The best thing I have found to expand inputs are 74hc165. I have 32 inputs
    > while only using 3 lines from the stamp. You just cascade them together and
    > read them in as two words. Then I can name each bit of a word and associate
    > it with a certain switch.
    >
    > for outputs I use the 74hc595 using the same principal.


    Hi ya Ricky,
    Thanks for the advice.
    Im just a baby in regard to electronics in general and Stamps in
    particular. Would you (or someone) mind explaining what a "74hc165" is?

    Thanks.
    Cheers,
    -Neal
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 23:37
    http://www-s.ti.com/sc/psheets/scls116c/scls116c.pdf
    Here, read this - it's much more fun that way. It also takes about ten
    seconds to look these parts up.

    >
    Original Message
    > From: lovegasoline@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=QyNK83cmYA6K3uym38HgWswCEy17UDy2MRkdU_iZxIbWz92-UjAf_cg59B1VFJABf-VW1eni3CLmsQ9lU7W5Cw]lovegasoline@y...[/url
    > Sent: Thursday, July 05, 2001 6:20 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Re: Any way to Add Additional in/out Pins to a
    > BS2?
    >
    >
    > --- In basicstamps@y..., "Ricky Konvicka" <ricky@m...> wrote:
    > > The best thing I have found to expand inputs are 74hc165.
    > I have 32 inputs
    > > while only using 3 lines from the stamp. You just cascade
    > them together and
    > > read them in as two words. Then I can name each bit of a
    > word and associate
    > > it with a certain switch.
    > >
    > > for outputs I use the 74hc595 using the same principal.
    >
    >
    > Hi ya Ricky,
    > Thanks for the advice.
    > Im just a baby in regard to electronics in general and Stamps in
    > particular. Would you (or someone) mind explaining what a
    > "74hc165" is?
    >
    > Thanks.
    > Cheers,
    > -Neal
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-05 23:43
    Hi Neal,

    >6 Solenoids controlled by 6 SSR inputs; the 6 SSR inputs controlled by
    >6 BS2 output pins.
    >Also, 6 toggle switches control these 6 respective BS2 output pins.

    So have 6 stamp I/O set as outputs for the SSR, and 6 stamp I/O set as
    inputs for the switches

    >I should add that the circuit needs to have the capacity for all 6
    >switch inputs to be controlled simultaeniously [noparse][[/noparse]sic?].

    Inputs can not be controlled, but they can be read and I assume this is what
    you mean.
    If you keep all the switch inputs to either side of the stamp you can read
    them simultaneously using INL or INH.

    >What's a "HC595"? Is this a hardware item or code protocol?
    >Please elaborate.

    The 74HC595 is a 16 pin chip that gives you 8 digital outputs using only 3
    stamp I/O lines to set its outputs high or low.
    The PCF8574 option mentioned by Wolfgang is also a possibility. Using two
    PCF8574 you get 16 I/O lines that can
    be individually set to be input (for your switches) or output (for your SSR)
    using only two stamp I/O lines. This gives you 10
    free stamp I/O lines. Note however that the HC595 can drive a load while its
    outputs are set high, the PCF8574 can not drive
    any load in its high output state, it can sink 25mA in its low output state
    though. BTW: the PCF8574 is also a 16 pin chip.

    Greetings peter
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-06 00:59
    Hi ya Peter,

    > So have 6 stamp I/O set as outputs for the SSR, and 6 stamp I/O set as
    > inputs for the switches

    Correct, that is the present setup.

    > >I should add that the circuit needs to have the capacity for all 6
    > >switch inputs to be controlled simultaeniously [noparse][[/noparse]sic?].
    >
    > Inputs can not be controlled, but they can be read and I assume this is what
    you mean.

    Correct. When I said simultaneously, perhaps that was the wrong term to
    use. The solenoids are driven sequentially, each for an approx. 70ms
    pulse.

    > The 74HC595 is a 16 pin chip that gives you 8 digital outputs using only 3
    stamp I/O lines to set its outputs high or low.
    > The PCF8574 option mentioned by Wolfgang is also a possibility. Using >two
    PCF8574 you get 16 I/O lines that can be individually set to be >>>input (for
    your switches) or output (for your SSR) using only two >>>stamp I/O lines. This
    gives you 10 free stamp I/O lines. Note however
    >that the HC595 can drive a load while its outputs are set high, the >>>PCF8574
    can not drive any load in its high output state, it can sink >>25mA in its low
    output state though.

    Hhmm. I'm using two Crydom SSR relays, a dual and a quad.
    The dual SSR uses a high state to turn the relay on, it's connector has
    a common (-) terminal; the quad uses a low state to turn the relay
    inputs on...it's connector has a common (+) terminal.

    "Note however that the HC595 can drive a load while its outputs are set
    high"

    Can the HC595 outputs be individually programed, some driving a load
    while its outputs are high, others driving a load while its outputs are
    low, in order to accomodate the input demands of the two different
    SSRs?

    Thanks.
    Cheers,
    -Neal
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-06 01:26
    Hi Neal,

    Did you check the serial LCD+?

    >Hhmm. I'm using two Crydom SSR relays, a dual and a quad.
    >The dual SSR uses a high state to turn the relay on, it's connector has
    >a common (-) terminal; the quad uses a low state to turn the relay
    >inputs on...it's connector has a common (+) terminal.

    >"Note however that the HC595 can drive a load while its outputs are set
    >high"

    >Can the HC595 outputs be individually programed, some driving a load
    >.while its outputs are high, others driving a load while its outputs are
    >low, in order to accomodate the input demands of the two different
    >SSRs?

    If you connect a load between GND and an output, then when the
    output is set high it can source current into the load. -> your load dual
    SSR
    If you connect a load between +5V and an output, then when the
    output is set low it can sink current into the load. -> your load quad SSR

    If you were to decide to use the serial LCD+ open collector outputs to drive
    your SSR
    you should get yourself another quad SSR because the open collector outputs
    can only sink current.

    Greetings peter
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-06 04:48
    Neal,

    The PAK chips Al Williams mentioned are the absolute EASIEST and fastest way
    to add I/O to a BASIC Stamp and I HIGHLY recommend them. I use a PAK-IV
    with every BS2 and BS2SX I own. Everything you'll need is included
    including the code. I just doesn't get any better than this.

    - Brice

    Educational & Personal Robots
    http://www.cyberbound.com

    Original Message
    From: Al Williams <alw@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Thursday, July 05, 2001 8:03 AM
    Subject: RE: [noparse][[/noparse]basicstamps] Any way to Add Additional in/out Pins to a BS2?


    Hi Neal,

    There are several ways you can go:

    1) Use a shift register. Depending on how you do this, you can get lots of
    inputs or outputs (but usually not both).

    2) Use a coprocessor. Our PAK-III or PAK-IV chips give you 8 or 16 I/O from
    2 Stamp pins. These I/O can do most things the Stamp can do (like pulse
    input or pulse output) and you don't have to wait around while they complete
    their task (you do have to wait before sending a new task, though). Also,
    our math coprocessors (PAK-I, II, and IX) add floating point math and either
    8 or 16 general-purpose I/O pins. So for 2 pins you get floating point math
    and extra I/O.
    Start at http://www.al-williams.com/awce/pak3.htm

    3) Do something tricky. For example, if you only press 1 of your 6 switches
    at a time, you can make a "pushbutton potentiometer" and read all of them on
    1 pin with the RCTime command. You can find a BS1 example of this in the
    Stamp manual and a BS2 example in my book Microcontroller Projects with
    Basic Stamps. That would free up 5 more pins.
    http://www.al-williams.com/awce/sbook.htm

    4) Use a BS2P/40 which has more I/O.

    Hope that helps!

    Al Williams
    AWC
    * Control 8 servos at once: http://www.al-williams.com/awce/pak8.htm

    P.S. You can find many answers in our Stamp FAQ at
    http://www.al-williams.com/wd5gnr/stampfaq.htm


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.