Shop OBEX P1 Docs P2 Docs Learn Events
BS2pe Array — Parallax Forums

BS2pe Array

jamesksujamesksu Posts: 22
edited 2011-08-08 14:59 in BASIC Stamp
Hello, complete noob question again I'm sure, but I thought I'd put this out there and see if anyone has any thoughts about this:

I would like to have an array of up to 12 BS2pe controllers, each containing a color sensor and PING))) sensor. Upon object detection, a color sensor will take a snapshot of 20 RGB readings. The array of 12 basic stamps will transmit the sensed readings at random times and often concurrently. Ideally, the array will all be connected through a USB hub to a single PC, where the data will be logged and manipulated. Does anyone have thoughts about how this could work? I have been able to fully accomplish the task with one BS2pe connected through PC, but what complications could occur with multiple controllers sending data at the same time?

Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-03 21:45
    How did you plan to connect the individual Stamps to the PC? Did you plan for each to have its own virtual serial port via USB? Alternatively, did you plan for the Stamps to be networked and share a single virtual serial port via USB? Did you plan something else?

    If you want to network the Stamps, there's a pair of Nuts and Volts Columns that discusses a Stamp network. I don't remember which Columns, but you could easily spot them browsing through the index (click on the Resources tab on the main Parallax webpage for a link).
  • stamptrolstamptrol Posts: 1,731
    edited 2011-08-04 07:02
    Theres no question that the terms "random" and "concurrently" will be real challenges in a serial communication scheme. Just as with many forms of communication, having more than two parties trying to talk at the same time causes nothing but confusion.

    Having said that, consider this scenario:

    A signal line is pulled up to 5 volts. It is connected to a floating pin on each Stamp. No Stamp will talk if the signal line is low. If a Stamp wishes to talk, it checks the signal line. If its high, it pulls it low to grab priority then sends its message. No other Stamp will interupt while the signal line is low. After talking, the signal line is released. This is described in the programming environment Helpfile under SERIN/SEROUT and is decribed as "open collector".

    Personally I'd use one Stamp as a master to poll all the others in a defined pattern. It will simplify the data handling when the data reaches the PC. There are several rs485 control chips that simplify this so a single pair of wires is all thats required to interconnect the Stamps over long distances.

    Cheers,
  • jamesksujamesksu Posts: 22
    edited 2011-08-04 15:18
    I believe that it may just be easier to network each device individually to a PC using a USB to Cat5 converter for travelling a long distance. I guess that leads to my next question in that the standard USB connection can in fact communicate with a PC using SEROUT/SERIN commands using a virtual serial port? Any extra steps need to be taken to accomplish this as opposed to using a serial connection? Thanks!
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-04 17:02
    There's a USB version of the Board of Education that includes a USB to serial adapter. You can use that to communicate with a PC. There are some limitations. Specifically, whenever data is sent to the Stamp, it's echoed back to the PC. This is an artifact of how the Stamp is wired. Also, the built-in DEBUGIN and DEBUG statements use a fixed 9600 Baud speed. If you use the SERIN and SEROUT statements, you can vary the Baud, but the Stamps in general don't do well much above 9600 Baud except for the BS2px which uses 19200 Baud as a default.

    A virtual serial port takes the place of a direct serial connection. They should work the same way.
  • jamesksujamesksu Posts: 22
    edited 2011-08-07 16:29
    Ok, I have a few more quick questions:

    1. If I have multiple BS2pe boards connected via USB to different USB ports on my PC, can I run different instances of the PLX-DAQ software to read the data of the boards simultaneously?
    2. If not, can I network the BS2pe boards together as you mentioned above with the "open collector" scheme using some sort of USB hub/splitter in lieu of using serial cables?
    3. In the helpfile you mention above, it states that you must use some sort of resistor among other devices when networking the boards together. Can you point me towards a schematic and/or sample code for using the "open collector" scheme?

    The issue is that I need to use the TCS230 color sensor daughterboard and it seems to only function with the BS2PE that only has a mini-USB port. I would like to not have to buy unnecessary adapters, etc.

    Thanks!
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-07 17:14
    1) Probably not. I don't know for certain, but I would expect not.

    2) You don't have to use the mini-USB port except for programming the BS2pe. Once the program is working, you don't need it. You could use an "open collector" type of multi-drop network or you could use the RS485 scheme described in the Nuts and Volts Column. The advantage of the latter is that it's spelled out in detail in the articles.

    3) It's unclear how experienced you are with electronics or programming. If you're a beginner, I'd stick with something like what's described in the Nuts and Volts articles.

    The Propeller Backpack can be used with the TCS230 and already has the resistors you'd need for a simple one-wire multi drop network. You could also plug a TV into each Backpack to monitor the Daughterboard's functioning, but you'd need to do the programming for that and the sensor itself. There are several existing objects in the Propeller Object Exchange that you could use as models for the sensor code.
  • jamesksujamesksu Posts: 22
    edited 2011-08-08 14:59
    Mike- I am confused as to the difference between the open-collector multi-drop network and the one from the 1999 N&V column? Would both require soldering to the BS2pe?

    Also, could I use something like this: http://www.usconverters.com/index.php?main_page=product_info&cPath=75&products_id=314 to interface the RS-485 network to my PC?

    Assuming "yes" to the previous question, how do I get the "slave" stamps on the RS485 network? Some sort of breadboard?
Sign In or Register to comment.