Shop OBEX P1 Docs P2 Docs Learn Events
Compact IO Expansion — Parallax Forums

Compact IO Expansion

G McMurryG McMurry Posts: 134
edited 2009-04-03 23:39 in BASIC Stamp
Hi,

I am new to this board, but not new to STAMP Projects.

My basic use of the Basic Stamp has been to control my model railroad. I have been using distributed STAMP processing on my large O-Gauge Layout for many years.

I am currently building an actual model train that I can ride. The locomotive is powered by an 18HP Gas over Electric system and I want to build a BS2 control system for it.

I have used the 74HC595 / 74HC164 combination for expanding input / output on my Stamp modules before and it works pretty well. Recently, I noticed the DC-16 IO expansion board. I am wondering if the control chip on that device or something similar is available out there.

I want to get at least 8 input and 8 output lines using the smallest PCB footprint and the least number of Stamp IO pins.

I would also enjoy exchanging ideas with anyone else using the STAMP for model railroad control.

THANKS!

Greg

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
AUTOMATE EVERYTHING
http://www.trainyard.net

Post Edited (G McMurry) : 3/19/2009 2:46:20 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-19 15:03
    The DC-16 uses a custom programmed SX microcontroller.

    There are several I2C I/O Expander chips available with 8 or 16 I/O pins. These need only two Stamp I/O pins. They're convenient to use with the Stamp models that have the I2CIN and I2COUT statements (the BS2p models). You can have up to 8 of them on a pair of I/O pins (0/1 or 8/9). The PCA9554 is 8 bits and the PCA9555 is 16 bits.
  • G McMurryG McMurry Posts: 134
    edited 2009-03-19 20:56
    That sounds perfect. I think I'll get a couple of the 16 bit versions. Why use 8 when you can have 16?

    Thanks!

    Greg

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    AUTOMATE EVERYTHING
    http://www.trainyard.net
  • FearTurtlesFearTurtles Posts: 89
    edited 2009-03-19 22:12
    Like your website, Greg. I would love to hear your progress.
  • G McMurryG McMurry Posts: 134
    edited 2009-03-25 14:22
    I have been plowing my way around interface examples using the PCA555 16bit GPIO. There are some here for the Propeller.

    My forte is mechanical and electronic, not software. I have done pretty well with most of my apps using the Basic Stamp interpreter so far. The examples in the Stampworks manual have gotten me through just about everything I have done.

    Using i2c with this chip is going to be a challenge for me. Can anyone point me to some examples of using i2c to talk to these devices in Stamp Basic?

    Greg

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    AUTOMATE EVERYTHING
    http://www.trainyard.net

    Post Edited (G McMurry) : 3/25/2009 2:29:35 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-25 15:22
    There are several Nuts and Volts Columns that discuss I2C. It's easier to use if you have a BS2p/pe/px Stamp with the built-in I2C statements, but one of the columns discusses using I2C with just a BS2 and provides source code for the subroutines needed for the I2C control. Go to the main Parallax webpage and click on the Resources tab and you'll see a link to the Nuts and Volts Columns index. I think one of the columns is #85, but you'll need to browse.
  • Professor ChaosProfessor Chaos Posts: 36
    edited 2009-03-25 17:31
    You might also check out the Microchip expanders like the MCP23017. They come in I2C and SPI (synchronous serial) versions and may have a little more flexibility.

    I have a microcontroller-based system for my O-gauge pike that provides complete automatic control of multiple trains on the layout. Trains are identified by RFID and stopped/started/routed based on signals from conventional insulated rail sensors. The microcontroller also controls track signals showing the occupancy state of each block. Some day I will develop a web or touch-screen interface to allow for interactive display and control, but that is a little beyond my skills right now.

    I started off using a Stamp and it was a great platform for learning about microcontrollers, but the system soon exceeded the Stamp's capabilities. So I turned to another microcontroller that offers BASIC programmability but has more speed, memory, serial ports, interrupts, etc.
  • Andy FoxAndy Fox Posts: 46
    edited 2009-04-03 18:02
    Another small (but more expensive) alternative is the PAK-III or PAK-IV I/O co-processor which use a SPI interface:

    www.awce.com/pak3.htm

    I haven't used these myself but they look fun! They give you the ability to do almost everything you could do with the bs2's own I/O pins (HIGH, LOW, RCTIME, PULSIN/OUT, etc). Maybe a little over-kill for what you need, but it's an idea.

    Another idea is to use one 74HC299 Serial<->parallel shift register in place of your 74HC595 and 74HC164. All of the 8 I/O lines have to all be input or output though--can't mix.
  • UghaUgha Posts: 543
    edited 2009-04-03 23:39
    You could also have a friend program an SX for you... or you could buy an SX cheap from a member of the forums.
    This would let you select what options you'd want and keep the cost very low.

    An SX could do everything the overpriced Pak3 can do plus a bit more so it might be a good route to go.

    I'd be willing to make one up custom if you'd like. PM me if interested.
Sign In or Register to comment.