Pages: [1] 2   Go Down
Author Topic: Can't read Atlas Scientific colour detector  (Read 3226 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to read from the Atlas Scientific colour detector ENV-RGB, which is supposed to return a string.  Using the demo software I get nothing back.  I tweaked the software a little bit and it seems to be returning something, but just random characters rather than the "rrr, ggg, bbb" string that's in the spec.  Has anyone used this sensor?  Is it tricky?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24321
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I tweaked the software a little bit
...but you didn't think to post it, or give any reference to the sensor?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you so much.  Clearly friendliness is not one of the things you are moderating for.  I'm sorry I joined. 
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24321
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But still no code?

Quote
Clearly friendliness is not one of the things you are moderating for.
"My car wouldn't start this morning. It's a white car. What is wrong?".

See why we ask the questions we ask?
« Last Edit: February 02, 2013, 02:49:15 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12428
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but just random characters rather than the "rrr, ggg, bbb" string that's in the spec

This might point to wrong communication setting or so. Is it a string of digits or a string of bytes (I have not read the datasheet) as typically every color would fit into one byte (and yes these may appear as the complete alphabet and more if interpreted as digits in a string.

I found the sensor after some googling here - http://atlas-scientific.com/product_pages/sensors/env-rgb.html -

Many questions pop up, the top 6:
What settings do you use in your code?
baud rate?
parity?
etc
Can you see the comma's appearing in the output?
Do you synchronize upon the <CR> character in your code?
Did you double check TX & RX?



Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I bought one of these sensors a week ago and struggling to get it working properly. The code they provided did not work.

Ive managed to get a reading through the serial, digital 0, 1 pins and then entering this code:

Code:
void setup() {}
void loop(){}

opening the serial reader and entering "C" to start taking a reading at 620ms. you should get something like this.

Code:
14,8,414,14,1410,10,1413,18,18

What I would like to know is how can you use soft serial and strings to be able to take a reading that arduino can then do something with.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12428
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From the specs I've seen, this should do a basic capture. Give it a try

Code:
#include <NewSoftSerial.h>

NewSoftSerial mySerial(2, 3); 

void setup() 
{
  Serial.begin(115200);
  Serial.println("Start color sensor");

  // set the data rate for the NewSoftSerial port
  mySerial.begin(38400);
  mySerial.write('C');
}

void loop()
{
  char c;
  if (mySerial.available())
  {
    char c = mySerial.read()
    Serial.print(c);
    if (c == ',') Serial.println(); // split the R G and B
    if (c == 13) Serial.println(); // extra newline
  }
}
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for that,

ive just tried verify this and get the following error:

'NewSoftSerial' does not name a type.

im running 1.0.3

Cheers,

Phil
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24321
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use "SoftwareSerial" instead.


Quote
I'm sorry I joined. 
Quote
Members from IP (range) xx.xxx.xxx.xx
IP address    Display name
xx.xxx.xxx.xx    Summersgill, summersgillb
So sorry, you joined twice?
« Last Edit: February 03, 2013, 02:46:31 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12428
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, retry
Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); 

void setup() 
{
  Serial.begin(115200);
  Serial.println("Start color sensor");

  // set the data rate for the NewSoftSerial port
  mySerial.begin(38400);
  mySerial.print('C');
}

void loop()
{
  if (mySerial.available())
  {
    char c = mySerial.read();
    Serial.print(c);
    if (c == ',') Serial.println(); // split the R G and B
    if (c == 13) Serial.println(); // extra newline
  }
}
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for that,

I open up the serial monitor and get this...

Code:
͹ÙL

(values change when i close and re-open the monitor) for example:

Code:
Ô»Ðó

Code:
ݽùÌ
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12428
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

that looks like some ascii code very promising (said the optimist)
Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); 

void setup() 
{
  Serial.begin(115200);
  Serial.println("Start color sensor");

  // set the data rate for the NewSoftSerial port
  mySerial.begin(38400);
  mySerial.print('C');
}

void loop()
{
  if (mySerial.available())
  {
    char c = mySerial.read();
    Serial.print(c, DEC);  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<< line changed
    if (c == ',') Serial.println(); // split the R G and B
    if (c == 13) Serial.println(); // extra newline
  }
}
can you give it a try?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

cool,

im getting a new reading roughly every second now...

Code:
ɵÁ\•Ð‚ p€aఉÁY` 1€aÿ‰ðÉÜp€aàЁ‰£ p€#ఉ‘‹¡ p€#øÐʼn£ p€#àðɑ‹! p€øÌùñ 0€apÀ̹±‹á cøÐʼn£ p€#ఙÁK°cà‚Ùpcà
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12428
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are coming to much bytes, could also be a loose wire(!)

Have you try alternative baud rates?
9600, 19200, 38400 (already tested), 115200?

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, robtillaart.  I tried your code, too, but I still don't get anything back.  
Logged

Pages: [1] 2   Go Up
Jump to: