Reagent Robot

Automate the Reagent (take a sample, put a drop of stuff in, shake, look at the color) testing of water for Aquaponics, Ponds, Aquariums.

Similar projects worth following
The idea here is to remove human variability and provide for automated data collection with low cost chemical reagent tests for common water conditions such as Ammonia, Chlorine, Nitrate/Nitrite, and pH. Currently, the electronic sensors for those test are very, very expensive and require frequent replacement.

This shows a possible design for the reaction chamber where the chemical indicator is added to the sample water and LED/photodetector combination is used to test the color of the resulting mixture. This design is not meant to be a final product, but instead just a starting point.

Not sure why I never linked to this video... it does a pretty good job of explaining the basic idea.


Including to ensure every single thing I have on this is shared. Just a very basic framework for running the device. E.g. it does all the IO necessary via the Arduino UNO and slightly modified BOB PCB from It needs to be modified to read a colorimeter and send results back to the PC.

ino - 5.47 kB - 09/05/2018 at 16:16


View all 11 components

  • Injecting, Need to Colorometering

    James Newton02/09/2016 at 01:14 1 comment

    Haven't touched this in a while... honestly, I think it's because I had a really bad experience at an event where I was showing it (as well as doing a workshop) where the organizers had a rock band inside the worst building for sound reflection ever... Our ears were ringing and that means hearing loss. The lead guy was nowhere to be found and none of the people he left in charge was willing or able to pull the plug on them or turn them down. And no amount of screaming, yelling, or trying to unplug them physically would stop it. They played the full set at full volume and I had to pack up and leave. Kids in there were injured, but no one cares about hearing so forget about reporting it or owning up. When I tried to express my shock and outrage after the event, I was censured (probably appropriate, I posted publically when I could have done it privately) and banned from future events (possibly appropriate, sad) and my friends, who I was NOT exhibiting with, were also threatened with a ban (VERY inappropriate). That seems to have lifted as he cooled off. So my upset and hurt feelings over that transferred to this project and have made me want to leave it alone. That sort of thing ever happen to you? I'm ready now to get back into it.


    So the injector is working fine, I used an LM317 with resistors to give 6 volts for accurate power supply and max strength to the servo. It /seems/ to be very consistent in it's movements but I'm not sure it will be accurate enough.

    If I were starting again on this project (and I'm sure I will end up doing so after I find out all the things I've done wrong in testing) then I would use a stepper with two shafts (either end) and the top would run the injector while the bottom shaft runs the wiper / stirrer. Just crashing forward for now.

    I need to get my butt in gear on the colorimeter and then get it hooked up to water and see what's wrong / how badly it works so I can take notes, document, then scrap the current version and start over.

    Colorimeters don't seem that hard, I just need to wire up the circuit and add some code to the Arduino to run my light source and read the frequency back from the

    I have some TLS235R and TLS237's and I'm following the basic instructions from

    but they use TLS128's... not sure why I didn't get those... must have been a reason. Just need to make up a header to plug the sensor into and then wire that cable to the Arduino... then I'll probably just tape the sensor to the outside of the reaction chamber.

    I have an Adafruit Neopixel or two which I'll probably start with, but I may need a more accurate light source... we will see. LED's are cheap. I'm hoping I can measure all the colors with the one Neopixel instead of having to wire up multiple LED's. Again, cable, tape to chamber.

    Should probably seal the cables with silicone / heat shrink because they will almost certainly get wet.

    A client wants to measure multiple frequencies for a separate project so I'll probably start with:
    and see if it works. Should be well in the frequency range at less than 10KHz.

    If anyone has experience with any of this... or even just read it... please let me know.

  • Servo Injection Pump

    James Newton11/23/2015 at 00:57 1 comment

    Finally figured out a way to mount the servo to the syringe... I used solid core wire wrapped around the syringe and the servo. :yike: "Get'r done"

    And I built a link from the servo horn to the plunger out of a paperclip. The link is actually pretty good, but the plunger bends badly up and down. I may need to move to a more expensive glass syringe just to avoid the bending. e.g.

    I'd post pictures but... I have some pride left. ,o)

    And then I went to wire the servo up and realized I don't have any source of 6 volt power. :facepalm:

    I'm wondering if the servo will fry if I connect it to the 12 volt supply I'm using for the stepper motor and solenoid. No specs on the Adafruit site for max voltage.

    I could also use the LM317 regulator option on my BOB PCB to produce 6Vs with a 240 and a 910 ohm resistor set in R6/R7 then cut the trace between C5 and VCC on the Arduino connector to isolate the supply, and pick off the resulting 6 volts at R5 (top pad) but 1. I'd love to avoid populating all that (and C4-6... C4 is huge) and 2. I'm not sure how much current that servo draws. Dropping 6 volts (from 12 to 6) the LM317 should be good up to an amp or so ( I think ) so is that enough? Enquiring minds...

    So I've posted a request for more data on the servo at:

    Hopefully will get some guidance soon... I'm supposed to show this thing working at STEAM Fest on the 5th:

  • Pumped!

    James Newton09/14/2015 at 20:05 0 comments

    We have an injector pump! (mostly) I'm just looking for a better (easier to move, smaller) syringe with a luer lock output. And I got the correct parts due to sheer dumb luck, and then found out what they are after the fact. LOL.

    Turns out these do all the valving work we need. We don't need two valves and a T, the one part does everything.

    Part No.: 79004
    Qosina Medical HPLC Dual Check Valve, 3 PSI CP, Male Luer Lock with Swivel Nut Outlet Port, Female Luer Lock Inlet Port and Female Luer Lock Control Port

    Cost should be less than a dollar each, but the trick is finding a source that will sell in low quantities. You can easily find a case of several hundred, but never 1. I got lucky with an eBay listing, which wasn't for this, but this is what was delivered. Can you believe it? The universe loves me. LOL.

    The funniest part is that the add that I purchased from popped up while I was composing an email to a friend about how little luck I was having in finding the needed part... right there on the screen... as I was composing the email... (!!!) Can you believe that? So I ordered it, didn't get the part they advertised (which I thought I needed) but did send me /this/ part, which is exactly what I actually needed!

    The injection tip is an 18 gauge 90' curved blunt tip for Luer lock syringes. Those are more commonly available. Again, I found these on eBay.

    Now I just need to amend the code to run the servo, and mount it and the wire to connect it to the syringe.

  • Slowly gathering the injector parts.

    James Newton09/10/2015 at 00:19 0 comments

    It's STUNNINGLY hard to find medical supplies at other than insane volumes. For example:

    $216... for 100 of them...

    I need 2. So my cost would be under $5... if I could buy them in singles. I looked for HOURS... actually probably DAYS when you put all the hours together. And I finally found:

    which are now on the way. I have a line on a syringe that moves easily and some right angle blunt needles from a new friend at a local hackerspace:

    So that just leaves a female luer T-Fitting to put it all together. I'd forgotten that in the last update. I found these:

    but I'll be damned if I can buy them. They apparently only sell to resellers.


  • Help! Is there a doctor (nurse, med tech, etc...) in the House?

    James Newton07/29/2015 at 16:07 0 comments

    Folks, I need help. Does anyone have access to, or know how to access, basic medical supplies in small quantities? Everything I can find is a box of 20 when I need ONE! If I buy a huge box of each part, the price gets crazy fast, and without being able to play with the parts, I don't know if what I order will actually work.

    Specifically, I'm building the injector pump for the reagent, and I've found designs that look pretty good using a servo to open and close a syringe, which would be hooked to a reservoir with two one way valves. The medical community calls them "back flow preventers" and they connect together with something call "luer loks". Also, there are curved hypodermic needles that would be perfect to deliver the reagent to the reaction chamber.

    I need:

    • 1 small syringe that moves easily,
    • 2 back flow valves, one between the reservoir and the syringe, one between the syringe and the needle.
    • 1 curved needle of a very large bore, and
    • some means of connecting all that together and to the reservoir. I assume if they are all luer lok parts, they will all hook to each other already.

    Here is a link to a very basic version (no reservoir or valves or needle) of the injector design I've selected:


  • Sample intake valve working, Power, Electronics Mounted

    James Newton06/20/2015 at 01:16 0 comments

    So by skipping out on some work I was supposed to do and continuing to ignore a client who really needs me, I was able to find the time and energy to make a little progress.

    1. Sample Intake Valve. The BOB board I'm using has space for a relay driver (originally for spindle power) which is setup in such a way that it can use Vcc (for a little 5v relay) or use an external power source for a larger relay or, in this case, the Adafruit water solenoid valve. The circuit can use different power sources, because it's designed to just ground one pin, rather than connect a pin to power. So one terminal, J7 is NOT used, because it's just the Vcc power supply from the board. The other terminal, J8 pulls one lead of the coil low via Q1 and the other coil lead connects to +12. Back EMF diode is bodged in between the connections.

    Control is via A5 on the Arduino which is strapped over to the normal input to the driver circuit via a 2K2 resistor. I initially (accidentally) had it programmed to stay on all the time and close only when it should take a sample, and it got a bit toasty until I figured out it was working backwards! Seems to run cool now.

    2. I've added an external 12 VDC wall wart power supply feeding into the Arduino. That was /really/ difficult: I plugged it in. Then soldered on a terminal block to the BOB where it was designed to take unregulated power and used that connect the motor power for the stepper motor driver. The BOB connects to both the regulated and unregulated supplies on the Arduino, so no problems there.

    3. Most of the time today was actually spent figuring out how to mechanically mount the stepper driver and the Arduino / BOB control board. I drilled and tapped into the heat sink for the THB6064AH stepper driver and lined that up with one of the holes I drilled in the stepper motor mounting bracket. A bit of rubber to isolate the PCB allowed me to just bolt the corner of the BOB to the bracket as well. Very bodge.

    The stepper driver takes up a lot of space... again, that driver is like using a nuclear reactor to fry eggs for this little NEMA 17 motor, but it's what I have available. I have the current turned all the way down on the driver and the motor is still getting a bit toasty. But it's really nice and smooth and quiet, which is nice. You should use something much smaller. Like a LOL.

    Here is a video of it running.

    And here is the back:
    you can see the TIP122 driver for the valve hanging upside down on the back of the BOB. Colored wires are stepper motor leads. Ribbon cable is the PMinMO standard connector from the BOB to the THB6064AH driver board. White water valve on the left, and the flow rate sensor in black on the right. Reaction chamber at the bottom.

    Still gobs to do. Figuring out the reagent injection system is next... anyone have experience with syringes, luer locks, and one way valves?

  • It's ALIVE! (somewhat)

    James Newton04/11/2015 at 05:21 0 comments

    So I took one of my BOB PCBs (normally used as a Break Out Board for Stepper Motor Drivers in PC driven CNC conversions) and made use of one of it's many alternate, err... uses. By adding two jumpers and some pin headers, it becomes an Arduino Shield with an LCD display, some switches, a cable for the stepper motor driver, and a relay driver for the water valve. For now, I'm using one of the THB6064AH drivers (which is sort of like using a nuclear reactor to fry eggs with this little NEMA 17 motor) but it will probably get replaced with some other small driver.

    The Arduino is programmed to display message "faking" the steps I think the robot will take, although the only thing it's actually doing at this point is rotating the wiper. There are some issues with the wiper getting stuck, but that's the sort of thing you expect to find and work out.

    Still a long todo list: Need to mount the driver and control board somewhere. Add the components to the BOB PCB for the water valve. Hook up the flow rate sensor, light source and sensor.

  • Mechanicals Done!

    James Newton03/15/2015 at 06:06 0 comments

    Made a new mounting plate that DOES allow a NEMA 17 motor in a NEMA 23 mount through the magical powers of /rotation/. ,o)

    Here's a detail shot showing the motor shaft coupler to the stirrer/wiper padel. It's a section of aquarium hose... Hope that will be enough.

  • Don't try to put a NEMA 17 motor in a NEMA 23 hole

    James Newton03/09/2015 at 16:38 0 comments

    So it turns out that I designed the parts for this project with a NEMA 23 mounting layout. The holes in the chamber, top and bottom match NEMA 23 mounts. Not sure why I did that, other than that I knew I had a NEMA 23 motor available and I might have been worried about how small the stirrer would be if it was done for a NEMA 17. And there might not be room for the water fittings.

    Then I must have started thinking that using a NEMA 23 motor for this project was like using a nuclear reactor to fy eggs; you just don't need that much power. So I spec'd a NEMA 17 motor on the parts list.

    And got one.

    And tried to fit it to the holes.

    And noticed that that was the wrong size, but said "no worries, I'll just make an adapter plate".

    And I did. Guess what? There isn't room between NEMA 17 holes and NEMA 23 holes for little things like nuts.

    Well... at least not when you put the NEMA 17 motor square with the NEMA 23 holes. But now I've "got a plan": Ima make /another/ adapter plate, but this time, I'll rotate the NEMA 17 motor holes 45' from the NEMA 23 holes.

    That'll do 'er, right? Solving problems with geometery.

    So why not just use the NEMA 23 motor? 'cause in the mean time, I found another use for it... This is why I need to start, stay with, and finish projects in a timely manner.

  • Outlet, stirrer, and chamber done.

    James Newton02/23/2015 at 07:18 0 comments

    Got the stirrer assembled (just with wire holding it together for now... need some tiny M2 bolts and nuts). Drive shaft coupled (with some plastic tubing). The chamber is assembled, with an extra layer of rubber at the top to make it high enough for the stirrer to fit (1/4" plexi is not 1/4" so the stirrer needs to be a bit less high on the next version). And the outlet fitting is ground down to 1/2" (1/2" hose couplings are not 1/2" so the holes need to be a bit bigger in the next version. Need a motor mount plate and then the mechanicals will be done, and we can move on to the electronics.

    You can see the rubber wiper of the stirrer against the inside of the chamber. I'm not sure the rubber sheet I used will last... the material seems to be rubbing away like an eraser...

