Jestersix

DIY Automated Alkalinity Tester

I haven't had a chance to do a ton with this recently, but the past two days I've gotten back into it. I need to update the info and do some more testing, but I just had my first successful test. It involved manual steps (manually stirring, manually triggering each step, ...), but it all basically worked.

My Hannah alk read at 9.0 when I tested. Doing it with my dosers + pH + acid setup I got 8.9! Hopefully it wasn't a fluke and I can reproduce success again this weekend and then have it running automatically.
 
PXL_20230404_233332911.jpg


Success!!!

I just tested my frag tank for the first time with it. I intentionally didn't test what the Hanna until afterwards to avoid biasing my test.

Result: Hanna 9.7, ReefBuff 9.8. That's certainly within range of accuracy of the test kits, so I'll consider accuracy proven. I also consider the precision proven, because yesterday I was testing a different water sample and it repeatedly gave me the exact same reading multiple times in a row. I actually added some kalk to the water sample to verify that somehow it wasn't just repeatedly giving me a bogus number, and when the kalk was added the alk reading shot up from 8 to 12.

In all, the accuracy is proven to be reasonably accurate both directionally and compared to a reference. The precision is proven to be reasonably accurate because of repeatability.

I'm suuuper stoked about this!

Here's a picture of the current hardware:
PXL_20230404_234211357.jpg


I still need to diy a stirrer versus the one I'm currently using, clean up the electronics, flesh out the software a bit more, and print a case for it, but it's overall at a state where I can test my various tanks in a hand off manner.
 
Let me know when you have your electronics finalized. I can help PCBfy it and make it a standalone device.
I ended up actually going down a different route and have effectively a single standalone PCB for it (plus a separate pH probe circuit). I realized after getting this all setup that since it's basically just 3 stepper motors + a dc motor for doing the mixing, it's the same hardware wise as a 3-axis CNC. From that I found for $25 I can get a 3-axis stepper circuit, including LCD touchscreen + 3 stepper drivers.

I'm still working on the software updates for that, but I was pretty psyched when I realized it.

At some point here I'll finalize this all and update. Been busy with work though...
 
PXL_20230508_064204325.PORTRAIT.jpg


Newer fancier hardware I've finally gotten together, including a circuit board supporting all the pumps and an LCD touchscreen. Getting the connection to the peristaltic pump's stepper motor was a much bigger pita then I was expecting. It turned out the circuit board I bought has multiple separate chips that are being coordinated together to send the signals to the motor.

That's way more complicated than the previous setup I was using, and I ended up having to do a lot of source code reading and reverse engineering to get it to work. I haven't actually tried using this to measure alk yet, but at this point it should only require plugging in some wires and I'm done.

This is pretty exciting, not just because it was a big ordeal of figuring out a bunch of tech I didn't previously understand, but also because this makes the entire thing almost completely plug and play! All the electronics are buyable from a combination of parts from robo-tank.ca + Amazon or AliExpress. I'm pretty sure the final build of one would be measured in minuters, with the most complicated part being calibrating the pH probe.

Funnily the most expensive part is the pH probe, which seems absurd. I'm going to buy a cheap one and see how well they work. Being accurate is very important, but I think the cheap ones are $20 instead of $50.
 
Last edited:
View attachment 47254

Newer fancier hardware I've finally gotten together, including a circuit board supporting all the pumps and an LCD touchscreen. Getting the connection to the peristaltic pump's stepper motor was a much bigger pita then I was expecting. It turned out the circuit board I bought has multiple separate chips that are being coordinated together to send the signals to the motor.

That's way more complicated than the previous setup I was using, and I ended up having to do a lot of source code reading and reverse engineering to get it to work. I haven't actually tried using this to measure alk yet, but at this point it should only require plugging in some wires and I'm done.

This is pretty exciting, not just because it was a big ordeal of figuring out a bunch of tech I didn't previously understand, but also because this makes the entire thing almost completely plug and play! All the electronics are buyable from a combination of parts from robo-tank.ca + Amazon or AliExpress. I'm pretty sure the final build of one would be measured in minuters, with the most complicated part being calibrating the pH probe.

