Grove Sunlight Sensor Library doesn't Work

I think the halfword is meaning half of a bite from a register… so either a coms problem or maybe the version is using a different register?

Hi there,
Yes, the wire errors need fixing b4 it’s gonna work.
Seems strange, should work. Try removing the Version of Wire.lib you have and see if it finds the alternate. ( I would stay with 2.0.8.) see if you can fix the Wire issue first.
my .02
HTH
GL :slight_smile: PJ

Hi,
Do you know how I would change the version of Wire.lib. Is it the oneWire lib I have or is it something else I have to change. I have also tried uninstalling and reinstalling the Arduino Application and it doesn’t seem to do much

Hi there,
Can you be sure the Compiler is in verbose output and Post it up after you compile the code, The first 20 lines and the last 20 lines is sufficient.
Allot of folks Uninstall IDE and that never fixes anything, really.
Stick with troubleshooting the LIB’s I’m pretty sure that’s why it’s NOT working IMO.
HTH
Gl :slight_smile: PJ

I have attached the pictures:

Hi there,
OK, I was able to duplicate the build, and even with older BSP it has issue with Si1115.h
Try this I combined them and see if it gives any data, does compile same errors.


#include <Wire.h>
#include "Arduino.h"
#include "Si115X.h"
#include "SI114X.h"

SI114X SI1145 = SI114X();
Si115X si1151;

/**
 * Setup for configuration
 */
void setup()
{
    Wire.begin();
    Serial.begin(115200);
    if (!si1151.Begin()) {
        Serial.println("Si1151 is not ready!");
        while (1) {
            delay(1000);
            Serial.print(".");
        };
    }
    else {
        Serial.println("Si1151 is ready!");

        Serial.println("Beginning Si1145!");

    while (!SI1145.Begin()) {
        Serial.println("Si1145 is not ready!");
        delay(1000);
    }
    Serial.println("Si1145 is ready!");
    }
}

/**
 * Loops and reads data from registers
 */
void loop()
{
    Serial.print("IR: ");
    Serial.println(si1151.ReadIR());
    Serial.print("Visible: ");
    Serial.println(si1151.ReadVisible());
//the real UV value must be div 100 from the reg value , datasheet for more information.
    Serial.print("UV: ");  Serial.println((float)SI1145.ReadUV() / 100);
    delay(1000);
  Serial.print("//--------------------------------------//\r\n");
    Serial.print("Vis: "); Serial.println(SI1145.ReadVisible());
    Serial.print("IR: "); Serial.println(SI1145.ReadIR());
    //the real UV value must be div 100 from the reg value , datasheet for more information.
    Serial.print("UV: ");  Serial.println((float)SI1145.ReadUV() / 100);
    delay(1000);
}

HTH
GL :slight_smile: PJ

So this builds fine, however I do get the same errors and I get a sequence of device ready then not ready even when I rebuild the code, and the reset the device

Hi there,
OK that’s looks as I would expect, can you try with BSP 2.0.8 ?
is there any device address associated with the device?
GL :slight_smile: PJ

Hi, so I have tried this with 2.0.8,2.0.11 and 2.0.14. The address is 0x53 at least that’s what the I2C address is when I tried that

Ok, Try this with the delay’s…

// Sunlite..
#include "Si115X.h"

Si115X si1151;

/**
 * Setup for configuration
 */
void setup()
{
     Serial.begin(9600);
    delay (2000);
    Wire.begin();
   delay (500);
    if (!si1151.Begin(0x53)) {
        Serial.println("Si1151 is not ready!");
        while (1) {
            delay(1000);
            Serial.print(".");
        };
    }
    else {
        Serial.println("Si1151 is ready!");
    }
}

/**
 * Loops and reads data from registers
 */
void loop()
{
    Serial.print("IR: ");
    Serial.println(si1151.ReadIR());
    delay (500);
    Serial.print("Visible: ");
    Serial.println(si1151.ReadVisible());
    delay(500);
     //Serial.println(si1151.ReadUV());
    //delay(500);
}

Lmk,
So , I’m down to Defective device?, or the wire lib is broken, or needs 2wire.lib ?
more info needed, Can you post a pic of the Hardware setup?
HTH
GL :slight_smile: PJ

Oh wow that finally works thank you so much. I have attached the pictures. Also I was wondering do I just not use the ReadUV and keep the other two sensors running.

1 Like

Good job PG… you done it again!

Hello everyone,
After testing, we have now updated the code about Grove Sunlight Sensor library related. Hope it can solve your problem

2 Likes

Good job! Thanks for the hard work…

1 Like

Hi There,
Great, sometimes it’s the subtleties of the devices an the code to work them.
Way to stay with it to a solution. You can remove the UV line, that’s for the 11145.
be sure to mark the delay’s post as solution so others can find it. :wink: :+1:
GL :slight_smile: PJ

1 Like

can you guys check on this one… the software does not expose all the advertised features

TIP

The gesture functionality is not supported yet, since this functionality needs algorithms provided by AMS. We will update this library as soon as we get the support from AMS.

Example 1 per wiki… i googled and did not find any results

Hello @cgwaltney , currently we do not have plans for that feature yet, and the gesture functionality is still not supported. We sincerely apologize for any inconvenience this may cause you.