Apparently my entire life revolves around measuring when to replace various filters.
My aquarium has an RO/DI. I already built a monitor for the RO side, but now I want to monitor the DI side. (de-ionization). The Di resin I use is a color changing resin. It's blue when brand new, and yellow when used up and dead. The resin depletes from the bottom of the cartrige up, so we can draw a line in the sand, and place a color sensor there, and detect when the cartrige needs to go.
I use a Neptune Apex aquarium controller. This controller has an IO breakout connector (din8) which is basically 6 pins of on/off state, so you can feed it relatively simple data. Since I'll use 2 of the 6 pins for my color sensors (1 for each DI cart) I still have 4 pins leftover. So I might as well throw a humidity sensor on there, as well as break out the last few pins for other use. Why not?
So I tried reprinting the brackets in white, with the IC's closer to the cartridge, and I'm still just getting the same values on both sensors.. sigh.. Not sure what is going on here.. I need to play with it more, maybe I have to put the sensor like directly on the thing to be measured? Argh.
So the PCB's showed up, and everything soldered up perfectly the first time, so that's good. Circuit works, and I was able to throw simple ESPHome code at it and make it function. All that was easy and perfect...
But then, I went to test it in the real world, and that's when things were less than ideal.
Right now I have one cartridge fully used, and one fully new. I put the sensors in the 3d-printed clips, attached, and the readings were garbage. Same on both, or close enough to same that it didn't matter. If I swapped the sensors around I just ended up with the same value over and over, or indistinguishable differences....
But this totally worked when I taped the sensors. So I tried that again just for sanity, yep, taped sensors right to the cartridge, and it works.
My next thought was that I have the sensors too far from the cart now. I have a 1cm tube the sensor shines down in the holder, and maybe that's too long, so I shortened it to about 1mm. Still no good.
Right now my current thinking is that the black PLA is messing up the readings. I would have thought black was the way to go, but maybe not. I've just re-printed in cool white PLA, going to try that and see if I get different results... here's hoping. I know this works, I just have to figure out how to mount it now.
I went ahead and ordered the PCB's. Trying something totally new this time. Rather than fully wire the whole thing up, I just decided to figure out the mechanics of it (it's a really simple circuit, lets be honest here) and then draw the diagram and order the PCB, so the first test will be with the PCB. Excited to see if this plan works.
In the meantime, I still needed brackets to attach the sensors to the DI cartridges, and ideally ones that block ambient light. So I did some quick measurements of my BRS dual DI setup, and made little rings that slip onto the cart with a friction fit, and then position the sensor against it. Did a test print, fitted the sensor in, got the alignment just right on the first try, and it seems to hold well.
Printing two in black right now.. Now I'm exited for all the bits to arrive!
So really quickly, needed to find out if this would even fly as an idea. Wired a TCS34725 up to an ESP32, and an OLED, and taped the sensor to the cartridge at different points. I have a one that is nearly depleted, so it's an easy test. I think it works more or less...
I can see a difference in the RGB channels at various points. The definitely dead side is different than the brand new one. Mind you, just taping the thing on isn't great, because there is no shielding of light. I'm curious if the fact that the container is clear will mess up the readings significantly. My idea is a strap 3d printed that will slide on, and try to shield ambient light as much as possible. Probably needs to be printed in black, and have some extra width to provide more cover.
For the other sensors, my thought is a BMP280, to gather humidity. Because the IO breakout on the neptune is just on/off, the best I can do here is either a high/low, or maybe if I eat 2 pins, I can do 2 bits of precision. Like 20% == 0/0 40% == 1/0 60% == 0/1 80% == 1/1. I might change that up, maybe range from 30-80 or something... But then you could code reactions at different levels, like if it's 1/1, then alarm, because it's stupidly humid in your fish room.
Because the Apex needs simple switched inputs, I'm using a relay board with the normally closed side to provide the switching on the color sense, and the humidity. Basically I'm thinking open for resin OK, closed for replace.
I think the only way to really do this is to print the mount and test for real. I think I'll do some more quick tests, and then design a circuit, and order a PCB. I refuse to jumperwire ever again.