Parallax ColorPAL and Arduino

:slight_smile: Has anyone out there tried successfully interfacing the colorPAL with Arduino and if so, is there any code knocking about to experiment with?
Thanks… :slight_smile:

What is "the colorPAL" can you post a link to it.

It is a bot odd because PAL is a European TV standard but color is a U.S. miss spelling of the word colour. So the two things don't sound like they mix.

http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/colorPAL/List/0/SortField/4/ProductID/617/Default.aspx

Those crazy Yanks!! :) There's a data sheet on the same page as well. I was looking at another thread that you had some input in...http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239955755

I wondered if I could simply start working with that code and take it from there. Thanks :)

http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/28380ColorPAL.pdf

Some sort of open-collector drain type serial interconnect (?).

I wondered if I could simply start working with that code and take it from there.

No this one works in a totally different way. It uses the serial line at 7200 baud, a very non standard rate. You are probably best of using NewSoftware serial and connecting it to a standard digital pin and enable the internal pull up resistor. This is because it sometimes has to be an input and sometimes an output. The code at the bottom of page 5 should translate easily into arduino. Then you need to switch to driving the pin in a serial manor as described in the next section. Use the direct command mode.

It looks like there is a lot of reading to be done in that data sheet. Best of luck.

Ok, this looks like it's beyond me for the moment! Serves me right for buying things on a whim without doing the research first :) But I'm up for the challenge anyway.....Thanks GRUMPY_MIKE ;)

Hi, everyone. I was able to get the sensor to give some readings. Take a look at the code below. The setup() section simply follows the instruction in the data sheet to put the sensor in the Direct command. Then, I just send a command to the sensor to continously read from it.

#include <SoftwareSerial.h>

SoftwareSerial Color90(2, 3);

/*====================================================
 / Connect ColorPAL SIG signal to Arduino pin 2 and 3
 / Baud Rate = 9600 kbps
 / 
 /====================================================*/

void setup() 
{ 
  Serial.begin(9600);
  Color90.begin(4800);

  pinMode(2,INPUT);
  pinMode(3,INPUT);
  digitalWrite(2,HIGH); // Enable the pull-up resistor
  digitalWrite(3,HIGH); // Enable the pull-up resistor

  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(2,LOW);
  digitalWrite(3,LOW);
  
  pinMode(2,INPUT);
  pinMode(3,INPUT);
  
  Serial.println("Pass 1");
  
  while( digitalRead(2) != HIGH || digitalRead(3) != HIGH ) {
    Serial.println("In the loop");
    delay(50);
  }
  
  Serial.println("Pass 2");

  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(2,LOW);
  digitalWrite(3,LOW);
  delay(80);
  
  pinMode(2,INPUT);
  pinMode(3,OUTPUT);
  delay(100);  
} 

//---------------------------------

void loop() 
{ 
  char rByte[9];
  
  Color90.begin(4800);
  Color90.print("= (00 $ m) !");
  pinMode(3,INPUT);

  rByte[0] = Color90.read();
  if( rByte[0] == '

) {
   for(int i=0; i<9; i++) {
     rByte[i] = Color90.read();
     Serial.print(rByte[i]);
   }
   Serial.println();
 }

delay(500);
}

I tried this out theOrbiter but all I get is pass1 & pass2 showing up in my serial monitor and nothing else! Just one little flash of light from the LED of the colorPAL and that's it :-/

I just tried it with my other brand new ColorPal sensor, which I haven't touched before and it seems to be working fine with my Arduino Mega. I have no idea why it isn't working for you, but perhaps try sending to it other commands and see if it responds.

For example, try just sending: "= R !" instead of "= (00 $ m) !" The ColorPal should show a red light on the LED.

Or, try other commands that appear in the datasheet.

Ok, I've messed around a bit but bizarrely, the colorPAL will only function as you describe operating on 3.3volts and not the designated 5volts!! I wonder why!! :-/

yeap it worked for me, but i only take hex values is any algorithm to convert hex to rgb values and then send them seriialy back to the computer?

Hi, I have tried using ColorPal and Arduino last week. Result: it works fine for sending data to color pal , like = R ! --> turn on Red. But I could not read the measure value from color pal? Help, anyone? Thanks on advance. :)