SI1145 Strange readings

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
riden
 
Posts: 8
Joined: Mon Dec 08, 2014 2:54 am

SI1145 Strange readings

Post by riden »

I'm using one of your SI1145 breakout boards with a 5v Arduino Pro Mini and your library. I am observing some strange reading where the minimum completely dark floor value for both IR and Visible is around 254-260. This seems strange to me as I thought that I should see a reading of 0 plus an ADC jitter of a few counts. The board does respond to light changes, but the lowest readings seem off. .

Has anyone else observed similar readings? I could apply an offset to the readings to bring the floor to 0, but I want to make sure that there isn't something wrong with my board.

User avatar
primexandy
 
Posts: 89
Joined: Sat Sep 06, 2014 11:09 am

Re: SI1145 Strange readings

Post by primexandy »

yes. I think there is deliberately an offset of 255 or 256 to prevent minus figures. I'll dig out some details

User avatar
primexandy
 
Posts: 89
Joined: Sat Sep 06, 2014 11:09 am

Re: SI1145 Strange readings

Post by primexandy »

...within the Parameter registers I've made a note within my driver. The offset is defined within the device setup. The default is probably 255 but it's worth just reading that parameter to see if your device has that default. I can't remember if I tested it or whether I just set it as per the documentation. I forget the exact details but it was something to do with the overflow condition, if the most significant bit becomes set then the output from the register becomes negative due to the fact that you are supposed to have an unsigned char....or maybe I remember wrong but there is an offset at location 1A and it should be set to a MAX or MIN of 255 (i forget which but I went with what was advised).

Code: Select all

// ADC_OFFSET is not on the v1.2 datatsheet but is mentioned else where
#define ADC_OFFSET	0x1A

// Set adc offset to 255
wiringPiI2CWriteReg8 (fd,(unsigned char)ADC_OFFSET, (unsigned char)0xFF);
This wasn't documented within the datasheet but within another document. I forget which document but within my code I have the lines...

Code: Select all

int vis = SI1145_ReadVIS(fd);
vis -= ADC_OFFSET;
I apply the offset to IR and VIS readings. I haven't applied it to the UV reading so it may be that the internal UV calculations take the offset into account but the IR and VIS don't. You may find that if you set that OFFSET then the UV readings will be correct but your VIS and IR will now be wrong and so your code may need to be altered for VIS and IR only.

User avatar
riden
 
Posts: 8
Joined: Mon Dec 08, 2014 2:54 am

Re: SI1145 Strange readings

Post by riden »

On my board ADC_OFFSET (0x1A) returns 128 as a default and can be set programmatically. If I set the value too high, I can get an underflow resulting in a high value due to the unsigned int holding the value. I was hoping the the chip would calculate the correct offset and I'm not sure that it isn't, but for a purpose which aren't directly related to the visible and IR level reported.

That location still isn't documented in most recent version of the SI1145 datasheet (1.3), but I did find that constant as well as several others defined in si144x_functions.h which is included in the SI1145 SDK. As I'm not sure of the side effects setting those undocumented parameters and the default reported by my chip isn't large enough to zero the reading in no-light situations, I am going to apply my own offset correction and handle any underflow issues in the code and external from the class..

I appreciate your help. It is good to know that this issue isn't caused by a defective board. Thank you.

User avatar
smerrett79
 
Posts: 16
Joined: Sun Aug 30, 2015 9:46 pm

Re: SI1145 Strange readings

Post by smerrett79 »

Just as extra reassurance that this offset is expected, Silicon Labs application note AN523 gives a formula for correction of Lux readings when using a cover over the sensor (e.g. acrylic or polycarbonate sheet):
Lux level = [ [(ALS visible reading) - (ALS visible dark reading)] x (ALS visible coefficient) +
[ (ALSIR reading) - (ALS IR dark reading)] x (ALS IR coefficient) ] x gain correction
So the fact that they're subtracting the dark reading, which should just be the offset value, makes sense.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”