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 successive readings through I2C bus needs 1 second delay

Other Parts Discussed in Thread: OPT3001, MSP430FR5969

I have connected OPT3001 sensor with MSP430FR5969 and trying to read the data from OPT3001. I could able to get the proper lux value between two successive readings through I2C bus, when I use 1 second  delay between two successive readings, other wise if I keep delay of 900 msec between two successive readings of OPT3001 giving wrong lux value. Please suggest is there any method to get the lux data from OPT3001 sensor at least 5 values per second?

  • What configuration are you using? Continuous readings or one-shot? 800ms or 100ms conversion time? With 100ms conversion time, you can get 10 readings per second.
  • Jason Bridgmon,

    I have set for Configuration Register Field Description:

    [15:12]   RN[3:0]     1100b    -  automatic full-scale setting mode

     [11]          CT           0b          -   The 100-ms conversion time

    [10:9]       M[1:0]      01b        -   Single-shot

    I am using I2C configuration data rate is 

    param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS;

    with above configuration, for proper data from OPT3001 needs 1 second delay between successive readings. Please suggest, if I need to do any change to configuration register.

    Thanks & Regards

    Suresh

  • Suresh,

    Have you looked at the communication lines with an oscilloscope to make sure you're getting what you think you're getting? Are you polling the configuration register to see when the conversion data is ready?

    It would be good if you posted the code you're using here or send it to my email if it is something you don't want to share. I'm at Bridgmon_Jason@ti.com.

  • Jason Bridgmon,
    Problem solved.
    I have maintained 100msec delay between initiating conversion and reading the data from OPT3001.
    but i have increased this delay to 105msec, then it start working. Now I can able to read 9 values per second.
    code snippet is as mentioned below:
    p_i2c_transmitData = (uint8_t *)OPT3001_initMEAS1; //Transmit array start address
    i2c_transmitCounter = sizeof OPT3001_initMEAS1; //Load transmit byte counter
    i2c_write(OPT3001_ADDRESS);

    __delay_cycles(DELAY_100_MS);
    __delay_cycles(DELAY_1_MS);
    __delay_cycles(DELAY_1_MS);
    __delay_cycles(DELAY_1_MS);
    __delay_cycles(DELAY_1_MS);
    __delay_cycles(DELAY_1_MS);

    p_i2c_transmitData = (uint8_t *)OPT3001_ResultAddr; //Transmit array start address
    i2c_transmitCounter = sizeof OPT3001_ResultAddr; //Load transmit byte counter
    i2c_write(OPT3001_ADDRESS);

    p_i2c_receivedData = (uint8_t *)Lux_Meas1_MSB; //Receive array start address
    i2c_read_byte(OPT3001_ADDRESS, sizeof Lux_Meas1_MSB); //Read two bytes of lux data form result register

    Thanks & Regards
    Suresh
  • This is great news! Glad you were able to get it working, and thank you for sharing your code.
    We'll be here if you need anything else.