Input/Output Design For A Prop-1 Program

This page is dedicated to figuring out how our controller program communicates with the outside world.

We will:

skip list of on-page links

The Prop-1 Side

The Prop-1 controller (and the Basic Stamp 1 from which it was derived) communicates with the outside world through a set of eight wires ("pins"), marked on the board as P0 through P7. Any of these wires can be set up to serve as an
input or output. By convention, P0-P5 are used for output and P6-P7 are used for input. Parallax even modified P6-P7 to make it easier to do input with them, and P0-P7 to make it easy to do output - but exactly how these pins are used is your choice. Thus any of the eight pins can be used for any of the following:

If you need more buffered outputs than you have available, you can use a Parallax DC-16 Output Expander to add more.

That's the Prop-1 side.

The Gadget Side

Now for the gadgets that the Prop-1 will talk to.

List The Gadgets

First, make a list of all the gadgets.

Inputs:

Outputs:

Get comfortable with this list. You will see it in several forms, depending on what part of the controller you are working on.

Gadgets that tell you something (input) and those that take commands (output) have very similar characteristics. The only difference is the direction that information is flowing.

For example, a PIR sensor sends information that indicated "a kid is here", and this information is sent from the PIR to the Prop-1. The thing that makes the monster pop up simply takes some information ("show the monster") and acts on it. Because outputs from the Prop-1 usually make things happen, we have a tendency to call them "commands", as in, "The Prop-1 sends a command to pop up the monster." But it is just a flow of information, like the input from the PIR to the Prop-1. In fact, you can leave out the Prop-1 entirely and hook the PIR straight up to the monster control (if the voltages and such are right).

Get The Details

Now find out everything you can about each gadget you are talking to. In particular, look for:

Where do you get this information? Read the manual! For example, we will be using the Parallax PIR Sensor. Included with it is an instruction sheet describing exactly how to hook up the PIR and how to use it. If you lost your copy, you can download it from the Parallax web site. Any other gadget that you plan to talk to should either come with specifications, or have them readily available for download. In some cases (e.g. solenoid valves), you might find sufficient technical information stamped on the body of the device itself.

Then fold that information into the list of inputs and outputs.

Inputs:

Outputs:

There is a lot of information in this list! A lot more than you strictly need to write the program. But somebody has to put the hardware together, and that person will need some of this information, too!

Hooking The Hardware Together

The guy who hooks up the hardware may be the same guy as the one who writes the controller program (you). Or they may be different people with different skills.

It is the job of this person to bridge the gap between the gadget signals and what the Prop-1 programmer sees. For example, the Prop-1 sees the "monster control" as a simple "pin" that can be in either of two states, 0 or 1. The solenoid valve that operates the monster expects a 24 volt signal. The Prop-1 has no command to "send 24 volts". It does have a command to "send a 1". We need to take that "logical 1" and turn it into a 24 volt signal to activate the solenoid valve.

So, how do we go about this?

Easy Stuff: 5-Volt Signals

We have one bit of good luck: much of the input and output takes place using low voltage signals between 0 and +5 volts. This is the natural I/O level used by the microcontroller chip inside the Prop-1. When the Prop-1 executes a command to "send a 1", it results in the chip outputting +5 volts. When the Prop-1 executes a command to "send a 0", it results in the chip outputting 0 volts. Any I/O gadget that communicates using this same system requires nothing in the way of fancy interfacing. Inputs can go straight to the low-voltage inputs. Outputs can go straight to the unbuffered low-voltage outputs (P0-P7).

Looking over the detailed list of inputs and outputs, we see that three of the gadgets communicate using the 5 volt level native to the Prop-1 chip. So we have no worries about the PIR, monster sound, and thunder sound.

Simple Buffered Output

Another bit of good fortune is that the Prop-1 is designed with buffered outputs that support higher voltages. If all of your outputs take the same voltage, and it is between 6 and 24 volts DC, you can hook them straight up to the buffered outputs (OUT0-OUT7).

The solenoid valve for the monster needs 24 volts and the lightning needs 12. This is a bit of a problem. Things would be easier is they both ran off of the same voltage. We could just hook them up to buffered outputs (OUT0-OUT7). Actually, the fact that the ULN2803 buffer chip also inverts the signal (it is a "sink" driver) allows us to drive mixed voltages.

A Bit Of A Pain

But the problem is that the lightning strobe requires a 12 volt signal that is positive with respect to ground. The ULN2803 just doesn't do that. [Those who have a lot of experience in this area may suggest pullup resistors or some such. That might work, depending on the actual input requirements of the strobe. Since the primary purpose of this page is education, I'll settle for a reliable but inelegant solution.] The easiest way to accommodate the strobe is to use a relay to turn the signal that we have into what we want. Since a variety of relays are available, we can pick one with a coil that matches our solenoid valve, and run them both off of the same voltage and buffered outputs.

So we'll feed the Prop-1 on 24 volts, drive the solenoid valve straight from the buffered output, and drive the strobe through a relay.

Final Hardware Summary

Now it's time to create a list for the hardware guy, that describes what gets hooked up where. In doing this, we have to decide which gadget hooks up to which of the eight "pins" on the Prop-1. We will also descrive the processing necessary to convert the gadget signal to the logical 0 and logical 1 that the Prop-1 uses.

Inputs:

Outputs:

Remember to use a 24 volt power supply for the Prop-1 for this exercise.

Now that we know what's connected to what, we can create a schematic diagram of the electronic bits, or a pictorial diagram. Sometimes pictures work better than words in conveying this type of information.

What The Programmer Needs To Know

Let's construct another version of the list. This one will be the "programmer's model" of how the input and output works.

This one is based on the Final Hardware Summary, but after removing tedious details about voltages and stuff. After all, the goal here is to show what the programmer deal with.

Inputs:

Outputs:

Related Pages

Skip this list.
Our series on programming controllers:
privacy policy | write to us | tip us
©Copyright 2006 by The Wolfstone Group. All rights reserved.
You must read and abide by our terms of service.