Is it possible to set different gain values for each of the 10-channels on the AS7341?
In a research paper (https://doi.org/10.3390/s21103390) that uses the AS7341 to measure light intensity, they reference setting one gain value for the visible spectrum and a separate gain value for the NIR spectrum. I cannot find any documentation to do this, and all the Adafruit code examples set a single gain (e.g., as7341.setGain(AS7341_GAIN_256X).
AS7341: Set gain of individual light channels
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67391
- Joined: Thu Feb 11, 2010 2:51 pm
Re: AS7341: Set gain of individual light channels
From what I can tell reading the datasheets and app notes for the AS7341, there's no way to set the gain for individual channels. The measurement resoltution seems to be controlled by a combination of maximum sensor activation time and real integration time, but that seems to apply equally for all of the ADC channels. There is a gain register, but again, that seems to apply to all channels and provides no way to tweak channels individually.
The only other thing in the documentation that mentions gain is a flicker-detection channel, which apparently uses a sensor indpendent of all the color sensors.
Your best bet will be to contact the team who wrote the paper and ask them how they configured the device. They'll know the details better than I can guess them.
The only other thing in the documentation that mentions gain is a flicker-detection channel, which apparently uses a sensor indpendent of all the color sensors.
Your best bet will be to contact the team who wrote the paper and ask them how they configured the device. They'll know the details better than I can guess them.
- sj_remington
- Posts: 994
- Joined: Mon Jul 27, 2020 4:51 pm
Re: AS7341: Set gain of individual light channels
You seem to assume that the NIR and VIS data are collected concurrently, but they need not be.
Set AGAIN to 4X to read the VIS channels, then in the next measurement, set AGAIN to 1X to read the NIR channel, and repeat.
But in the discussion section, it seems clear that the authors actually don't understand what the NIR channel measurement is contributing, and they appear to admit this. They are interested only in the 400-700 nm region, and according to Fig. 18 of the AS7341 data sheet, the NIR channel does not respond to radiation with wavelengths shorter than 850 nm.
You should not hesitate to ask the authors questions, or if they will send you their code.
Set AGAIN to 4X to read the VIS channels, then in the next measurement, set AGAIN to 1X to read the NIR channel, and repeat.
But in the discussion section, it seems clear that the authors actually don't understand what the NIR channel measurement is contributing, and they appear to admit this. They are interested only in the 400-700 nm region, and according to Fig. 18 of the AS7341 data sheet, the NIR channel does not respond to radiation with wavelengths shorter than 850 nm.
You should not hesitate to ask the authors questions, or if they will send you their code.
- andrisstuks
- Posts: 10
- Joined: Mon Dec 21, 2020 8:43 am
Re: AS7341: Set gain of individual light channels
As far as I understand there is:kcaj wrote:Is it possible to set different gain values for each of the 10-channels on the AS7341?
In a research paper (https://doi.org/10.3390/s21103390) that uses the AS7341 to measure light intensity, they reference setting one gain value for the visible spectrum and a separate gain value for the NIR spectrum. I cannot find any documentation to do this, and all the Adafruit code examples set a single gain (e.g., as7341.setGain(AS7341_GAIN_256X).
1) integration time - how long does the measurement is made
2) gain - multiplier for measurement
You can set gain separately per each channel, for that you might need to make some adjustments in Adafruit code. Prior latest releases of software for this sensor, I have used my
function to obtain NIR, now this function is implemented.
At the moment I adjust the gain prior to each measurement - I run the measurement, then estimate the highest count value, and according to that I'm changing the gain value. I suppose that you could do the same also for NIR sepaately.
- sj_remington
- Posts: 994
- Joined: Mon Jul 27, 2020 4:51 pm
Re: AS7341: Set gain of individual light channels
Not according to the device data sheet that I have, but you can always multiply the individual channel readings by a scale factor.You can set gain separately per each channel
- andrisstuks
- Posts: 10
- Joined: Mon Dec 21, 2020 8:43 am
Re: AS7341: Set gain of individual light channels
Probably I didn't explain myself well, this is what I meant.sj_remington wrote:Not according to the device data sheet that I have, but you can always multiply the individual channel readings by a scale factor.You can set gain separately per each channel
- kcaj
- Posts: 2
- Joined: Wed May 11, 2022 3:32 pm
Re: AS7341: Set gain of individual light channels
Thank you for the suggestion. I did reach out, and the authors confirmed that separate readings were taken with different gain settings.sj_remington wrote:
You should not hesitate to ask the authors questions, or if they will send you their code.
Please be positive and constructive with your questions and comments.