Automating Pool Chlorination

After a year of dumping various sorts of chlorine into the pool, I finally got all the bits and pieces together to automate the chlorine addition process. The key element that pushed me over the hump was learning I could open a COD account at Hill Brothers Chemical to buy commercial quantities of high concentration (12.5%) bleach at a reasonable price. The 15 gallon, reusable carboy is a perfect size — enough to last about ~3 months without any packaging waste.

Industrial Bleach — the best pool chlorination method behind pure (and very dangerous) Cl2 gas

Nikon D600, ISO 5000, ƒ/3.5, 1/50sec, 42mm focal L.

The next part was the positive displacement pump to move the bleach with. I found a Watson-Marlow OEM peristaltic pump on eBay. It runs with simple 12V DC and pumps a quart in a little over 9 minutes.

Watson-Marlow Pump — Model 102FD/R for OEM applications

Nikon D600, ISO 2000, ƒ/2.8, 1/50sec, 38mm focal L.

For the design, I wanted to have a web-enabled interface to allow me to control it from any browser on my network. And, I wasn’t going to drag a network cable out to the pump equipment, thus, it needed to be WIFI enabled. The Raspberry Pi is the perfect solution: runs on linux with USB port(s) to plug a cheep wifi dongle; runs on 5V power from almost any USB phone charger; $30 including WIFI dongle.

Raspberry Pi — with a 5V regulator, and a few relays to control stuff

Nikon D600, ISO 800, ƒ/4.5, 1/50sec, 27mm focal L.

The rPi has quite few GPIO that can used as 3.3V LVTTL output signals. I put together a few relay circuits: 1 to turn on the peristaltic pump, and 1 to kick on the main pool circulation pump.

GPIO to relay

It’s all mounted into an outdoor rated box that keeps the weather out. The output of the chemical pump is plumbed into the intake side of the main pool circulation plumbing.

The final install

Nikon D600, ISO 180, ƒ/4.5, 1/50sec, 26mm focal L.

On the software side, a simple PHP web interface front-ends a MYSQL database to keep a history of all measurements made. Knowing the size of the pool, the past chlorine inputs, and the subsequent measurements taken, it’s a straightforward calculation to figure how much bleach to inject to maintain the appropriate concentration. Everyday after the sun goes down, the Pi kicks on the main circulation pump, meters out the bleach, and then circulates the water long enough to circulate it thought out the pool. Although the software can all run stand-alone on the rPi, the database and web-interface lives on my main web server.

As an added bonus, the system reminds me when it’s time to take the various measurements — as the old measurements go stale, the colored box fades to gray showing that it’s about time to retest that portion of chemistry.

If you want to attempt do duplicate this effort, I’m willing to share many more details, but, I will forewarn that the SW is a real hack that was hastily written without any mind to be easily transported to another situation.

1 comment to Automating Pool Chlorination

  • Blake


    I followed your blog and the posts in and wondered if you might be willing to share some additional details with me. I currently have an iAquaLink system to control my pool Pentair VS pump and would like to automate bleach injection from a 15 gal carboy like yours.


    1.) is this something a kook like me could pull off with no Raspberry Pi experience? I’m an engineer and enjoy tinkering with IT related projects, though I’m certainly new to working with automation of this type.
    2.) to what extent could I simply duplicate what you have done? Are you still happy with your system, or could you suggest any possible ways to improve or simplify it if you were to do it from scratch again? Maybe I could tie it into the iAqualink via a relay, but I like the idea of independent control.
    3.) I am really impressed with your web interface and mySQL database. Is that something you’d be willing to share with me?

    I have time to dedicate to this, but a general lack of knowledge in how to proceed. Realizing that time with the family is precious, I’m hesitant to even ask for your assistance. Let me know if this is something we could discuss in more detail.

    Maybe you’d be interested in a trip to our home in Hawaii for implementation :)

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>