Day 20, Never Again

During the period over the last year when I had considerably less time to monitor the aquarium, the RO got out of hand, and caused a problem.

Basically, I have nitrates in my tap water.  High nitrates.  I rely on the RO to filter all the garbage out of the water, and then the DI to filter the nitrates out.  Somewhere along the line, my RO membrane failed.  My RO runs on a timer, and feeds into an ATO reservoir, where my ATO then feeds it to the tank.  Because it runs on a timer, I don't stand in front of the unit while it's operating, and therefore the little TDS meter on the unit is basically useless, because I'd have to be standing there at 3AM when it refills to check the numbers.  Same with the pressure gauge, it's always at 0 when I'm awake.  None of this is useful in catching this problem.

This caused the tank to get overrun with cyano.  I was at a total loss, as I've previously mentioned as to what was happening, and didn't figure out for a long time that the RO had gone nuts.  Having fixed the RO, sure, now it's clearing up.  But this shouldn't happen.  We have the technology.  I own a soldering iron.  I am crazy.

20210103_090629

That my friends, is an ESP32, hooked up to a bunch of TDS sensors, a flow sensor, and a pressure sensor.  This was my prototype.  It took around 3 days to develop, and integrates with Home Assistant.  This lets me track and graph TDS, pressure, and flow over time.  I can also store a historical record of all these numbers, and go back and look at them whenever I want.  I can also set alarms to email me when the values are out of whack.  So I needed to move this off a proto-board, and onto a real circuit...

20210103_160903

Printed a nice little box for it too.   The TDS sensors are about $14 each off Amazon.  The flow sensor was about $10, and the pressure sensor was $20.  Total cost to build this was around $90.  I even made a schematic for it:

I spend about 6-7 hours dipping the TDS probes in different cups of water to test the TDS, and lots of mucking about with a pressure gauge to check the pressure sensor, and about an hour playing with various containers to calibrate the flow sensor.  After all that, it totally works.  I want to build 2 more for the other 2 RO units in my house, but it was a total pain to solder this, so I generated a PCB and ordered myself 10 from JLCPCB.  Should arrive in 2 weeks, I'm pretty excited to see if my first PCB design actually works!

But now the thing to do is to hook it up to the big aquarium.  First, I don't have any free outlets on that side, so I needed to move some permanently-on things to a power strip.

20210104_090250

As a bonus, this power strip has a built-in USB power jack, so I can plug the ESP directly into that and not even have to waste an outlet. I moved my Clarisea and my ATO power warts over to the strip, and then plugged the strip into the Apex, just so I have power usage for it.

Then I just needed to mount my pretty little box to the wall..

20210104_093816

And a close-up of the display:

Oooh, pretty..  The flow sensor is attached to the feed side, so I'm also measuring total gallons that have pumped through the filters.  Now I can know how many gallons I'm running through each filter, to better help me know when to replace it.  The pressure sensor tells me when the prefilter is starting to give out, and the TDS meters do their job just fine.  Only problem is that these sensors are not temperature compensated, like the ones on the manual unit, so I had to measure the temperature of my tap water, and throw it into the code for temperature compensation.  It seems to work fine though, the values I'm getting are consistent with the manual unit.  The pressure sensor is really accurate at higher pressure, above 20psi.  The zero-pressure however, is kinda flaky.  Between 0 and 5 psi, it just kinda randomly fluctuates, so it's really only good for monitoring the high pressure during production, but that is all I need it for, so, it works great.

For the code, I'm using ESPHome to program it, which makes the code super simple, and directly integrates with home assistant.  The code for this unit is up on my github page.

So what does this give me?

A pretty display with lots and lots of graphs so I can always know the state of this critical component of my aquarium, and never be caught off-guard again when it starts to fail.

The graphs above show production over the course of about 30 minutes.  I emptied out about a gallon from my ATO res, and set the timer to run for 30 minutes.  I'll need to write some alarms for this, for now I just have it gathering data.  I'd like to have a few days of data before I write any email alarms for it, just so I understand the values coming out of it.

I'm excited to see how the PCB's turn out.  Hopefully with those I can slap 2 more units together quickly and have the rest of my water monitored!

I have another huge project underway in the tank, but that one has hit a few small snags, and is taking much much longer than I had wanted, so for now, I lay my head to sleep, and dream of pretty graphs of TDS....

Posted on