View all 12 project logs

  • 1
    Step 1


    Made by laser cutting 1/4 inch plexi sheets and stacking them to form the bottom plate, reaction chamber (the center clear area) and the top plate. Those are the .dxf files on Thingiverse. In the picture/video, the top and bottom are shown as dark, but that would probably be accomplished with paint or something else on top and bottom of the otherwise clear stock.

    The bottom plate simply has a hole drilled part way through for the stirrer/cleaner shaft to sit in. A single ball from a bearing would be dropped in the hole to reduce friction and extend the life of the "bearing". Initially, this plate could be plex, but eventually should be something more durable.

    The center (clear) area is a square block of plex with a large circular hole in the middle where the sample will be held.

    A stirrer / cleaner made from metal with a vertical shaft turns in this space to both stir the sample and reagent and to clean the sides of the chamber to ensure consistent optical performance over time. The shaft exits the top plate and connects to a small stepper or gear motor which is not shown. If the recommended injector is used, the motor of the injector could be used to turn the stirrer / cleaner, but this is not necessary to the design.

    The black top plate has holes for the inlet of water from the valve (not pictured) and exit of the prior sample (to drain). Not shown is the small hole for the inlet of the reagent from the injector pump.

  • 2
    Step 2


    Metered injection of liquids is a solved problem. See:

    Drill a hole in the top plate to allow the injection of reagent and attach the lines for the inlet of sample water, outlet of sampled water, and injected reagent. Figure out how all that is going to fit with the shaft from the stepper motor, and how the motor will be mounted. Curse, throw everything away, and redesign.

    It turns out the one way valve specified in the parts list does most everything. You attach a reservoir to the top, a tiny syringe to one side, and a blunt 90' needle to the other. Then a servo can move the syringe plunger to inject small amounts of reagent. With a very small, easy to move, syringe, the servo can be cycled several times to inject precise amounts of reagent.

  • 3
    Step 3


    Assemble the stirrer, bottom plate, chamber, top plate, all inlets and outlets, the stepper shaft drive, and stepper. Add a stepper motor driver :cough: probably one of those little Pololu drivers will be fine, and an Arduino. Oh, and you need a driver for the inlet valve. Sure would be nice to have an interface board. :cough: The standard RAMPS would be overkill... An obvious choice would be the Adafruit motor shield which should drive a valve as well as it does a motor:

