Connecting a Stamp to another Stamp Pin to Pin
Bill Chennault
Posts: 1,198
All--
For some time, I have been operating my robot using multiple Stamps. These Stamps "talk" to each other via five of their pins which are connected. For example, Pin 0 on a Stamp may be connected to Pin 12 on another Stamp. Currently, I use 1M resistors between the pins so connected.
However, as my configuration grows and I have to deal with unexpected problems, I am beginning to wonder if the 1M resistor value is correct. Since I am a newbie, this is not a trivial question for me. (I bet the answer is, though!) I know there must be enough voltage from the output pin to drive the input pin high. I am currently trying to find out how much, but I thought it was just less than 2.5V. (I could well be wrong.)
My SUSPICION is that the 1M resistors I am using are too much. In certain situations, they may not allow an output pin to send a "1" to the input pin of the other Stamp.
Using the CORRECT resistor value certainly cannot hurt!
Can you help?
Thanks!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
For some time, I have been operating my robot using multiple Stamps. These Stamps "talk" to each other via five of their pins which are connected. For example, Pin 0 on a Stamp may be connected to Pin 12 on another Stamp. Currently, I use 1M resistors between the pins so connected.
However, as my configuration grows and I have to deal with unexpected problems, I am beginning to wonder if the 1M resistor value is correct. Since I am a newbie, this is not a trivial question for me. (I bet the answer is, though!) I know there must be enough voltage from the output pin to drive the input pin high. I am currently trying to find out how much, but I thought it was just less than 2.5V. (I could well be wrong.)
My SUSPICION is that the 1M resistors I am using are too much. In certain situations, they may not allow an output pin to send a "1" to the input pin of the other Stamp.
Using the CORRECT resistor value certainly cannot hurt!
Can you help?
Thanks!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Comments
There is no "correct" resistor value. It depends on why you have the resistor in the first place. 1MOhm is pretty large and RC effects limit how fast you can run data through it (with stray capacitance effects acting as the C). If you're using the resistors for preventing Stamp damage from short circuits, values from 270 to 330 Ohm are about the minimum you can use. With a 5V supply, they'll limit short circuit current to 15-20mA which I/O pins are designed to handle indefinitely. If you want to protect the I/O pin from other voltages, you may want a higher resistance. A 1M resistor will protect the I/O pin from shorts to AC line voltage and some static discharges if that's what you want. It's all based on Ohms' Law. You can figure out most of it yourself.
Basically, my guess that the 1M resistors are too large appears correct. All I want to do is protect one Stamp pin from another in case I make a software mistake which causes both connected pins to become outputs.
These Stamps are in a breadboard. In the Stamp to Stamp (pin to pin) communications there is no external circuitry. Of course, I do have that SSR, but when I stuck a resistor between it and its control pin, it would not work. (I thought I used a 470 ohm resistor; I better check again in case I used a 1M!) I also control two HB-25s, but the Stamp does not require a resistor to protect it from an HB-25, as far as I know and the documentation reads.
The only other things connected to Stamps are the optical encoder outputs from my two gearmotors. Again, I tried a resistor between the encoder outputs and the Stamp pin. The result was no signal. Removing the resistor cured that problem. HOWEVER, I did not make exhaustive notes like I do now and I COULD have used a 1M resistor, though I doubt it since I think the optical encoder output is from an LED.
I will drop the value of my pin-to-pin resistors, at least in a small-scale test, and see what happens.
I have been playing with Ohm's law this morning. I have all the Stamp documentation and know not to exceed the limits, both total and port-wise.
I will experiment with 470k resistors. (I want to stay above the minimum 220 - 330 ohm range you quoted.)
If you know what resistor value is well within the range of my pin-resistor-pin connection scheme, I would appreciate knowing as well. Plus, I will keep playing with Georg's work, too!
Thanks.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Most SSRs already limit the amount of current that will flow into them. They usually have an LED with a resistor or transistor current limiter. Check their datasheet, but the current is probably on the order of 10mA for any voltage within the specified input range (usually 3-30V or something similar).
Gee. The documentation says the same thing. What a coincidence! [noparse]:)[/noparse]
Thank you, Mike. You help so many of us.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
A value of 470K would still be a lot higher than I would use for a direct connection. One thing to consider is that pull-up and pull-down resistors are typically 4.7K to 47K ohm. With the possibility that these types of resistors could be in place the resistor you'll want to use between the two Stamp pins should be a lot less than that. If you want to play it safe and go beyond the 330ohm resistor that Mike suggested try something like a 1K or 2.2K which is a common value. If you select values that are too high you may have communication issues depending upon what baud rate you select. Just my .02
Robert
Gee. I DID stick that "K" in there, didn't I? I TRULY meant 470 ohms.
I have been waiting on Parallax's new SX-Key (USB), which I ordered along with their SX Controller board, to arrive before I put your stuff together. I see they removed the "Expected Ship Date" from the web site and now merely list it as "Out of Stock." I don't know whether this is good or bad.
In the long run, I will doubtless replace Ugly Buster's BS2p40 "Master" with one of your modules . . . assuming the device to program it ever hits the street! [noparse]:)[/noparse] Using an SX I will not only get far more instrucution execution speed, but that invaluable interrupt structure. This means I will doubtless re-write the bit-signaling communications method--which is the real reason I am asking the resistor question--with some ISR-based code. (Of course, I guess I COULD keep my 5-bit instruction set and STILL use the SX's interrupts. That would be way-fast.)
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
as close to offical parallax info as you can get I think) use 1k as well.
I like using 1k 1/2watt resistors just in case there is a serious problem. I'm not sure if 1/2 is better than 1/4 in this application
but my limited knowledge of ohm's law seems to point that it is.
Hopefully, you never INTEND to do this, but this situation can happen when implementing a bi-directional serial link between two BS2's.
The solution is simple -- put a resistor in there to reduce the 'short-circuit' current to something that won't damage the BS2's. A 220 ohm resistor will result in:
5 volts / 220 ohms == 22 mA, which is below the 25 mA max rating for the pins. A 470 ohm will result in (5 / 470 == 10 mA) which is okay too.
Now, the input impedance of the input gate (when you're using it as you're supposed to be) is about 1 MegOhm itself. So putting an external·1 MegOhm resistor in there is WAY overkill.
When you're using the pins as designed -- one OUTPUT connected to one or more INPUT -- you want as little resistance in the circuit as you can get away with. Thus on the Parallax Homework Board they put in 220 ohm resistors on ALL I/O pins -- just to save newbies from themselves.
Bottom line -- 220, or 470 ohms is fine. 1 Meg is way too much.
I have rebuilt Ugly Buster's brains. Well, maybe his skull, anyway!
The original logic, which is on the Jameco breadboard with 1M resistors, still exists. In the beginning, it worked fine. When matters grew more complex, it quit working fine. I thought of many things before I thought the resistors may be the problem.
In any case, I am now putting together a PDB-based environment. It is far smaller and far more mechanically sound. Plus, it has a lot of features, some of which I will doubtless use in the future. The major change is that it uses 470 ohm resistors, pin to pin.
I also took the opportunity to reduce the number of pins I implemented to what I actually USE. Instead of wiring up five sets of the Master's pins for EACH of the four BS2-OEM Slaves, I now only use three for each BSE-OEM/HB-25/gearmotor Slave and two for each BS2-OEM/gearmotor/optical encoder slave. This is a total of ten, which allows me to use the far faster BS2px-24 for a master, rather than my original BS2p40.
I also reduced Ugly Buster to one 12 volt battery supply. (I elminated the 7.2 volt supply which previously drove the logic.)
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.