Couldn't you send synthetic color codes to the backend to have it interpret the result and doing so repeatedly with different shades and colors eventually build the database of it? I know their systems were sort of whacky too, so I agree, might not be best to mimic what they do have....
Another way would be to know the color ranges of each test (and I think this is how they did it) and then apply a reading based on where it lands between them. So for example, use known values/calibration fluids for those tests (cheaper, usually) and send those up to see what the result is - if you know the range you can interpolate the inbetween.
**Sorry this turned into a wall of text**
I could, but the issue is not so much getting it to determine and assign it to a setpoint color or find the endpoint. It's more of how does it look from the RGB sensor. Theoretically, it should be the same, but I don't want to risk an inconsistency. I will be doing something similar, but with rodi and food coloring.
To help combat errors (bot or reagent) I am going to add in a "Calibration" for each reagent. (myself,
@BeanAnimal and a couple others asked for from RK)
So if you count and see it is saying drop 25, but you think is actually drop 27 that is the end point and the bot is constantly missing the mark you will be able to +2 and it will automatically make the correction for you going forward. This will also work for a reagent issues, so if the bot is hitting the right color, but manual tests are saying it is off, then you can make the adjustment too.
Tonight was the first attempt with a color match, and it was a off because raw colors and brightness. So, an adjustment was made to match hue instead of raw color and ignore brightness. Will need more test to verify it works better. The API Cal which is a titration test uses the RGB values to determine when certain channels hit certain points. Current API Cal calibration is for the blue channel to pass the red by more than 5 points. Before the reagent got old and stale, I was within 1 or maybe 2 points of my Hanna tester on multiple tests.
What I'm going to attempt for every color card I have, high-quality images I can find on the internet, or any people can scan and provide I will use food dye to make color samples that match the colors for values or end points. Have Claude take the cards to create interpretations and bounce them off the dyes to see how RGB vs our perceived colors line up. If they do, then I might be able to use good color card scans to fill up the interpreter. In theory this should at least get it pretty close, as long as my colors match the cards colors.
I have been able to decipher almost the whole test sequence now. So I can see as to what each command in the full test sequence does and what the modifiers control. Since the source for the Arduino isn't out there, it could potentially lead to streamlining tests, creating more, etc. API Nitrate does waste 0.2ml of reagent EVERY test. it pulls 0.3 from A and 0.5 from B, drops 0.3 in the test chamber of both, then flushes 0.2ml down the RO chamber during the rinse. Not sure if there was a reason, but I'm not sure what it would be.
For example,
#,50,5 = a 5.0 s wait, so #,50 counts in seconds.
#,4,X = rinse of the large syringe (X=1 for dosing syringe, X=2 for large syringe)
#,9,5000 = draw 5ml(5000 value) in large syringe
#,38, 300 = draw 0.3ml (300 value) in dosing syringe.
I used this and made small "tests" as single commands just fail to execute.
From this page I can add a sample, get multiple RGB reads to ensure consistency. Then drain and rinse the test chamber a few times, add new color and repeat. In the above picture I had API Cal running again so part of the traffic was captured when I took the picture. It shows all the messages and will take any colors and put them on the bar below it. Can mouse over to see RGB and what "drop" number it is. So, you can follow all the serial traffic between the Pi (yellow) and Arduino (green) in real time. Used this a lot during the beginning development stages when trying to get the two to talk after cutting the cloud out.
What I made for people who want to help but can't help with the coding side is once a test is run there is a label icon.
That has cards that look like this. The person can submit tests and label what they see. So with the API Calcium I select the transition color as I would call see it. They can add manual results and a note for any import info. This could give me multiple data points to help establish accuracy.
The Nitrate card shows the color the bot got (old API reagent ignore the results), then you pick which you feel is closest representation. For color match cards, the manual test results will be vital to helping ensure the bot will interpret the colors correctly. For this the colors follow a "path" from yellow to red. Some transition tests like Alk don't, like when it transitions from dark green to light blue.
I have some test kits coming. Once I get them working consistently, I am going to clean up the file structure, and then open Repo up for people to hopefully test and submit more data points.