View all 6 instructions

Enjoy this project?



James Newton wrote 12/20/2015 at 02:05 point

Between my day job and consulting, I'm totally jammed for time. Is anyone out there interested in helping with the colorimeter part? Here is what needs to be done: Wire up the light to frequency converter and a neopixel to an Arduino, then code it up and do some tests to verify that it seems to accurately measure colors. I'm willing to reimburse parts cost, and trade stuff for the work... Help?

  Are you sure? yes | no

James Newton wrote 09/04/2015 at 05:45 point

  Are you sure? yes | no

James Newton wrote 09/20/2015 at 22:41 point

Apparently you can find DOX with a special LED... Based on very tried and true research:

  Are you sure? yes | no

James Newton wrote 08/28/2015 at 05:53 point

Thinking about something like this. Probably too expensive, but... if I can't get the syringe based thing working.

  Are you sure? yes | no


[this comment has been deleted]

James Newton wrote 06/22/2015 at 18:05 point

Thanks Rod! What I mostly need is more time. LOL. But right now I'm looking for some parts to build the reagent injector. If you have any syringes, luer locks, tubing, and especially one way valves, that would be VERY helpful. After that, I will need a good light sensor and consistent light source... Haven't even really thought about that part yet. Really appreciate your offer. 

  Are you sure? yes | no

