Shop OBEX P1 Docs P2 Docs Learn Events
Multiple colorpal sensors + issues with serial receiving — Parallax Forums

Multiple colorpal sensors + issues with serial receiving

lwcyblwcyb Posts: 13
edited 2014-11-25 09:39 in BASIC Stamp
Hello,

I have an issue with communication from 4 colorpals interfaced to a basic stamp 2. I am using a VB.net based GUI to send and receive communication. I am displaying the RGB values on the GUI. Sometimes, it works great, and all 4 sensor RGB values are displayed correctly on the GUI. However, there are also times where I receive 0's, random single, double, triple, or even 4 digit values that do not correspond to the given color (as an example, I can get 0's, or 7's, or 3000+ on a white sheet, while other sensors are reading correctly around 255).

The issue seems to start depending on the first connection. If the first couple sets of data are good then the RGB values never seem to go wrong. If I connect and the RGBs are off, they are always off until I disconnect. They might fluctuate and a correct looking number may show up once in a while, but they are screwed up most of the time. Also, it is possible to disconnect and reconnect and have the values showing up perfectly normal. So, to me it seems as if there is some timing issue.

I've tried changing the delays within the Pbasic program to no avail. I have the serial port settings in vb.net set to 9600, 8 bit, no parity, 1 stop bit.

Would anyone have any insight into this issue?

Thanks

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-09-29 13:11
    Be sure to set the baudrate in your PBASIC program for reading the ColorPAL to 7200. That's the sweet spot for the ColorPAL's auto baud detect.

    -Phil
  • lwcyblwcyb Posts: 13
    edited 2014-09-30 06:00
    Hi Phil, I am using parts of the example code for the ColorPal and have the baudrate settings left at 7200. I am using this line:
    baud    CON  119 + 32768
    
  • lwcyblwcyb Posts: 13
    edited 2014-11-25 09:18
    Just wanted to update this thread with the solution I found. Apparently my line length was too long (10 feet) and shortening it down to around 7 feet ensured correct data reception.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-11-25 09:39
    'Glad you got it working! If you need the extra three feet or just want to ensure greater reliablility with your present setup, try adding an additional pull-up resistor to the signal line on the BASIC Stamp end of the cable.

    -Phil
Sign In or Register to comment.