Determine the chemical properties of your swimming pool automatically, while keeping you in the loop

Similar projects worth following
The PoolButler will determine various chemical properties of any body of water on a schedule by titration and spectrophotometry. The results will be communicated to a base station and might push it to an Android app later on.

The optic cell will be flushed with pool water and then a sample will be taken roughly 15cm below the surface with a small dosing pump. Even smaller dosing pumps will be used to add the required chemicals and titrate the solution drop-wise. I believe a pump per chemical will be more economical than trying to use solenoids and having to flush the chemical lines every time.

For the spectrometry I will be using a low power red laser diode and a photo diode. Measurements will be taken of the clean sample water to establish a base line before every test. Then as soon as the titrant is being added, values will be taken after every drop, until a colour change is noticed. In case of tests where colour should be read, an approximation should be able with a red laser alone as most colour changes should be able to be seen in red light. If I do struggle I will add other colour lasers as well, or try LED's

Taking measurements still means nothing if I have to go take the unit out of the pool every day. So I will use a 315MHz transmitter to send the data out after every measurement. An ATmega will run the show, turning the pumps on as needed to flush, rinse, sample and titrate. For now communication will only be one way, so the ATmega will be programmed to take measurements at certain intervals. Certain tests needs to be done daily, others weekly and the Chlorine level should be taken right before you swim preferably to determine if it is in a safe range for kids. Later better tranceivers can be used to incorporate a polling option.

The base unit will use a 315Mhz receiver and an ATmega. It will constantly show the property levels. 3 LED's can be used to indcate if you have to increase a property, decrease it, or if it is in range. A small OLED display may be added later to show the exact values of the properties, as well as the correct amount of chemical to add for your pool size.

Maybe I can add larger dosing pumps on the side of the pool to dose with bleach, bicarb and acid to correct the major properties automatically on a daily basis. Now that would make a care free pool that only needs to be baby proofed.

  • 3 × Micropump One per chemical and one for sample/flushing
  • 2 × ATmega328p Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 1 × 315MHz RF pair To connect Pool unit to Base unit
  • 1 × L293DNE Quad half H-bridge with protection diodes
  • 1 × 74HC04 Electronic Components / Misc. Electronic Components

View all 9 components

  • Dosing Pumps

    DigiGram09/14/2014 at 08:36 0 comments

    The project halted for a bit, but only because I won an extra week working offshore, so have not been able to work on the actual hardware yet.

    At the moment I'm trying to decide between two viable candidates for measuring and adding the drops of chemicals to the optic cell. It's hard working only from limited internet research since I can't physically power up a pump to see how finely I can control the flow rate etc. Hopefully next week that will change.

    At first I imagined a peristaltic pump with a PWM controller, enabling low flow rates. The idea is to have one end of the piping in a container with the chemical, and the other end right above the optic cell. A needle or other orifice can be used to try and control the drop size, while a [laser, red LED or IR LED] and [photo diode / photo resistor / photo transistor] detects and counts the falling drops. As soon as the drop falls, the pump reverses a tiny bit to stop rouge drops from falling too. 

    In concept this sounds good, and thus I've started on the code for that, but then I realised that there is a good chance that controlling the pump at such low volumes might be hard (we are talking about dispensing 50 microliters here). This will be my first option to try, since you can leave a large storage container full of chemical onboard, so you only need to replenish the fluid bi-monthly or so.

    If this fails, I'm thinking of building a small scale syringe pump with the same drop sensing circuit as above. Maybe utilising a 10ml syringe. This will require you to replenish the chemical more often, and will make for slightly more difficulty accessing the chemical storage (take out the syringe, draw up 10ml and put it back in). Okay, a 10ml syringe will still hold enough chemical for a month (40 days, minus 10 for safety). Larger syringes will use more space in the final product, but also will reduce the accuracy of the drop measurements, since a 30ml syringe and a 10ml syringe vary greatly in girth, but only slightly in length. Thus the same linear movement translate to a large difference in dispensed amount. 

    Another plus side for using syringes, is that I'll be able to add a switch to notify the controller when the syringe is almost empty, enabling it to let you know. Still thinking of a way to do this with the peristaltic pump option, save for just sensing no more drops falling out of the needle.

    Any comments or recommendations will be appreciated!

  • Pump Control

    DigiGram08/21/2014 at 08:38 2 comments

    Doing titrations require precise pump control. In the lab we use expensive micro syringes attached to overpriced servo's for fine control, but I think that is not necessary here. All I need is to be able to deliver drops. I'm ordering a few cheap low volume micro pumps to see what kind of control I can get out of them, but I'm hoping drop wise application will be possible. Even if it takes some time, I don't care, as the PoolButler can take it's time doing tests, as long as you get results once a day.

    The pumps I selected required 800mA to deliver 200 ml/min, or 3.33 ml/s. This is way more than I need, so I will be using PWM with a very low duty cycle to hopefully get fine control. This is a stab in the dark, but I think it is worth a try.

    For the H-bridge I decided on the L293D. Yes, I am aware that the max current should be limited to 600mA but I'm certain that a low duty cycle will keep me in spec, and if it does go over, should still be fine. I'm designing the boards to enable efficient active cooling should it be needed.

    To save on the amount of pins needed on the MCU, I went with a 7404 inverter chip to disable the reverse windings when forward is enabled, or vice versa. Both motors driven by one L293D will be fed with the same direction control line, as I will never run both pumps simultaneously in this application. The PCB does have an option to easily incorporate a second line if you need though. I'll be using a full hex inverter per dual H-bridge just to minimize extra wiring and make future additions simpler.

    At first I wanted to make a larger board with enough H-bridges to control all pumps necessary, but then decided to rather go with smaller modular boards for a few reasons:

    • To eliminate the need for via's
    • To simplify the PCB design
    • To make production more cost effective as it is cheaper to produce multiple small boards than one larger one. Also, many pcb houses sell boards in multiples of 3, so then I'll waste less boards.
    • To help aid in cooling

    I have no idea if the H-Bridge will heat up much, so I will design it with some passive cooling and in such a way to enable active cooling easily. If it is not needed, then nothing is lost. The boards will include a copper pad on each side of the L239D soldered to the GND pins as suggested in the Application Notes. The modular boards will sit stacked perpendicular to the main board on 90 degree male headers. The pads on each board is placed in such a way that if a small brush-less fan is applied to one side of the stack, nothing will block the air flow over them.

    The board will have 6 inputs and 4 outputs. The inputs will be (on 90 degree male header pins) Vcc (supply voltage for the two chips), Vm (motor supply voltage), GND, PWM1/2 (PWM control line for each of the two motors) and SEL (which is the directional selector). The outputs will be screw in terminals for the two motors.

    That's it for now. I got so confused laying out the board, that I gained new respect for people doing this for larger projects. I mean, this is a VERY simple board. I'll appreciate any feedback as I normally stop my builds at bread-board level.

    Happy Head-scratching

  • Detector

    DigiGram08/20/2014 at 13:46 0 comments

    I've been playing with the idea for a detector based on colorimetry for a few years now. Using RGB led's and a LDR It works okay on hard surfaces, but measuring liquid colours has proven troublesome for me.

    After some soul searching and thinking back to ways we used spectrometry in the lab, I realised that I should be able to measure obscuration (how much of a beam is "lost" in the medium) as that should increase/decrease depending on the colour and/or colour intensity of the medium. So in theory, if I send a red laser beam through an orange medium I should get reasonable amount of light on the other side. If the medium changes colour to bright red, I should be getting more light on the other side. (side note, I'm reasoning that a red fluid absorbs all other colour light and lets only red pass, if I'm somehow confusing the physics here, the results will be exactly opposite, but still usable.)

    So, how to measure this obscuration? I decided to go with a red laser diode (based on the price, nothing else thus far, will conduct experiments later to establish if it was a good choice). On the detector side I can use a photo diode, photo transistor, photo resistor or a LED. It seems like using a red LED will focus more on the red wavelengths that pass through, which (in my mind) is beneficial to me, but again, I'll use different sensors to see what works best for this specific application. I do not really need speed as I'll do the tests slowly to give some mixing time, as well as cooling time for the pump-motor drivers.

    So that brings me to a highly premature circuit board for the application. Note that the laser diode is represented by a LED and that the space between the diode and LED is roughly 2cm for the optic cell. The header pins will be used to interface with the main board where V (Vcc), Do (Data out), G (GND) and Di (Data in) will connect to the ATmega. Note that Vcc will be unregulated.

    As with any project that is done without physical trials, I know something, somewhere will not work, but that is part of the fun.

    Happy Detecting

  • Titrating by Spectrophotometry

    DigiGram08/19/2014 at 06:09 0 comments

    Titration, for those non-chemists out there, is the process of adding a chemical to a solution until an equilibrium is achieved. The important parts here is to measure the amount of chemical you add accurately, and noticing the end point (or equilibrium point) correctly. In my career it is easy to measure the amount you add accurately, but our end points is measured either at a certain pH, or with a very slight colour change.

    Fortunately the colour change in swimming pool liquid testing kits are much more evident. The process I'm contemplating so far involves as red laser diode shining through the optic cell towards the photo-diode. The photo-diode will measure the basic obscurance at 635 nm. I expect the obscurance to change slightly during titrant addition, but once a colour change occurs, I expect a much more significant change.

    If it does not work as expected, I will try ultra-violet laser beams, as we have used that in the lab for a similiar application. Allthough I'm sure this will not be accurate enough for lab quality titrations, this should be more than enough to get as accurate result as pool testing kits allow.

    I can't wait to go home and test this theory, but sadly you all will have to wait another 3 weeks before I can go home. Will keep you updated though.

    Happy Waiting

  • Why I chose 315MHz, AVR and Arduino Language

    DigiGram08/19/2014 at 05:43 0 comments

    Two of these three decisions can be heavily debated. Well, PIC fanboys might debate my AVR decision as well, but for me the decision was easy.

    Do I have a PICKIT? No.

    Have I programmed a PIC before? No.

    Do I have a USBtinyASP? Yes.

    Have I programmed an AVR? Yes.

    So with that an AVR is chosen. Next logical question should be the language to use on it. I would like to learn C well enough to use on mcu's, but for now, the one I feel most comfortable with is the Arduino Language. Sorry haters. If you do recreate my project, feel free to use whatever mcu and language you want. If you want to port it to better C code for the AVR I'm using, feel free to push it to my Github repo for others to use.

    Then lastly, the cheap 315MHz one-way communication radio I'll be using. Yes, 40% of the reason I'm using it is because it is cheap, 50% of the reason is I have a pair in my drawer and 10% because I have used it before. I will however replace it later on with something better to have two-way comms and possibly a mesh network should you want to monitor a hot-tub as well, but for now, a virtual wire link over 315MHz will do nicely. I have received pretty good distances with these units as well (around 45m) so it will be more than enough to mount the base station inside the living room (only a window and 10-20m between PoolButler and base station).

    So that's the reason behind my decisions. Love it, hate it, get over it.

    Happy Accepting

  • Why open source it

    DigiGram08/19/2014 at 05:05 0 comments

    I've seen a few discussions over the years regarding the potential for someone to steal your idea if you open the sources to it. (One such discussion was held on HaD last night actually). I can understand the issue if you want to coin from your project. If you are developing code or hardware for an industry, lets say a gamma ray carbon dust detector to be used in mines, then I agree that it might be safer towards your pocket to keep the sources for yourself.

    But for 99.9% of my designs, including the PoolButler, I rather want to develop something that no one has to steal to recreate, but rather just open the HaD project site, go to Github, do some reading and recreate (and potentially improve) my project. My project will however carry GPLv3 as I do not wish for someone else to "steal" my project for commercial purpouses. If you do however want to produce kits to sell to those that cannot program AVR's, do not have access to laser cutters and can not wield a soldering iron, please contact me first. I'm okay with someone selling kits if the price only includes the raw material and the work you put into it, not any other bloat for "your idea".

    So expect open designs being posted in the next couple of weeks :D

    Happy Copying

  • Unique Challenges

    DigiGram08/18/2014 at 19:30 0 comments

    After I get the idea set for a project like this, I like to scavenge for parts or order some so I can start testing the various parts out before I start designing circuits and programs. I think it's a good way to go, as you get a feel for unfamilliar equipment before you cement it in place and find out you have not made enough allowance for it.

    That is normally. This time however I start the concept while stuck on an oil drilling rig for a month. So this time I will start with circuit boards in Fritzing and basic modelling in FreeCAD. Hopefully I can get enough literature to base decisions for pumps on. And all the while I have internet so slow, I can't even load a speedtest. So this may add a major challenge in submitting my video and logs, as well as in getting literature.

    Another challenge I face with this project, is camera's are only permitted inside the rooms, and here people are sleeping in shifts, so recording the audio track of the video will be hard. I blame procrastination!

    Onto the normal kind of challenges faced in a project. Shops selling robotics or less-than-general electronics are kind of expensive in South Africa, so sourcing the dosing pumps at a decent price will be interesting. I'll keep my eyes open on electronics that may contain these pumps though, but otherwise I will just have to go ahead and order some from China.

    Driving the pumps will be down to H-bridges to provide bi-directional drive. Charging the LiPo is basic so I'm not worried about that. Getting the whole concoction to float might be interesting. Might laser cut some pieces to keep everything in place and dry. Oh keeping the dry bits dry.... That might be the biggest challenge. For now I think there is enough physical separation, but as these things go, it changes over time, and before I know it, my laser diode swims with me...

    Then the biggest challenge of them all. Sitting still for long enough to get some work done.

    Happy Hacking

View all 7 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates