New Calibration for AS7265X triad sensor

hello,

i have the AS7265X sensor and i need to study the reflectance of leaves.

i’m measuring using artificial light and using this configuration:

AS7265X_GAIN_1X

AS7265X_MEASUREMENT_MODE_6CHAN_ONE_SHOT

integration cycles: 255

at the moment i’m getting only raw data, but i think i need a calibration according to my source light.

do you have any idea how to do a calibration?i have a blank teflon disk for the c alibration, should i use it?

You’d block all ambient light and set the light to a known distance & power and run an edited version of this https://github.com/sparkfun/SparkFun_AS … ttings.ino

Then use those calibrated values in your data acquisition

hi TS-Russell, thank you for your response.

through this procedure i have a set of calibrated value (getCalibrated…() function), according to my light source and parameters, so i essentially have the spectrum of my light source under certain conditions of measurement.

but later, when I make an acquisition by placing a leaf in front of the sensor, is it enough for me to directly take the value returned by getCalibrated? or do I have to perform operations on raw data?

thank you very much.

I’ve build a pretty darn functional general purpose spectrometer that displays both absorption and refracted light that may be pretty much plug and play for your use case. It includes both a sampling function that allows for user specified gain and LED intensity, sample length (the sample method is a little different than I have seen on line but seems to work great) and a calibration script for either an all white or all black enclosure. I’ve been lazy and haven’t posted to github yet, but wil, including the enclosure STL file for 3d printing.

The way i’m calibrating is as per below. Note I am using all sensor “channels”, from viz to IR, as all are diagnostic and information-rich, but they all have their own sensitivity issues so I’ve tried to find a simple calibration approach that allows for adjustments per channel/spectral range.

  1. Calibration Output:
    • Dark Calibration: During dark calibration, the sensor is capturing ambient noise (zero-reference) when no light is present. These values are saved to a file (e.g., dark_calibration.csv) and represent a “baseline offset” to subtract from future runs.
    • White Calibration: During white calibration, the sensor captures a maximum light reference. These values are saved to a file (e.g., white_calibration.csv) and represent the “upper bound” to normalize intensity readings for future runs.

This maps the raw intensity to a range between 0 and 1, where:
• 0 represents the dark (minimum intensity).
• 1 represents the white (maximum intensity).
• Values outside this range are clipped (e.g., negative values become 0).

How it works?

The calibration process adjusts the raw sensor output using the dark and white calibration files:
• Calibrated Intensity Formula:

Calibration intensity = (raw intensity - dark intensity)/(white intensity - dark intensity)

I have not measures organic stuff yet, but a boatload of minerals and gemstones and it’s remarkably accurate so far. In many ways, despite the lack of full spectrum analysis, the fact that the board measures the range it does, something no lab spectrometer does that I know of, it may even exceed lab grade for my use case (ie, not all bands are equally diagnostic, and some are not even considered in reference libraries is absorption ‘signatures’ by mineral).

I hope that helps . PM me and i can share code (several pytbon scripts orchestrated by a master shell script, plus the arduino code).

4 Likes

Would love to see the code!

can i see the code for the calibration of as7265x triad sensor? i have a project to determine the ripe fruits using that sensor, regards

Good day. I would love to see the code in application on non-destructive internal qualities of a citrus fruit.

Hi all, I am preparing to post the code on GitHub, I went sort of deep with it after coming to see that the long-pole in use of low cost (or any cost) sensors for spectrometry is really this kind of thing - calibration, processing of calibrated files for analysis, matching, etc. I have a pretty respectable draft of most of that (including the matching algo) with a GUI (in PyQt5) and when I have time and work out the key bugs, I will make it available. Note the as7265x sensor is EOS, but I am still using that, and have also began using the 7343 and a toshiba cmos sensor, which I hope to make comparable with the code (ideally abstracting the code from the sensor in ways that simply shims can be written to make it sensor independent. I am looking for someone to test it out before posting, and so if anyone is interested, please PM me. Note the GUI is super simply to use, but there are maybe a dozen or so shell and python scripts involved and so some proficiency with those will be needed to run the code. You will also need an enclosure or some familiarity with creating a baseline white and dark reference (I use fixed enclosures, so I simply line the interior with Musuo black paint and sample that for the black baseline, and I made some paint with burium sulfate, titanium dioxide, and a quality matte acrylic medium and painted an object that represents the max sized, standard shaped samples and measured that as the white baseline. The code takes care of the rest. I don’t have a lot of time to spend helping someone get this up and running, and so unfortunately, I can’t help much outside of basic guidance and readme files, but I could really use the feedback and so I’ll invest the time if someone can help provide that, or ideally, help enhance the code or the reference datasets (which I will post as well, in this case for minerals, etc).

1 Like