Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp I/O Controller Board — Parallax Forums

Basic Stamp I/O Controller Board

W2ECW2EC Posts: 4
edited 2009-09-07 16:25 in BASIC Stamp
I have one of these boards but am unable to get it to function as an input device. I can program it and perform output operations to turn on relays etc thru the on-board ULN2803, but the ULN2803 is a darlington pair, for output only. It appears you cannot read that port as an input, say to check a switch position. So how can this function as an I/O controller, seems like it is only an O controller. I've tried tying the input switches to the input port side of the ULN2803, but that pin always reads low, regardless of the fact that I have the pin tied high thru a 10 k resistor.

I've tried to attach a schematic of a simple circuit and code that doesn't work. The code keeps sensing the input switch as low, regardless of the switch position. This means the code keeps looping thru turning the relay on and off, rather than just activating the relay if the switch is pressed.

Anybody use one of these for I/O? If so, how?

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-09-04 19:17
    ·No question, the uln2803 is a transistor chip made for driving higher current loads.

    ·· Typically, half of the Stamp would be used to drive the uln2803 as outputs and the remaining stamp pins are used as inputs. (with or without pull-ups, depending on the application)

    ·· I've attached the schematic of the board I use in most of my projects.

    · Cheers,



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-09-04 20:16
    Hello,

    Not sure why things aren’t working for you…if you have a Stamp Controller Interface board (#27945) then you can get bi-directional data, including input from it. The schematic you posted is not an accurate representation of our board. You can get the schematic to our board from the product page on our website.

    The Stamp CI board has 10K resistors in series with the input/outputs of the ULN chip on it. Since the ULN chip has an open collector output and the inputs have pull-down resistors the concept here is that you could set the BASIC Stamp pins to input and read the state of the pin normally. Here’s why…when the BASIC Stamp I/O is set to input the internal pull-down on the ULN causes the outputs to become open-collector…now, a high signal (5V) on that output will feed back through the 10K resistor and form a voltage divider at ½ VDD (~2.5V), however this is enough for the BASIC Stamp I/O pin threshold to see a HIGH on the pin.

    You might be inclined to think that the HIGH signal going back to the input of the ULN would cause the ULN output to go LOW, but if you look at the datasheet it should work. Now, if you’re pulling up using a 10K resistor then your series resistance is now 20K on the top of the divider and may be insufficient for the BASIC Stamp to see a HIGH. Try just putting 5V into the input and be sure that the I/O pin is set for input first. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • W2ECW2EC Posts: 4
    edited 2009-09-04 23:50
    stamptrol, ·Thanks, yes, your schematic is very similar to what I am attempting. Basically a pullup resistor (your RN2) tying pin 0 up (but not thru an LED). My switch should bring pin 0 to ground (like your opto isolator logic) to indicate pin 0 input is low. However, regardless of the position of my switch, pin 0 reads low (I scoped it, it is .6vdc or 0vdc depending on switch position.) Obviously .6vdc is not high enough to indicate a high condition to the pin 0 input. Even though you are using pins 0 thru 7 for input and pins 8 thru 15 for output (thru the ULN2803), all basic stamp pins 0 thru 15 are connected to the onboard ULN2803's, pins 0 thru 7 to one and pins 8 thru 15 to the other. So I'm trying to figure out why my pin 0 reads .6vdc rather than the 5vdc I would expect thru my 10k pullup resistor. What are the values of RN1 and RN2 in your schematic? Do you have the output pins of the UN2803 for pins 0 thru 7 tied to anything or are they floating?

    Chris, yes, I have the board schematic from the web site and I realize my schematic is not an exact representation of the·controller board, I tried to simplify it by combining the two ULN2803's into one for ease of reading the example. And I do not show the 3.3k resistors across the ULN2803 input/output. ·Maybe there is another schematic I'm missing as the one I got from the web does not show 10k resistors in series with the I/O pins. My schematic shows 3.3k resistors across (in parallel?) with the I/O pins. There is an internal 2.7k resistor inside the ULN2803 to the base of the transistor. Where are these 10k series resistors located on the board? Looking at ULN2803 spec sheets I don't·see internal pullup resistors.

    Are you saying that instead of using my 10k resistors, I should just apply 5vdc to the output pin of the ULN2803, which will feed thru the parallel 3.3K resistor, causing the input side of the pin to read high? Then I would just tie my switch to the input pin and when I close it, it will bring the pin low dropping the load thru the 3.3k resistor?

    Appreciate any help!
  • Alan BradfordAlan Bradford Posts: 172
    edited 2009-09-04 23:53
    Hi,
    The 2803 is an output chip.
    The chip in your drawing is something else.
    The 2803 pin 9 is the power common and pin 10 goes to the high side voltage you are running your Output items on.
    I have added a link to the data sheet.
    http://www.st.com/stonline/products/literature/ds/1536/uln2805a.pdf
    I also use 100k pull up resistors on each Stamp pin to +5.
    For inputs I also use 100k pull up resistors and have the switches ground the Input pin.
    If your input voltage is a different level then an opto isolator will work.
    What are you trying to do?
    This will make it easier to help you out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alan Bradford ·N1YMQ

    Plasma Technologies
    Canaan NH 03741
    www.plasmatechnologies.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-09-05 05:27
    W2EC,

    I believe the schematic to be in error…I referred to a module on my desk earlier and it appears the resistor packs are 10K, not 3.3K. This would make sense because if the resistors were 3.3K then a high on the output would be sufficient enough to pull up the input to the ULN causing its output to go low creating a short circuit. This would be bad. There are no pull-up resistors in the ULN, but rather pull-down (plus an inline series resistor to the base). This creates an effective voltage divider with the pass-through resistor when using the line as an input. Yes, you would apply your 5V signal to the output directly. Using a pull-up resistor would not be effective. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • W2ECW2EC Posts: 4
    edited 2009-09-05 12:13
    Hi Chris,

    Thanks, I'll give this a try.


    Hi Alan,
    ·
    I'm not creating my own board with my own ULN2803's, I am attempting to use the Parallax Stamp I/O Controller Interface (CI) board which already contains the ULN2803's tied to the onboard basic stamp on the PCB.

    The chip in my schematic isn't really a chip, it is more·of a block diagram of what I am trying to do. My single "block ULN2803" is really a combination of·two ULN2803's with pins 0 thru 7 of the stamp going to one ULN2803 and pins 8 thru 15 going to the second ULN2803 on the CI board. Although my final design is more complicated than this example schematic, the end result is the same. The actual design is a group of 8 switches input (on p0 thru p7) controlling relays on p8 thru p15. The stamp handles the logic to read the switches and determine a specific sequence for the relays to be activated. Also not shown in the block diagram is that·each·input and corresponding output pin of the ULN2803 are tied together with a 10k resistor on this CI board.
    ·
    My example simply shows one switch input and one relay output, just so I can determine how to read the switch. The example·shown here doesn't work. What I believe Chris is telling me is that I don't tie the input pins up with a 10k resistor, but instead apply Vdd (5vdc) directly to the output pin (of pin 0 in my example) which will pass thru the 10k resistor connected between pin 0's input and output pins. This will·be my "pullup" for my input. Then I can toggle pin 0 with my switch and sense the correct logic level. Hope this makes more sense.

    If I had built this from scratch, I would have used only one ULN2803 for output on stamp pins p8 thru p15, and used the normal pullup resistors for the switches on pins 0 thru 7 which would not have been tied to a second ULN2803, thus avoiding the problem I've been having.

    ·Paul
  • Alan BradfordAlan Bradford Posts: 172
    edited 2009-09-06 21:37
    Hi Paul,

    I just whipped up this print of how·I connect Switches and relays to a Basic Stamp
    The ULN2803 can switch 12 0r 24 volt relays up to .5 amps per coil.
    I·use 100k·pull-up resistors for the I's and O's. 10k work also but I have been using 100k and they use less of the +5 volt Power supply (If that is important).

    Good Luck.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alan Bradford ·N1YMQ

    Plasma Technologies
    Canaan NH 03741
    www.plasmatechnologies.com
  • W2ECW2EC Posts: 4
    edited 2009-09-07 15:12
    Hi Alan,

    I guess I'm explaining my problem wrong. I understand your schematic and of course that is the way I would do it if I were developing my circuit with discrete components, my own stamp, uln2803, etc.

    My problem is I have purchased a Parallax Stamp·Controller Interface Board part # 27945 (CI). It was my understanding that this was an I/O controller board that already contains two ULN2803's. These two ULN2803's are·hardwired via pcb traces on the CI to the i/o pins of the stamp. The schematic I have attached shows the two ULN2803's attached to the stamp,·each input/output pin is shunted with a 10k resistor. The outputs of the·ULN2803 go to a connector, again a physical part of the CI board, where I can·expected to be able to connect all my I/O devices. However, being ULN2803's, it appears I can only attach output devices to this connector.

    My initial question was to see if there was anyone already using this CI board for both input and output and if so, how did they use·the·CI board·for sensing·input switches in addition to·triggering output devices thru the ULN2803's.

    The problem I had was that when I set up my circuit such as you show in your schematic, with the pullup resistors·and switch connected directly to the stamp I/O pins rather than thru the ULN2803, the circuit didn't work. Apparently this is because·the stamp I/O pins are also attached to the input of the ULN2803 which is somehow holding the stamp I/O pins always low. According to Chris Savage what I need to do is apply +5 volts to the output of the ULN2803 pin that I want to use for input,·then attach my switch to the input pin of the ULN2803. The shunt 10k rsistor will act as the pullup for the switch. This will allow me to sense the switch position·of the associated·pin of the stamp. However it means I have to solder my wire for the switch to the PCB rather than using the expected provided I/O port. There are seveal other connector I may be able to use to avoid soldering, I have to check further into that.

    Hope that clarifies what I'm trying to find out. Thanks for your suggestions.

    Paul
  • Alan BradfordAlan Bradford Posts: 172
    edited 2009-09-07 16:25
    Duhhh!
    Ok I am with the program now!
    I have not used one of thoes boards so I cant help much.
    I Thought you wanted to build something else based on that idea.
    Good Luck

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alan Bradford ·N1YMQ

    Plasma Technologies
    Canaan NH 03741
    www.plasmatechnologies.com
Sign In or Register to comment.