hickss wrote 05/28/2015 at 23:19 point

awesome project!

Have you thought about using a spectrometer for the sample analysis?

  Are you sure? yes | no

James Newton wrote 05/29/2015 at 00:36 point

Thanks! And yes, but I need to get the stupid thing working first! LOL.

  Are you sure? yes | no

AVR wrote 05/13/2015 at 17:37 point

Hey great project!!! I might have a use for this in my HydroPWNics project when I get to water quality monitoring and nutrient testing. 

  Are you sure? yes | no

James Newton wrote 05/08/2015 at 18:59 point

Work priorities and a consulting job after hours have stopped progress on this at the moment, but I do plan to pick up soon. In the mean time, I found out that I WON and LightBlue Bean (A BLE enabled mini Arduino)

for free as part of the #2015HackadayPrize! How cool is that? I'm going to see if the range is good enough to send temperature and light level readings from my garden on the patio back to my computer. Maybe find a small solar panel for it... Fun stuff!

  Are you sure? yes | no

tazdarmedia wrote 02/03/2015 at 21:42 point

I have used: for my cocktail robot. They are about $15 from our friends on the other side of the globe. They may be accurate enough for your application depending on the dosage and your ablity to dilute your reagents.

  Are you sure? yes | no

James Newton wrote 02/04/2015 at 00:08 point

Thanks! I'll try that if the syring and servo idea doesn't work out.

  Are you sure? yes | no

henry wrote 03/14/2015 at 21:12 point

Seems like this pump gets rid of many of our mechanical moving parts and, because it decreases the number of awkward surfaces, makes rinsing the chamber between flushes easier.  I'm a fan of this little pump for v2!

  Are you sure? yes | no

James Newton wrote 03/14/2015 at 23:15 point

Not sure how that follows...
If you are talking about using that pump to put samples in the chamber, keep in mind the camber inside surface will need to be cleaned between samples. Otherwise, algae, gunk or whatever will build up and interfere with the optical measurement. You still must have a wiper. As long as we can gravity feed sample water from the tank, we don't need a pump. If we did need a pump, we would just tap into the output of the main system pump.

If you are talking about the injection of reagent, The injector is just a servo and syringe so that is actually lower cost, and easy to verify operation. e.g. you can SEE how much it dispensed. The pump isn't calibrated to dispense an exact amount, and injecting an exact amount is critical to getting a consistent reading on the colors.

  Are you sure? yes | no

henry wrote 03/14/2015 at 23:23 point

I was thinking for injecting, but your point about easier to verify quantity is sound.

  Are you sure? yes | no

James Coutie wrote 06/22/2015 at 12:55 point

I love this project as I just started lifeguarding at a pool and doing the pool test takes up 15-20 minutes every 4 hours. I'm keen to try to build an automated one myself too after seeing this.

For the reagents I've seen, they've said "add 1-2 drops", so it doesn't seem like it needs to be that accurate. One idea I had though is to use a syringe and servo/stepper motor to dispense the reagent, but have it drip over some wires that can detect each drip. That way it can count the number of drips to get an accurate volume.

  Are you sure? yes | no

James Newton wrote 06/22/2015 at 15:55 point

Ah... I should have read this before I left you a message. I'm planning on using this for the injector:
because 1. it's smaller, 2. its cheaper than a stepper and driver, 3. it should be very accurate. The only problem is I need to find one way valves that work with that medical tubing and google isn't helping. What do they call those? 

  Are you sure? yes | no

James Coutie wrote 06/22/2015 at 17:17 point

Fuel tubing works just as well as medical tubing. Here are some valves that I've bought previously for setting up an auto primer for a motor:

  Are you sure? yes | no

James Coutie wrote 06/22/2015 at 17:18 point

Also, I've found that these stepper motors are cheaper than any servo I've found, but the setup would still be a bit bigger:

  Are you sure? yes | no

James Newton wrote 02/03/2015 at 20:34 point

I don't have access to a laser cutter or a CNC machine that can cleanly cut plex (yet) so I can't fabricate the chamber. If you make one, make an extra, and send it to me, and I will continue working on the electronics, programming, etc... and update the design with improvements / corrections based on experience. Help me Obi Wan Kanobi you're my only hope

  Are you sure? yes | no

Audrey Robinel wrote 02/05/2015 at 13:50 point

For clear cuts on plexiglass sheets, you can use such a service :

When you order your next stepper controller, or whatever from them you can grab your laser cut parts :)

  Are you sure? yes | no

James Newton wrote 02/08/2015 at 02:24 point

Thanks for the idea! I've requested a quote from them to see if the price is within reason.

  Are you sure? yes | no

James Newton wrote 02/10/2015 at 22:24 point

Costs $35 which seems a bit high, but maybe worth it to get going on this project. If anyone else wants to order one, you can also access the quote and order for yourself from this link:

  Are you sure? yes | no

henry wrote 03/14/2015 at 21:13 point

Was definitely worth it!  If we need to recut based on your most recent post, no problemo :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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