AS7341 Project Future Enhancements

With my AS7341+ESP32 assembly all tidied up, alongside my web app project for interacting with them, I think this is a good point to declare version 1.0 complete and move on to something else. Naturally I have more ideas, but today I’m just going to write them down as ideas for later.

Color Accuracy

The most obvious point of improvement is a better translation from detected wavelengths to human-perceived color. I think this would require at least a few days of study (possibly more) before I can be conversant in the topic and maybe understand that Python code sample I found.

Beyond the theoretical math, there are hardware component to better color: the AS7341 has many additional capabilities that I have not used in my little exploratory app. While the eight sensors for specific wavelengths get the attention, the other sensors weren’t there just for fun. They also have a role in color accuracy as per AS7341 application node on color calibration. Those channels provide information on various distortions that may be affecting those eight wavelength sensors.

The clear channel shows the sensor response without a color filter, and the NIR channel shows raw silicon sensor response without even an infrared filter. When any of these sensors return a strong reading, that means enough of their respective types of light are likely “bleeding” into the other color sensors. Flicker detection is likewise also involved because flickering light patterns would impact sensor readings. All of these factors should need to be compensated before feeding into color space conversion.

Temperature Compensation

I haven’t used AS7341’s temperature compensation feature beyond its default behavior of running once upon powerup. Ambient temperature changes would affect sensor behavior, which is true of all sensors. Or to paraphrase what I’ve heard from veteran embedded engineer Elicia White: “Every sensor is a temperature sensor. Some even sense other things.”

Auto Gain Control

A little tangential to the topic of color accuracy, this sensor seems to have some sort of auto gain control to ensure sensors get a good range of values without going too far into saturation. Ideally, I can add an “Auto Gain” checkbox to my app and let the sensor take care of gain control automatically, but that isn’t as easy as it looked at first glance. This feature was not exposed in the Adafruit library and my effort to explore it with twi_nonblock API produced behavior I didn’t understand.

Web App Evolution

Orthogonal to anything I might do to improve AS7341 performance, I might choose to evolve just the web app itself. This first version was written directly in HTML/CSS/JavaScript, the only library I used was Chart.js to plot the bar graph. This process is fine for a simple app but will get more cumbersome for larger projects. So even though this app is fine for its scale, I might use it as “Hello World” exploration of tools that help manage larger projects. Like learning how to use NPM to manage dependencies like Chart.js. Or using TypeScript to tame some of JavaScript’s wild and annoying sides. Or convert it to use an application framework like Angular. That would be sheer overkill for such a small app, but I have big web app project ideas and I need someplace small to start learning.

ESP32 Evolution

Or I might focus on the ESP32 side of things. Top of the list here is using it as a learning project for ESPAsyncWebServer, which has more of the features I might want over the current basic WebServer implementation. Before that, though, I’ll probably switch over to using PlatformIO so I can upload HTML/CSS/JavaScript files to SPIFFS and serve from there, instead of the current unnecessarily cumbersome process of converting them over to hex values in a header file.

Platform Migration

Or a future path would not involve the web app at all. It’s totally possible for a future project idea to be done entirely onboard the ESP32, porting my browser-side JavaScript code to C on the ESP32. It all depends on what motivates me to create enhancements in the future.

Which may be triggered by something like discovering information I had mistakenly overlooked.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s