Shop OBEX P1 Docs P2 Docs Learn Events
Connecting the mobostamp to an Arduino microcontroller — Parallax Forums

Connecting the mobostamp to an Arduino microcontroller

ohmyvegetableohmyvegetable Posts: 3
edited 2013-02-15 07:48 in BASIC Stamp
Good day! My classmates and I are currently working on a project wherein we have to detect color from the TCS230-db connected to the mobostamp and interface it to an Arduino microcontroller and display data on an LCD. Right now, we are already done in the arduino part and mobostamp codes, we can already detect RGB colors from the tcs230 sensor. Our problem now is on how we are going to connect the mobostamp and transfer its data to the arduino microcontroller( Our microcontroller contains equations and conditions regarding the RGB colors so we cannot disregard it and just connect the mobostamp to an LCD) We tried USB to Serial connection, USB to UART converter and USB to TTL converter since the arduino microcontroller seems to accept only TTL from another microcontroller. Is it possible to interface this two microcontrollers? help please :( thank you very much! :)

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-07 09:52
    Yes, it is easy to interface the two microcontrollers. You can't use USB. You need to use 2 of the Stamp's I/O pins and connect them to the Arduino's serial Rx and Tx pins. I strongly suggest using a 330 Ohm resistor in series in each connection to protect the I/O pins from programming errors. You'd use a SEROUT statement to transmit to the Arduino's Rx pin and a SERIN statement to receive from the Arduino's Tx pin. Which Stamp pins you use depends on how you have the TCS230-DB connected. The SEROUT and SERIN statements can be used with any Stamp I/O pin.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-02-07 10:27
    I would suggest using P0 and P1 on the Mobo's "B" connector for your serial RX and TX signals. These include the 330R protection resistors (as do all MoBo external connections), along with 4.7K pullup resistors. You will need a couple of inexpensive accessories to make the physical connection:

    -Phil
  • Buck RogersBuck Rogers Posts: 2,187
    edited 2013-02-07 19:14
    I would suggest using P0 and P1 on the Mobo's "B" connector for your serial RX and TX signals. These include the 330R protection resistors (as do all MoBo external connections), along with 4.7K pullup resistors. You will need a couple of inexpensive accessories to make the physical connection:
    -Phil

    Hello!
    Excellent suggestion. But I'd also suggest this one:
    http://www.parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/txtSearch/28317/List/0/SortField/4/ProductID/469/Default.aspx

    That's the Prototype Daughterboard. It provides a method to attach your gadgetry to the Mobo. Naturally those three would be attached to the B connector.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-02-07 19:28
    Buck,

    Thanks. Yes, that's an excellent suggestion! And potentially less expensive, too. :)

    -Phil
  • ohmyvegetableohmyvegetable Posts: 3
    edited 2013-02-08 04:40
    Thank you very much Mike, Buck and Phil! :) Is there anyway to delay the bitstream that is coming out of the mobostamp since the RGB values that is being decoded by the mobostamp are sent in pulses and It feels like the arduino cannot take in too much data from the mobostamp and perform its function as fast as the incoming data from the mobostamp? thank you very much!
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-08 06:07
    It all depends on what you mean by "delay the bitstream". The BS2pe gets information from the TCS230-DB at a certain rate and transforms it into a sequence of bytes at a certain rate. The Arduino receives a series of bytes and does something with it that ends up getting displayed. At various points in this process, you can add handshaking to make the sender wait until the receiver is ready. The question is "what will get lost if there's not enough buffering at that point to hold the data being delayed?" The BS2pe has very little buffering capability and the Arduino has some, but not under the user's direct control (it's built into the library routines). The SEROUT statement allows for flow control and, with the use of another I/O pin, the Arduino can tell the Stamp to stop sending bytes, but that just stops the Stamp from doing anything including reading the TCS230-DB. If that's ok, the Basic Stamp Syntax and Reference Manual describes how to do it (under the SEROUT statement). If not, you can buy an external buffer like this one. If neither flow control nor an external buffer seems right, you'll have to give more information about your project and the code involved for us to make specific suggestions.
  • ohmyvegetableohmyvegetable Posts: 3
    edited 2013-02-15 06:56
    thank you Mike! We tried your suggestions of using SEROUT and connecting two pins of daughterboard B to tx and rx of arduino, We were glad that they seemed to communicate because as we run our program from the mobostamp the serial monitor of the arduino also outputs data but the problem is I dont think they communicate very well. The serial monitor either outputs special characters or one value only not the RGB we were expecting. Can you please help us on what could possibly be the problem? Thank you very much!
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-15 07:48
    I have already made suggestions, but without more information (source code), I can't be more specific. It sounds like the Arduino is dropping bits or whole characters. You might try slowing down the communications by lowering the Baud to something like 9600 Baud or even slower like 2400 Baud. You might try inserting delays in your Stamp program (PAUSE statements) so that there's more time between packets of RGB data. You might try flow control. The Stamp Manual shows how to do it with the Stamp, but I have no idea how to do the equivalent with the Arduino. You'd have to check the Arduino website for that. There should be library routines available that can do it.
Sign In or Register to comment.