This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OPT3001: Test for Unexpected value of configuration register

Part Number: OPT3001

Hi, 

1. 

we have using an Arduino microcontroller to read the configuration register, and there is only opt3001 has connected to the microcontroller, the test program is continuously read the value of the configuration register, the value is correct at first, but after it runs for sixteen days, it value is become invalid,
the value of configuration register is toggles between 0xFE9F and 0xFE1F. when we reboot opt3001, the read value is normal again(The value is 0xc810).

2. The test program run on Arduino is as below, it is only read value from configuration register and check if this value is correct:

#include <U8glib.h>
#include <Wire.h>
#include <math.h>
#include <stdlib.h>

//Init LCD Init pins
#define SCK 13
#define MOSI 11
#define CS 10
U8GLIB_ST7920_128X64_1X u8g(SCK, MOSI, CS); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17

//control pins
#define REMOTE_CTR 2
unsigned int value;
unsigned int reading = 0;

void show_running(unsigned long value)
{
char value_str[10];
sprintf(value_str, "%s %d","value:", value);

//Display configuration register value on LCD
u8g.firstPage();
do {
u8g.drawStr( 0, 60, value_str);
} while ( u8g.nextPage() );
}

//Display error message
void show_error_setting(void) {
u8g.setFont(u8g_font_unifont);
u8g.drawStr( 0, 22, "error");
}


//Display normal message
void show_right_setting(void) {
u8g.setFont(u8g_font_unifont);
u8g.drawStr( 0, 22, "right");
}

void setup()
{
Wire.begin();
Serial.begin(9600);//init Serail band rate
}

void loop()
{
Wire.beginTransmission(0x44); // transmit to device #112
Wire.write(byte(0x01)); // sets register pointer to echo #1 register (0x02)

// request reading from opt3001 sensor
Wire.endTransmission();
Wire.requestFrom(0x44,2);
if (2<= Wire.available())
{
reading = Wire.read(); // receive high byte (overwrites previous reading)
reading = reading << 8; // shift high byte to be high 8 bits
reading |= Wire.read(); // receive low byte as lower 8 bits
value=reading;

// print the reading
delay(300);

if (value==0xc810) //
{

Serial.println("right");
u8g.setFont(u8g_font_unifont);

u8g.firstPage();
do{
show_right_setting();
}while ( u8g.nextPage() );
}
else
{
Serial.println("error");
Serial.println(value);
u8g.setFont(u8g_font_unifont);

u8g.firstPage();
do{
show_running(value);
}while ( u8g.nextPage() );
}

}
else
{
Serial.println("error");
u8g.setFont(u8g_font_unifont);
show_error_setting();
u8g.firstPage();
do{
show_error_setting();
}while ( u8g.nextPage() );
}
}

3. The Arduino hardware schematic is as below:

3872.Arduino_Uno_Rev3-schematic.pdf

AMBIENT.pdf

Thank you!

Liang