Wish: Eval. board for Color Light Sensor Avago ADJD-S371-Q99

A newbie wish:

If this category is not an adquate one for posting, you may relocate my posting as you prefer.

I am glad you are now carrying the new Color Light Sensor - Avago ADJD-S371-Q999.

Since I am a total newbie in this area, I wish I could have a sort of Evaluation board for the color light sensor, or some intermediate form, preferably compatible with the Arduino Diecimila board.

Many thanks.

One more question:

Would the Arduino board be able to handle the task of handling the color light sensor anyway?

Arduino/wiring is more than adequate to handle this sort of stuff.

See http://www.tigoe.net/pcomp/code/categor … nowiring/9

HTH

Claudio

has anybody figured out how to connect to this super tiny part?

adamjamesv:
has anybody figured out how to connect to this super tiny part?

Of course ! We'll wait until SF will do a breadboard :-)

Seriously, this is jeweller’s stuff. I was not realizing how small this sensor is.

Thanks a lot!

I’ve been waiting for your new evaluation board.

And you made it available.

sjyng78:
…and you made it available.

Thanks from here, too.

…Even if it’s out of stock :roll:

Well, at this moment, I finished ordering the evaluation board for the Avago color sensor.

One more silly question:

Would the program written by Nathan Seidle work also on an Arduino i2c interface?

sjyng78:
Would the program written by Nathan Seidle’s work also on an Arduino i2c interface?

Not 'as is', obviously. Arduino is not C, but is not difficult to translate, in this case.

When my boards arrive will try to write a proof of concept for Arduino.

Thanks, araknide.

I have a long way to go to learn Wiring or Arduino language including C programming.

Example program would be a big help to me. :slight_smile:

Sjyng,

bear in mind that the programmer (Nathan) has done a big work writing routines for i2c in software. using Arduino (or any processor with i2c master in hardware) is more easy, since you can strip those routines.

Ciao

Thank you araknide,

Good news! I’m glad to know that since the Arduino has a master i2c in it, the length of current Nathan’s program(for PIC) may become shorter for the Arduino.

Ciao.

Sjyng

Here it is, even if the board has not arrived yet.

The program compiles without errors, but take it with a grain of salt, since I tested nothing but the correct addressing on first i2c message on my logic analyzer.

The i2c bus on Arduino (tested on diecimila version) is defined in the library on the analog header (near the power header).

Pin 4 is SDA (data)

Pin 5 is SCL (clock)

Ciao

#include <Wire.h>

#define DEVICE_WRITE 0x74 // Default ADJD-S371 I2C address - write. Would be 0xE8 but only most significant 7 bits.

#define DEVICE_READ 0x74 // Default ADJD-S371 I2C address - read. Would be 0xE9 but only most significant 7 bits.

#define CAP_RED 0x06

#define CAP_GREEN 0x07

#define CAP_BLUE 0x08

#define CAP_CLEAR 0x09

#define INT_RED_LO 0x0A

#define INT_RED_HI 0x0B

#define INT_GREEN_LO 0x0C

#define INT_GREEN_HI 0x0D

#define INT_BLUE_LO 0x0E

#define INT_BLUE_HI 0x0F

#define INT_CLEAR_LO 0x10

#define INT_CLEAR_HI 0x11

#define DATA_RED_LO 0x40

#define DATA_RED_HI 0x41

#define DATA_GREEN_LO 0x42

#define DATA_GREEN_HI 0x43

#define DATA_BLUE_LO 0x44

#define DATA_BLUE_HI 0x45

#define DATA_CLEAR_LO 0x46

#define DATA_CLEAR_HI 0x47

void setup()

{

Wire.begin(); // join i2c bus (address optional for master)

Serial.begin(9600);

Serial.print("Sending Calibration data … ");

adjd_init();

Serial.print("Calibration data sent. ");

}

void loop()

{

adjd_s371_read();

delay(4000);

}

void adjd_s371_read(void)

