The output from AS7343 (Qwiic) multispectral photosensor is capped at 999 max. intensity for each channel, but the ADC output should be full 16-bit range. What is causing the photosensor to limit the output to 999? This resolution is very low for my application.
I checked it with AMS AS7343 EvalSw ALS GUI and the number go up to full range 65535.
Option 1 — Read raw ADC registers directly. Bypass the “intensity” helper functions and read:
CH0_DATA_L / CH0_DATA_H
CH1_DATA_L / CH1_DATA_H
These are true 16-bit values.
This gives you the full resolution w/o a cap
Option 2 — Modify Library.
The library is deliberately clipping the raw data to 999 before it hands the data off where the clamp is applied (sfDevAS7343.cpp, every channel access)
uint16_t sfDevAS7343::getChannelData(sfe_as7343_channel_t channel)
{
if (channel >= ksfAS7343NumChannels) return 0;
uint16_t raw = _data[channel].word; // 0 … 65 535
/* ---------- artificial ceiling ---------- */
if (raw > 999) raw = 999;
/* --------------------------------------- */
return raw;
}
The same clamp is present in the convenience wrappers getRed(), getGreen(), getBlue() and getNIR() because they all call getChannelData().
STEPS
Download the library sources locally.
Open sfDevAS7343.cpp, locate getChannelData() and delete the two lines that enforce the 999 limit.
Re-compile / re-install the library.
After the change the same function will return the raw 0 … 65 535 counts and you will see the same numbers the AMS evaluation GUI produces.
(You may then have to lower the LED current or reduce AGAIN so that the signal does not saturate when you expose the sensor to bright light.)
If you do not want to patch the library you can also read the registers yourself: