Shop OBEX P1 Docs P2 Docs Learn Events
Multiple BS2's to a Pink — Parallax Forums

Multiple BS2's to a Pink

skylightskylight Posts: 1,915
edited 2007-04-14 16:21 in General Discussion
Hi,
I'm considering connecting multiple BS2's to a Pink Module the Stamps will only be communicating to the Pink and not between themselves, basically the Pink will store up to it's 100 variable limit values and these values will be read by the stamps in a parallel configuration(hope this is ok?) and each stamp will control it's output pins according to it's particular assigned variable's value.

The stamps will also update a webpage on the Pink showing their current status (Aux contacts on a contactor, in or out)

Two questions:

If one stamp is updated from the pink at a time and then updates the pink as to it's status, could they be paralleled up to the pink·using 2·bus rails for data?

If so is there a limit to how many paralleled stamps can be hooked up to a pink?

Regards

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-12 18:49
    The PINK is not designed to do this. It responds to commands sent from the Stamp via a serial connection and only one Stamp could be transmitting at a time. One Stamp could be designated as the "master" and it could send commands to the PINK to have the PINK return the values of the 100 variables one at a time. The other Stamps could "listen in" and pick off the values they want. The PINK doesn't identify the value it is sending, so the "master" Stamp would have to transmit its command to the "slave"s as well. If you want the "slave"s to update variables, this whole scheme becomes more complicated. You could connect all the Stamps together and they could take turns transmitting to the PINK. There are lots of ways to do this.

    If you want to connect a lot of Stamps this way, you probably will need to use RS422 signalling and buffers. This would allow multiple transmitters and receivers on a set of lines (one pair to the PINK and the other pair from the PINK). You'd need 3 pins on the Stamps, one from the PINK, one to the PINK or to listen from the other Stamps, and one to change from sending to listening. You could certainly have 10 Stamps, possibly more.
  • skylightskylight Posts: 1,915
    edited 2007-04-12 19:38
    Hi Mike thanks for the quick reply,
    I went down the road of thinking that a basic stamp would listen for it's particular variable, such as stamp 14 contains the line if nb_var 14=1 then close contactor and update a variable to show it's closed .
    As long as they are just listening, I thought that comms back from the stamps would only occur individually as and when a particular stamp was updated.
    in other words the !NB0WXX[noparse]:D[/noparse]D and !NB0RXX statements would control this? Of course in order for a particular stamp to see it's callup they would all have to be constantly polling the pink.
    Thanks for highlighting this overlook on my part.

    My only option then will have to be many pinks each with their individual stamps (was trying to cut costs a bit and also as only a few variables would be used on each pink it seemed a bit of overkill to have several pinks rather than one pink used to it's limits although I will think of ideas in the future for using up the remaining variables i'm sure).
    The project is control of Lighting Bars and their output configurations in some new television studios we are having built at work.
    Regards
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-12 20:26
    No matter what, the PINK would have to be polled continuously since the PINK won't provide information without being asked.

    You really need just one PINK because it will be impractical to try to control several different PINKs, each with their own web address and separate control page. As I suggested, each Stamp can either send to the PINK and the other Stamps on a party line or listen to the party line or listen to the PINK. Each Stamp listens for the "!NB0Rxx" message on the party line for the variable one less than its own. It can ignore the response from the PINK on the other line, then it listens for the "!NB0Wxx:dd/CLS" message on the party line for that same variable #. It pauses briefly, then sends its own "!NB0Rxx" command and listens on the response line from the PINK for its value, then sends the appropriate "!NB0Wxx:dd/CLS" command on the party line. Once the next Stamp sees this, it will pause and ask for its own variable and so on. There would be a timeout and a "fault" LED on each board that would be turned on if the Stamp timed out so that you would have some idea of where the problem might be. This way, there are no "master"s and the system is pretty open ended. The first "master" would have to be different since its own number is zero, but it has to listen for a non-zero (the last) "master" to finish.
  • skylightskylight Posts: 1,915
    edited 2007-04-13 17:11
    Hi Mike,

    Thanks again for your reply, Have been trying to get my head around the code that would be needed for a stamp to see the previous stamps

    !NB0Wxx:dd/CLS command, though i have come up with maybe something similar?

    the previous stamp would read it's value from the pink, send it's response·and then set a pin high that could be the signal for the next stamp to read it's value etc the stamps·pin out·would i believe be like a DTR line and this line would cascade in and out of each consecutive stamp so that the data sequence would occur on the two data lines· the interconnecting would then·be three wire as opposed to two.

    The stamps would be in an enclosure close to each other so interlinking is not a problem, the only question then is one of loading on the pink,at work we use DMX systems that have physical limits of 32 devices on a serial line, would you know the physical limit of stamps connected to a single pink?

    Regards
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-13 17:49
    The Stamp to next Stamp signal line is fine. It would accomplish the same thing as the scheme I suggested with simpler code, but one more I/O pin used. The Stamp I/O lines and the PINK's lines are medium current drivers (probably 20-30ma max). They can probably drive 20-30 devices easily. Physical distance and electrical noise are the main factors in reducing this particularly if your Baud is already 9600 or less.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-13 18:30
    In a similar situation, Phil Pilgrim suggested in another thread that the data line be terminated at the receive end with a 2.2K resistor to Vdd (+5V) and a 3.3K resistor to ground. You'd have a termination like this at the PINK receive end and at the furthest Stamp receive end only. This would tend to reduce noise.
  • skylightskylight Posts: 1,915
    edited 2007-04-13 19:02
    Thanks for your advice, now i can go away and compile all the bits and pieces needed and will let you know how i get on once all the bits are together, i'm bound to be back asking some more questions as i progresssmile.gif
  • skylightskylight Posts: 1,915
    edited 2007-04-14 00:23
    This is the sort of wiring configuration I will be using for the data lines, source code to follow.

    Post Edited (skylight) : 4/14/2007 12:31:00 AM GMT
    951 x 588 - 42K
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-14 02:53
    I would strongly recommend putting a 220 ohm series resistor between each Stamp pin and PINK I/O pin and the transmit and receive busses as well as a 220 ohm resistor in the "handoff" lines between the Stamps. They're not strictly necessary if all the code works properly, but, if there's a coding error, they'll prevent damage to the I/O pins if two connected pins happen to be in opposite output states (one at ground and the other at +5V).
  • skylightskylight Posts: 1,915
    edited 2007-04-14 09:30
    Hi Mike,

    Thanks for the reply, Yes i will put the resistors in and the termination resistors on the last stamp (see updated attachment) The usual way to terminate DMX data lines is a 2200 ohm resistor across the Data+ and Data-(RS 485)·lines as opposed to this configuration.

    ·Only thing that worries me is the value of 2200· and 3300ohms on 5v data lines as the value is the same one used on DMX lines which are RS485·Spec (12v?) should the termination·resistors in the stamp circuit·be of a·greater value in order not to drag the data line signal down?


    Post Edited (skylight) : 4/14/2007 5:08:38 PM GMT
    1008 x 608 - 51K
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-14 14:56
    2200 + 3300 = 5500 ohms. At 5V, that's a current of roughly 1ma. The Stamps or PINK I/O pins have to sink a current of about 2ma or source a current of about 1.7ma. They're designed to handle a load of 20-30ma. The 220 ohm resistors will limit the low voltage to maybe 0.8V and the high voltage to maybe 4.4V. Those are still well within the thresholds for both TTL and CMOS. If you'd feel happier with higher termination resistors, by all means increase them. How about 4.7K and 6.8K respectively? The idea is to set the resting voltage of the line at a logic high (roughly 3V) and to require some current in the line other than just capacitive loading.
  • skylightskylight Posts: 1,915
    edited 2007-04-14 16:21
    Thanks Mike, for your patience and helpful advice for newcomers like myself to the Basic Stamp it's a great help to have such support at hand.
    Regards
Sign In or Register to comment.