{

uint16_t red, green, blue, cclear;

// request 8 bytes from slave device

Wire.requestFrom(DEVICE_READ, 8);

if(8 <= Wire.available())

{

red = Wire.receive();

red = red << 8;

red |= Wire.receive();

Serial.println(red);

green = Wire.receive();

green = green << 8;

green |= Wire.receive();

Serial.println(green);

blue = Wire.receive();

blue = blue << 8;

blue |= Wire.receive();

Serial.println(blue);

cclear = Wire.receive();

cclear = cclear << 8;

cclear |= Wire.receive();

Serial.println(cclear);

}

}

static void adjd_init()

{

write_register(CAP_RED, 0x05);

write_register(CAP_GREEN, 0x05);

write_register(CAP_BLUE, 0x05);

write_register(CAP_CLEAR, 0x05);

write_register(INT_RED_LO, 0xC4);

write_register(INT_RED_HI, 0x09);

write_register(INT_GREEN_LO, 0xC4);

write_register(INT_GREEN_HI, 0x09);

write_register(INT_BLUE_LO, 0xC4);

write_register(INT_BLUE_HI, 0x09);

write_register(INT_CLEAR_LO, 0xC4);

write_register(INT_CLEAR_HI, 0x09);

}

static void write_register(uint8_t register_name, uint8_t register_value)

{

Wire.beginTransmission(DEVICE_WRITE);

Wire.send(register_name);

Wire.send(register_value);

Wire.endTransmission();

}

Thank you again, araknide.

I’ve just saved your program, and compiled.

The program compiled great.

As soon as the color sensor arrives, I will give it a try with your program on my Arduino Diecimila.

I really appreciate your help.

Ciao!

sjyng

Finally, I’ve got my Avago color sensor evalution board today.

With the board and my Arduino Diecimila, minimum connections were made due to my limited knowledge. I did not connect the sleep and xclock pins, since I had no knowledge about the usage of them.

Please bear with my ignorance about these settings.

Connections were made for the SDA, SCL, 3.3Vdc, and GND.(No LED powered yet)

After uploading were done OK, the monitor seemed working OK. The board was left on a table top with the sensor facing the room lights(fluorescent bulbs).

After calibration process, I’ve got following numbers under the light.

0

0

6912

0

0

…(around 20 or so zeros)

0

4607

1023

4

0

10

160

2313

… and so on.

Anyway, I am trying to learn the sleep and other functions of the unconnected pins.

Well, at this moment, it seems working OK even though I have no idea yet how to measure RGB values of specimens I would like to measure.

Many thanks, araknide.

Sjyng

Uhm… the program ‘reads’ always something, even without sensor attached. Something is wrong. Will attach sensor and give it a try tomorrow.

First: addresses are wrong: write is 0x68, read is 0x69.

Second: I put two 10K resistors in series on SDA and SCL lines. This for the different voltage logic (Arduino is 5V, sensor is 3.3). But should lower their values since pulses are almost inesistent…

hello!

where can i find some C-Code for adjd color sensor?

should be working with an 80c51.

thanks in advance!

alcarin:
where can i find some C-Code for adjd color sensor?

should be working with an 80c51.

Look at the product page on SFE site...

araknide:
First: addresses are wrong: write is 0x68, read is 0x69.

Second: I put two 10K resistors in series on SDA and SCL lines. This for the different voltage logic (Arduino is 5V, sensor is 3.3). But should lower their values since pulses are almost inesistent…

Thanks araknide,

  1. I have changed the pde file: DEVICE_write 0x68 DEVICE_read 0x69.

  2. My Diecimila has 3.3Vdc output. Would the power be OK in case I connect the Avago Eval. Board’s power to the Diecimila’s 3.3Vdc output?

With the same setup(No power to the LED, no connections to the sleep), I got the following numbers, after the calibration message:

4361

0

0

0

4361

0

0

0

4361

0

0

0 … and so on.

Any suggestions will be welcome.

Ciao

sjyng