Funnily the most expensive part is the pH probe, which seems absurd. I'm going to buy a cheap one and see how well they work. Being accurate is very important, but I think the cheap ones are $20 instead of $50.
Super cool! Seems like it could be a fun group buy for parts and group assembly activity for the club.
 
AJFCJaU-JaFCHdvbUQcw6hiMs1Bi1lNp32zPVFbwXTsCJxnfAZxx9FSJWEwP2tzryX3jdCM90aZjc0PW0OSTz00EtI_b6AKMew8iVkAuLqGpBjb1YMyZFW-dcJJkNn6dX7x6SQky_jCFqbn8DULqXBCQUPG9xSxUh4OSe-JOl14dbt5J6grisL3j1eJbSALhJjT_6717fnT-9O2uJu2qCV20o1EUnmwnfqdRHWciahjWF-CAqCud2Ig6t3iWqvPMYEbJ-24XgY4RWBBAVKBNOBvABUKIx1jHQ9fa-dE5m3MTZPrVYENUJvsuzFT6Yp2RbW2poA55XSffGFSp3xWyaUQYCOgh_e7LoayV-j8lhHbtq5NgQ2I8STLr7NIE5A3bbqRNi635qYfC7J3tEK4vxOWrNODjuyt-f9txPT-1pU25qTmN0OF4INOg69fahx0Gkb0u66t8UKTP-HG1dUDukwLPUrB-Y1dbs3mNLoawcAIe4uBvb4LB48OHx5YctxpkirFDmyju-tZYUi1lZbniI2U8U_IoVbt35IVItFO7AGF2SxEpHMZZRsLfsJJrbP6lEGn1hoFiWGlp7dz9LyAfHM05a_d-0S88xAi1cnqDHVJaW71DHPaZ-x0cbLp77J05W0_9xR2BXgiXfLGh7caFYO3gih7nH-sfnC6lORaN_Ckz-cNuHVDt7QwEW9ywYJbPlU1CcS-g8xV-wdi4MYJeOUr8tPKCIpJlcPd4AS8ig6JesqaWbCdzvam2FHSNqPCDpFFMVbKyZFtXVzsHb0Y6HnPFMqnNb8ST_4MktLo2ynhq0XZZp3eZaJYCJAeAl5weDF__OZ2KMBU3wM0GaR5PJ50QRsOoa2znxRhanCR97FPrwreWNzFWiGtF955rrfoUU4NHjlD6ZFX1Sz_l98d2jQ1EmKYQBAv2Y6rSEpPNF2BoQMEXrLZ_bIdTyxRAJdTy6-pc=w1728-h1296-s-no


I have V3.0 working now, including touch screen controller.


With this new board everything is a lot simpler/cleaner in terms of connections. The touchscreen also hooks up with a single table.

AJFCJaXpva44OUpWUAN4QerjQksfZ1nzVamtAtjbPlrAcnFpVzbmUcgAdfRH1x_Aw2xjRD7hPTMY0lY56id3ETlK0b-wQ9h7SDuMs4FQabI2isR4Dix5lW2V2eU6bg0A4XTQ-_qG8PmXrvPOnWmq2hrA7PYxzd3lRRuCXdtjNWCtKY1zXgHgb5n9Xi4p1LmM-RgXrxuni4NZ08czpjxUKPmXQjGaR6aVvVd9P6bOkvH4QeD3wlz8KXW0URGtRptGRx2jYXMZ_G1cN7DgQElRl3Azono12CwaVgrfJ10p8AUqkkkYtRTu8IirLVrql7ZfPV9zGSD7yqZLwSu9zlnufP7BanrdfTl2ti6f94tciAfH1N7vScTQRMNCnjwTYBa6J9wjX4Nfuq2Gmcna6oW--QtI4fNrOuvNeeZ8TI_Ab72IYgNX64LF70tny1Dko3dLD3GRQXrwBYzKhIdoiqaamtoAp_CdrdXhy9o2PiGze4zmokvDHv0LErgOhHNXk0cJbnLOLqSThu4dTvwx3HnAt_rx7Z8CNlVppoCRAj23JHdRxhT4rJVs2ch739LVAT7xqOIOpiirDqojEpFq7LV_3Ur3kHiWejC5nLKnniSVb8sZNrD8C-g10yrTtzFHv1ZxdaJc7WYEF_Ix2rTjLZONxfBwMp8OyWEWn34TaioqSz0mPeFaR95Aybg09U5EuYJ8R8ZUpe5VLwDhMfgHfG8sCnMKVDj-IZ9QNXMf7zxRCI1DmFcpiUk1r4vIpoD_Y6KGtl22-4ky_sSyO4v_OsiCjJBewW8TZ9y-h9eWNNkcs0McM7rT8OwifqpcuYwfKePAk1g6f8eCd6LHlL50y6atDkayu466m7lh4SjvmQUUAgl6dlnfK6BeTnc3VnRAu3TorvJI1k5kW50BHfTm6x6ntXyoTHDgQ7gGwUtV0dVZR5zAK_57SIB7QOnleaJM9YeRbcFu=w1728-h1296-s-no


Getting the screen working took some more reverse engineering and learning graphic/UI libraries on an embedded system (using LVGL). Luckily these days a lot of the concepts seem to get stolen from one approach (website development) and applied to all the other ones (custom embedded system UI development) so the learning curve isn't nearly as steep as it otherwise would have to be.

Hardware wise the last piece is building a stirrer instead of using a magnetic stir plate I happened to have on hand. I have the parts for building this, but last time I tried I burnt out a board. I don't have an extra on hand, so waiting for an extra to arrive from aliexpress before trying again.

Towards the actual testing quality, it's been a bit hit or miss recently. Part of the issue was I needed to tweak some of the software, since there were some timing issues making it not accurately dosing (it was missing steps because the on/off interval was too fast for pulsing the stepper motor). However I fixed that, after a copious amount of debugging.

Another issue was the pump I'm using for dosing reagent is getting bubbles in the tube. There's various ways I can fix that, but the easiest was fix it in software. I now have it dump all the HCL acid back into the container, and prime from scratch every time.

Now my plan is just do some repeated tests and see what happens. It might be that everything is stable and my pH swinging causes my alk readings to change, which might be an accurate reading.

Anyway, fun project. Hopefully in the end it is super stable and easy to reproduce another one!
 
Another minor update, I've now built two of these. It's very straightforward, outside of how annoying it is to swap connectors on the motors and having to calibrate a pH probe.

I'm going to do an end up end write up on how to set one up, and recap it over to a couple other forums where previous DIY solutions were. This one I think will be a lot easier for people to replicate, since all the parts can be ordered on Amazon or AliExpress + Robo-tank's site, and then just need to be plugged in together.

Still the most expensive part is the pH probe, which I find obnoxious.

If anyone's interested in building one, feel free to reach out. I have a handful of extra pH circuits you can use at cost, and I'll write up links to all the parts to buy.
 
The build, guessing:

1. Prep wires from the motors: between a couple minutes to for-fcking-ever depending on how good someone is with a crimper (just need to setup 4 wires * 3 motors)
2. Plug everything in: 2 minutes
3. Calibrate the probe: currently probably 10 minutes, but I can likely automate this
4. Load the software onto the device: 2 minutes
4a. Prep your computer to load the software... Really depends and I'd probably need to do it for people who aren't software engineers (takes me 0 minutes)
5. Cut tubing: 2 minutes

Guessing at that, I think if I did some initial setup someone could have it running in 10 minutes. If someone was doing it from scratch it might be a couple hours, depending on their level of tech expertise and/or my streamlining the process.

I'd be happy to coordinate a session, but I'd like to have a second user first just to ensure I'm not completely off the mark on it working.
 
The step I forgot about, and didn't incorporate into those estimates, is calibrating the pump outputs. I still don't have that optimized. I feel there's probably a trick to breaking them in. It's not the pump itself that needs breaking in (those are spot on), but I think it's the tubing. Next time I set one up I'm going to just have the pump spin for 15 minutes filling/unfilling a container.

However, with that, have double success. Two Buffs (my name for this thing), giving exactly the same reading. +- 0.1 versus my Hanna.

Buff_and_Buff_and_Bay_Area_Reefers___BAR___Bay_Area_Reefers___BAR.png


Next going to install one on the tank itself.
 
Success: I've officially hooked one of these up to my tank, and have it automatically calculating Alk 4 times a day :)
Fail: in doing so I accidentally dropped my entire unit in my sump. :eek:
Partial salvation: I have two of them, and I can replace any fried parts by just ordering them from aliexpress. Currently using my second unit. :confused:

I gave the dropped one a giant blast of electronic contact cleaner to get all the salt out, but unclear what the state will be. I imagine it'll end up partially fried but at least the expensive components are safe (eg the pH probe).

Also worst case, I'll be able to test setup from start to finish on a new one and time it.

Next steps are fix the one that went swimming, and then work on building an auto-doser tuned to the alk readings. I've already built a bunch of dosers which I have hooked up to my reef-pi, so I expect getting the basic version in place to be pretty easy. Going to to just let it adjust between two values, and have it tweak the frequency my dosers run. I'll probably switch from all-for-reef back to 2-part when doing that, to make it more controllable.

Edit: after letting everything dry out, seems like it's all working. I guess that shows the value of doing a good cleaning after electronics get water on it
 
Last edited:
Maybe a 3d printed mount to avoid future swimming expeditions
The swimming expedition was because I was trying to attach my 3d printed mount in the stand :).

To optimize space and keep things secure I mounted a piece of aluminum extrusion bar inside the stand, and put bolt holes in my case that I can use to mount it to the bar. I went to grab the bolt, let go of the device, and it tipped forward into the sump. Oops.
 
To anyone who might have electronic input (CC @thesassyindian @Prestondeeply ), I could use some advice about my magnetic stirrer. I can't get it right.

I'm running +24V to the device itself. The guts is effectively an ESP32 in a circuit with places to plug in the servo drivers and various ports exposed. The board is technically for driving a CNC machine.

The stirrer I put together as a cheap dc motor with a magnet holder attached.

To power the stirrer, I'm using the board's cnc spindle output. When I enable a port on the esp32 (let's say digitalwrite(22, HIGH) or an analog write), the spindle outputs +24V, effectively a basic dc motor driver with no PWM control.

That's way too much voltage and way too much current for the motor. It's way too fast, and would burn out.

What I'm struggling with is how to keep the motor from stalling, while also avoiding it spinning at a billion RPM.

I tried a PWM dc circuit, but if I lower the speed that motor sometimes stalls. Also if it turns off/stalls, it seems to get stuck and higher voltage/speed may not unstick it.

Is there a basic solution I'm missing to this? Maybe I bought crappy motors and need to buy a better one? Any pointers
 
To anyone who might have electronic input (CC @thesassyindian @Prestondeeply ), I could use some advice about my magnetic stirrer. I can't get it right.

I'm running +24V to the device itself. The guts is effectively an ESP32 in a circuit with places to plug in the servo drivers and various ports exposed. The board is technically for driving a CNC machine.

The stirrer I put together as a cheap dc motor with a magnet holder attached.

To power the stirrer, I'm using the board's cnc spindle output. When I enable a port on the esp32 (let's say digitalwrite(22, HIGH) or an analog write), the spindle outputs +24V, effectively a basic dc motor driver with no PWM control.

That's way too much voltage and way too much current for the motor. It's way too fast, and would burn out.

What I'm struggling with is how to keep the motor from stalling, while also avoiding it spinning at a billion RPM.

I tried a PWM dc circuit, but if I lower the speed that motor sometimes stalls. Also if it turns off/stalls, it seems to get stuck and higher voltage/speed may not unstick it.

Is there a basic solution I'm missing to this? Maybe I bought crappy motors and need to buy a better one? Any pointers

Could you attach a small gearbox to that motor to slow the output rpms?
 
To anyone who might have electronic input (CC @thesassyindian @Prestondeeply ), I could use some advice about my magnetic stirrer. I can't get it right.

I'm running +24V to the device itself. The guts is effectively an ESP32 in a circuit with places to plug in the servo drivers and various ports exposed. The board is technically for driving a CNC machine.

The stirrer I put together as a cheap dc motor with a magnet holder attached.

To power the stirrer, I'm using the board's cnc spindle output. When I enable a port on the esp32 (let's say digitalwrite(22, HIGH) or an analog write), the spindle outputs +24V, effectively a basic dc motor driver with no PWM control.

That's way too much voltage and way too much current for the motor. It's way too fast, and would burn out.

What I'm struggling with is how to keep the motor from stalling, while also avoiding it spinning at a billion RPM.

I tried a PWM dc circuit, but if I lower the speed that motor sometimes stalls. Also if it turns off/stalls, it seems to get stuck and higher voltage/speed may not unstick it.

Is there a basic solution I'm missing to this? Maybe I bought crappy motors and need to buy a better one? Any pointers
Not sure I can be too much help here, I've had limited experience and am usually using packaged PWM motor drivers. But, here are some thoughts....

If it is not a 24V motor:
A PWM will give you an average voltage by swinging from pole to pole (24V to 0V in this case). So if you want an 18V output, you spend 3/4 of your PWM time at 24V and 1/4 time at 0V to get an average of 18V. But, it sill hits 24V when moving pole to pole. So you do have to make sure the motor is OK with 24V. I know you've done some reef-pi work, you can look at the kessil light controller as it is a voltage shifted PWM design. ie, PWM is output from rpi at 5V but the kessil needs 10V PWM so the reefpi design has 1 transistor and 2 resistors (per PWM) to shift the voltage width of the PWM from 5V to 10V. So, you might need to shift yours down to 0-12V depending on the motor...this is done with the selection of the resistor values. If its a 24V motor, then you can ignore this.

For stalling, I've only had it happen once and it was a torque problem. Torque is managed by voltage and current VS the resistance of your stirrer. Maybe you are getting a high demand on the current and need a cap to satisfy the short term current spike through the stalling period (that is what I was missing in my design....power supply couldn't handle the current demand so I added a cap and it solved my problem)?

Sorry can't be more help....
 
Not sure I can be too much help here, I've had limited experience and am usually using packaged PWM motor drivers. But, here are some thoughts....

If it is not a 24V motor:
A PWM will give you an average voltage by swinging from pole to pole (24V to 0V in this case). So if you want an 18V output, you spend 3/4 of your PWM time at 24V and 1/4 time at 0V to get an average of 18V. But, it sill hits 24V when moving pole to pole. So you do have to make sure the motor is OK with 24V. I know you've done some reef-pi work, you can look at the kessil light controller as it is a voltage shifted PWM design. ie, PWM is output from rpi at 5V but the kessil needs 10V PWM so the reefpi design has 1 transistor and 2 resistors (per PWM) to shift the voltage width of the PWM from 5V to 10V. So, you might need to shift yours down to 0-12V depending on the motor...this is done with the selection of the resistor values. If its a 24V motor, then you can ignore this.

For stalling, I've only had it happen once and it was a torque problem. Torque is managed by voltage and current VS the resistance of your stirrer. Maybe you are getting a high demand on the current and need a cap to satisfy the short term current spike through the stalling period (that is what I was missing in my design....power supply couldn't handle the current demand so I added a cap and it solved my problem)?

Sorry can't be more help....
Capacitor is an interesting idea.

The full setup I have is:

24v -> step down board -> dc motor controller.

My theory was the step down board I could regulate the current and voltage, and then tune it with the controller. Honestly I didn't have a deep plan when doing that, but maybe I lucked out and it makes sense to do it that way. However it's a bunch of circuits that I don't like having to use.

Wouldn't a capacitor effectively cancel out the PWM?
 
Back
Top