# Arduino auto dosser



## shift (Jan 7, 2013)

So I have been meaning to learn how to use arduino and realized I am horrible at remembering for dose the tank with ferts. So I decided to build an arduino powered auto dosser!

I ordered some transistors and 3x 12 dc dosing pumps last night. Once they arrive I should be set to build!


----------



## mistergreen (Dec 9, 2006)

If you're using the pwm channels, you won't need relays for the pumps. zero pwm will shut them off.

I just set up a peristaltic pump controlled by an arduino. You can check it out on my site.


----------



## shift (Jan 7, 2013)

Do you have a link to the post? I cant seem to find it on your site.. 

I just ordered 3 of ebay item# 321100116298 pumps


----------



## mistergreen (Dec 9, 2006)

here's video of it running 
http://aquatictechtank.net/viewtopic.php?f=29&t=15&start=10


----------



## shift (Jan 7, 2013)

I fainlly got mine doser built and runing.











I just put together a video of mine to! 

http://www.youtube.com/watch?v=8gr5I7OUo7I&feature=youtu.be

For those included to build their own I posted the code and schematics at Arduino Controlled Dosing Pumps


----------



## Vermino (Jun 14, 2012)

looks awesome. you could ad two more solenoids and have it make you a martini while you watch your tank as well! lol =)


----------



## shift (Jan 7, 2013)

haha, built in drink mixer.... while you want for the tank to water change it self! (if only there was a drain close by!)

I may add a tempature monitor/auto shut off in the future.. but so far i'm pretty happy with it for my first arduino project. *(and my tank finally gets dosed daily ferts!)


----------



## mistergreen (Dec 9, 2006)

Looks good! I'll have to steal the box idea. I wasn't sure how to mount the pumps.


----------



## shift (Jan 7, 2013)

It was a wooden tea packet box.. 3$ at the dollar store.. you cant beat it for the price.


----------



## Vermino (Jun 14, 2012)

so with this system, do you find yourself running the program in a so-called "drip" mode for better distribution to plants without giving excess for those nasty algae friends?

It would be a good case study to see if this could be proven


----------



## shift (Jan 7, 2013)

Right now it setup to does it one after another about an hour before the lights come one... haven't though about doing a "drip mode" allthough it may be an intresting experiment.. 

Instead of 8ml all at once you could do 1ml / hour of each mix... I wonder if there would be noticable differance?


----------



## mistergreen (Dec 9, 2006)

Vermino said:


> so with this system, do you find yourself running the program in a so-called "drip" mode for better distribution to plants without giving excess for those nasty algae friends?
> 
> It would be a good case study to see if this could be proven


Nutrient isn't the problem when it comes to algae. They can live fine without much at all. It's light and circulation/lack of O2 in the water fore most, and then unhealthy plants due to low nutrients and CO2.


----------



## VAtanks (Feb 1, 2013)

This looks great, quick question for you for the board power. What did you use for wall power? Those usb wall adapter power plugs for cellphones would you think that would work?


----------



## Vermino (Jun 14, 2012)

mistergreen said:


> Nutrient isn't the problem when it comes to algae. They can live fine without much at all. It's light and circulation/lack of O2 in the water fore most, and then unhealthy plants due to low nutrients and CO2.


ahh ok, yeah i read otherwise on one of these stickies (cant remember where)


----------



## shift (Jan 7, 2013)

The whole thing is powered from a 12v 1A wall plug. I have a voltage regulator on the top board that drops it down to 5v for the arduino and feeds 12v to the pumps

Check out my wiring diagram at http://fishtankprojects.com/diy-aquarium-projects/arduino-controlled-dosing-pumps.html


----------



## shift (Jan 7, 2013)

Look who made it on to HackADay


----------



## Jett (May 24, 2013)

Awesome project. I would like to build one when I have some spare cash to spend.


Sent from my iPad using Tapatalk


----------



## shift (Jan 7, 2013)

And to polish it off I finally got my tube holder (much nicer than a binder clip!)


----------



## AnotherHobby (Mar 5, 2012)

This is a really cool project and also very affordable. I just ordered all of the stuff to build one of these and spent a total of just $70, and that's including the pumps. I'm super excited to dig in and build it and customize it. Thank you for sharing all of the info, and especially the code.

The only thing I can't see in the pictures is where the 1k resistors go. Do you have a picture of the back side of the completed prototype shield?

Also, how much pressure do you think the pumps can push against? I was thinking of hooking the outputs from the dosing tubes to my CO2 reactor instead of running them up to the tank. The reactor is under pressure of course, since it's below the tank, so I'm not sure how that would pan out.


----------



## All your base (Dec 6, 2006)

Do the tube endings terminate under water? Are there check valves in the lines? Many of these cheaper peristaltic pumps are not 100% foolproof when it comes to preventing free flow (there may be a few degrees at which the rollers aren't sealing the tubing). With no check valves and tubes ending in the aquarium, you could end up with a back siphon if the pumps happen to stop in those positions.

Nice project!


----------



## shift (Jan 7, 2013)

The pumps I have make a tight seal an I haven't had an issue yet. Check valves should provide a little more piece of mind but I don't believe they are requires. (Maybe one day). The tubes are under water but only a little so not more then half an inch could possibly drain out. (If a pump was to fail.. But the gear drives seem solid.

Ill see if I can snap a pic of the bottom of the board for you


----------



## AnotherHobby (Mar 5, 2012)

Well well well... what have we here?






This is just on the breadboard to make sure it all worked. I still have to solder it all up, customize the code some more, and put it in a pretty box. But I have it dosing a perfect 5 mL right now, so I am quite happy with the project so far!

Thanks for the info on how to do this!


----------



## PortalMasteryRy (Oct 16, 2012)

Aww that is awesome!

@Shift:can you do a 5 pump system? or Even a 6 pump system with the 6th pump being a more powerful one.

I am in need of a dosing pump that has 1 pump for N,P,K,Iron,Trace and top off. 

Also can you assign unique multiple schedules for each pump?

Can you also log the dosing and record the time and amount dosed. <- it would be nice to chart the nutrient levels based on the amount dosed to get a picture on how much nutrient is being added to the water column. I wanted to experiment on a more accurate dosing based on the requirements of my tank and having the ability to log the amount dosed when experimenting with different levels would be an awesome feature.


----------



## AnotherHobby (Mar 5, 2012)

PortalMasteryRy said:


> Aww that is awesome!
> 
> @Shift:can you do a 5 pump system? or Even a 6 pump system with the 6th pump being a more powerful one.
> 
> I am in need of a dosing pump that has 1 pump for N,P,K,Iron,Trace and top off.


The Arduino UNO has 6 PWM pins, so you could do this with up to 6 pumps on this board. There are other Arduino boards with more PWM pins.



> Also can you assign unique multiple schedules for each pump?


Absolutely. You can pump each independently of each other on it's own schedule for it's own length of time and at it's own speed. For example, you could pump trace slower and for a shorter time to dose a small amount (i.e. 5 mL), and then your pump top off faster and for longer to dose a larger amount (i.e. 500 mL).



> Can you also log the dosing and record the time and amount dosed. <- it would be nice to chart the nutrient levels based on the amount dosed to get a picture on how much nutrient is being added to the water column. I wanted to experiment on a more accurate dosing based on the requirements of my tank and having the ability to log the amount dosed when experimenting with different levels would be an awesome feature.


I'm far from any sort of expert, so I could be wrong, but I don't think the Arduino has any built in way to store log data, unless you left it hooked up to your computer all the time. If you wanted it to be stand alone, I think you'd need to add something to save the data to, like an SD card reader, which is totally possible.


----------



## mistergreen (Dec 9, 2006)

AnotherHobby said:


> unless you left it hooked up to your computer all the time. If you wanted it to be stand alone, I think you'd need to add something to save the data to, like an SD card reader, which is totally possible.


correct. There are several options. You can write text to some storage device like an SD card, or to a data logging device. Or put an ethernet shield on it to have it send data to a database.

If you hook it up to your computer via usb, you'll need an app to listen to the usb/serial port to write it to a text file. I have an app like that I wrote if you need it.


----------



## PortalMasteryRy (Oct 16, 2012)

Cool. I'll definitely look into this. The logging functionality could be a nice to have. But having a 6 pump system in one rack could really organize my aquarium stand and cut down on the cables.


----------



## shift (Jan 7, 2013)

It defiantly cuts down on the daily work.. (I warn you. Your tank may grow to well!!) I Feel like it needs to much trimming. I may dial back the dosages a bit


But hey.. Who doesn't love automation!


----------



## Finalplay10 (Jun 29, 2010)

These pumps are super quiet when you have them in a box as well. I had to set a reminder on my phone so that I could be present to watch and make sure the pumps were working at the desired time because I couldn't hear them and was worried it wasn't working. Making one of these is worth it 100% !!! Mine is sans Arduino though.. Just a tad simpler but less controlled.


----------



## mistergreen (Dec 9, 2006)

shift said:


> It defiantly cuts down on the daily work.. (I warn you. Your tank may grow to well!!) I Feel like it needs to much trimming. I may dial back the dosages a bit
> 
> 
> But hey.. Who doesn't love automation!


Dial back your light duration too. That drives plant growth most.


Sent from my iPad using Tapatalk HD


----------



## shift (Jan 7, 2013)

It's set to 9h now. Ill try 8


----------



## Chronados (Jan 28, 2013)

Bump for awesome build. Just finished mine and it works great. Total project cost: about $70. I plan on expanding the Arduino to power some relays for the lights and CO2 as well.


----------



## shift (Jan 7, 2013)

Very nice. I love automation! 

I was also thinking if making a temptation controlled shutoff as a thermometer protector


----------



## AnotherHobby (Mar 5, 2012)

I built a version of this dosing setup about 2 months ago, and I use it for 2 dosing pumps plus a set of RGB LED lights that I use to add color to my tank. Thanks a ton for posting all of this — I never would have attempted it without all of the information!

I finally got around to actually documenting it all, and I posted an update in my journal with a bunch of pictures of the build with information. I wanted to leave a link here in case anybody digs this thread up and is looking for more info: Fallen Tree Branch 60cm — Page 12


----------



## HunterX (May 19, 2012)

How are the dosing pumps holding up? I'm going to build this as well. I noticed they are coming from China so I ordered an extra one in case one fails.


----------



## HunterX (May 19, 2012)

ALso will this same code work with the Arduino Mega. I would like to by it initially so I can use it to control the lights and pumps later on!


----------



## Chronados (Jan 28, 2013)

HunterX said:


> How are the dosing pumps holding up? I'm going to build this as well. I noticed they are coming from China so I ordered an extra one in case one fails.


Mine seem to be fine. The actual assembly is quite simple, and because they are rollers, there shouldn't be any wearing issues with the exception of the tubing inside the pump (which can be replaced). My only complaint is that they do not seal 100% against backpressure. As my ferts have to be pumped up like 3-4 feet, this sometimes results in the lines slowly emptying over a few hours, even with check valves installed (not enough backpressure to fully lock the check valves I assume)


----------



## PortalMasteryRy (Oct 16, 2012)

Chronados said:


> Mine seem to be fine. The actual assembly is quite simple, and because they are rollers, there shouldn't be any wearing issues with the exception of the tubing inside the pump (which can be replaced). My only complaint is that they do not seal 100% against backpressure. As my ferts have to be pumped up like 3-4 feet, this sometimes results in the lines slowly emptying over a few hours, even with check valves installed (not enough backpressure to fully lock the check valves I assume)


You can solve this problem by purchasing a single silicon tube for each pump. You can purchase the small silicon tubing from amazon. I also use the small cable ties to secure each connection point to try to make it as air tight as possible.

Also make sure the container where the fert is coming from has a small hole or the container will cause some back pressure at one point and will pull the liquid down.


----------



## Chronados (Jan 28, 2013)

PortalMasteryRy said:


> You can solve this problem by purchasing a single silicon tube for each pump. You can purchase the small silicon tubing from amazon. I also use the small cable ties to secure each connection point to try to make it as air tight as possible.
> 
> Also make sure the container where the fert is coming from has a small hole or the container will cause some back pressure at one point and will pull the liquid down.


Not sure what you mean by the first part. Are you saying replace the inner tubing (that gets rolled) with a thicker walled version? I was going to do that but could not find an appropriate size that did not bind the roller assembly

And yep, I drilled a tiny hole in the fert container for air. Though, now that I think about it, maybe if I covered the hole, the suction would be enough to fully engage the check valves. Hmmmm


----------



## PortalMasteryRy (Oct 16, 2012)

Chronados said:


> Not sure what you mean by the first part. Are you saying replace the inner tubing (that gets rolled) with a thicker walled version? I was going to do that but could not find an appropriate size that did not bind the roller assembly
> 
> And yep, I drilled a tiny hole in the fert container for air. Though, now that I think about it, maybe if I covered the hole, the suction would be enough to fully engage the check valves. Hmmmm


Yes you can replace the inner tubing with a tubing that will reach both the ferts container and the actual aquarium. I purchased silicon tubing from Amazon.com (3/32 ID and 5/32 OD) but I have not installed it yet. It came as a 10 ft tube which should be long enough to reach the ferts container inside my stand. 

I initially was struggling to find a silicon tubing replacement for mine so I ended up using latex tubing I found at walmart by the fishing section. I found a small diameter one and it has been my tubing for more than 4 months now. 

You can try other brands of check valves but I'm using 2 cheap ones from petco and they've kept the lines primed.


----------



## Chronados (Jan 28, 2013)

Oh, you misunderstood my issue, I should have been more clear. The ferts are not leaking out of the line itself (I'm using barbed connectors that seal very well), they are going back into the fert container because they are located in my cabinet, almost 4 ft below the tank lip (right now the ends of the lines are just held in place above the waterline so tank water does not get sucked back. The pressure from the height slowly pushes the ferts back down because the check valves and pump assembly do not fully prevent backflow 



PortalMasteryRy said:


> Yes you can replace the inner tubing with a tubing that will reach both the ferts container and the actual aquarium. I purchased silicon tubing from Amazon.com (3/32 ID and 5/32 OD) but I have not installed it yet. It came as a 10 ft tube which should be long enough to reach the ferts container inside my stand.
> 
> I initially was struggling to find a silicon tubing replacement for mine so I ended up using latex tubing I found at walmart by the fishing section. I found a small diameter one and it has been my tubing for more than 4 months now.
> 
> You can try other brands of check valves but I'm using 2 cheap ones from petco and they've kept the lines primed.


----------



## mistergreen (Dec 9, 2006)

Where is your check valve, at the top or the bottom toward the bottles?


----------



## Chronados (Jan 28, 2013)

mistergreen said:


> Where is your check valve, at the top or the bottom toward the bottles?


I using two, one at the tip of the line that is above the tank, and one right before the bottle. The backflow is really slow, it takes about half a day to travel back. The funny thing is, it only happens part of the time, which leads me to believe the pump mechanism has certain positions at which it doesn't seal 100%. I am thinking of trying different check valves. Currently using US Plastic ones that seem to work fine for my CO2 rig


----------



## mistergreen (Dec 9, 2006)

try a clippard check valve.


----------



## geesantoz (Mar 22, 2013)

This is interesting project.
how big is your canister for the liquid fertz ? 
do you have issue with the level of liquid fertz in canister ? e.g with mid to low level you need to pump longer ?


----------



## geesantoz (Mar 22, 2013)

Chronados said:


> I using two, one at the tip of the line that is above the tank, and one right before the bottle. The backflow is really slow, it takes about half a day to travel back. The funny thing is, it only happens part of the time, which leads me to believe the pump mechanism has certain positions at which it doesn't seal 100%. I am thinking of trying different check valves. Currently using US Plastic ones that seem to work fine for my CO2 rig


i have not tried it myself, but could you make a little trap loop such as sink pipe trap to prevent/reduce backflow ?
similar to like this ... 
http://en.wikipedia.org/wiki/File:Annotated_plumbing_trap.jpg


----------



## shift (Jan 7, 2013)

A few more updates have been added to my main site on the project
http://fishtankprojects.com/diy-aquarium-projects/arduino-controlled-dosing-pumps.html


----------



## HunterX (May 19, 2012)

Chronados said:


> Mine seem to be fine. The actual assembly is quite simple, and because they are rollers, there shouldn't be any wearing issues with the exception of the tubing inside the pump (which can be replaced). My only complaint is that they do not seal 100% against backpressure. As my ferts have to be pumped up like 3-4 feet, this sometimes results in the lines slowly emptying over a few hours, even with check valves installed (not enough backpressure to fully lock the check valves I assume)


Thanks for your reply Chronados!

Is anyone using the Arduino MEGA to instead of the smaller boards?


----------



## bigd603 (May 10, 2011)

Hey Shift, I noticed on your site you have the tubes going directly into your tank. Do you have to worry about excess fertilizer leaching into the tank throughout the day while the pumps or off? 

I have my tubes just hanging over the tank, and it drips in, but solids tend to build up around the end of the tubes and I have to wipe it off regularly. Keeping the tubes in the water would obviously fix this, but I am worried about slowly over dosing the tank.


----------



## bigd603 (May 10, 2011)

HunterX said:


> Thanks for your reply Chronados!
> 
> Is anyone using the Arduino MEGA to instead of the smaller boards?


I am, worked fine except for some reason it will dose on schedule, and than 2-3 minutes later dose again. I don't know why. It doesn't do it every day, just sporadically, but when it does happen its always just one additional dose, a few minutes later, and it doesn't happen again until after the scheduled dosing. Its the weirdest thing. I'm thinking it might be some kind of short. Would using capacitors alleviate this issue?

Oh and Hunter, I highly doubt that my issues are caused by the fact that im using a Mega instead of an Uno. A Mega just has more pins and more memory, so it is perfectly capable of handling this job.


----------



## HunterX (May 19, 2012)

bigd603 said:


> I am, worked fine except for some reason it will dose on schedule, and than 2-3 minutes later dose again. I don't know why. It doesn't do it every day, just sporadically, but when it does happen its always just one additional dose, a few minutes later, and it doesn't happen again until after the scheduled dosing. Its the weirdest thing. I'm thinking it might be some kind of short. Would using capacitors alleviate this issue?
> 
> Oh and Hunter, I highly doubt that my issues are caused by the fact that im using a Mega instead of an Uno. A Mega just has more pins and more memory, so it is perfectly capable of handling this job.


I got my MEGA the other day and have started working on my project. I got my RTC and LCD screen working. Now I'm trying to figure out how to display the time on the LCD screen.  Lots of reading.


----------



## Legot (Jun 29, 2013)

bigd603 said:


> I am, worked fine except for some reason it will dose on schedule, and than 2-3 minutes later dose again. I don't know why. It doesn't do it every day, just sporadically, but when it does happen its always just one additional dose, a few minutes later, and it doesn't happen again until after the scheduled dosing. Its the weirdest thing. I'm thinking it might be some kind of short. Would using capacitors alleviate this issue?


Are you running the motor directly from a GPIO, or are you running it from a GPIO to a transistor then through the motor?

Or are you using a relay and relay driver circuit?


----------



## bigd603 (May 10, 2011)

Legot said:


> Are you running the motor directly from a GPIO, or are you running it from a GPIO to a transistor then through the motor?
> 
> Or are you using a relay and relay driver circuit?


No relay, its going from pin, to the transistor, to the motor. 

here's the code:


```
#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h>

int macroPump = 10;
int microPump = 11;

void setup() {
  Serial.begin(9600);
  pinMode(macroPump, OUTPUT);
  pinMode(microPump, OUTPUT);
  
  analogWrite(macroPump, 0);
  analogWrite(microPump, 0);
  
  setSyncProvider(RTC.get);
}

void loop() {
  
  /*
   //Following section is for testing purposes
  Serial.print(hour());
  Serial.print(":");
  Serial.print(minute());
  Serial.print(":");
  Serial.println(second());
  delay(1000);
  //end testing section
  */
  
  if (hour() == 9 && minute() == 11 && second() == 0) {
    analogWrite(macroPump, 155);
    delay(1400);
    analogWrite(macroPump, 0);
  }
 

  
}
```


----------



## Legot (Jun 29, 2013)

bigd603 said:


> No relay, its going from pin, to the transistor, to the motor.


It's possible that the base on your transistor is floating high a few minutes after dosing, then drifting back to low after a while.

That Atmega doesn't have any internal pulldowns, so you should try putting a ~10k resistor from the transistor's base to ground. That will probably fix your problem. If not, we'll start thinking critically.


----------



## bigd603 (May 10, 2011)

I'll give that a shot, Legot. Like I said it's pretty sporadic, so it will probably take about a week or 2 of observation to see if it's working better.


----------



## BaltimoreGuy (Dec 23, 2009)

Hi Shift, thank you very much for posting this. You have encouraged me to try it myself, but first I have a question regarding your setup though. Please keep in mind I am just in the process of learning about the whole arduino culture so I am still very green!
Why is the voltage regulator needed? The input for the arduino I will be using is 7-12v and where the RTC connects to the arduino is 5V anyway, could you tell me if I am missing something?


----------



## mistergreen (Dec 9, 2006)

BaltimoreGuy said:


> The input for the arduino I will be using is 7-12v and where the RTC connects to the arduino is 5V anyway, could you tell me if I am missing something?


It's not recommended for the ardunio to have operation voltage that high, not sure what arduino board uses 7-12V.


----------



## BaltimoreGuy (Dec 23, 2009)

mistergreen said:


> It's not recommended for the ardunio to have operation voltage that high, not sure what arduino board uses 7-12V.


Taken from the Arduino Uno specs:
Operating Voltage	5V
Input Voltage (recommended)	7-12V
Input Voltage (limits)	6-20V


----------



## kman (Dec 11, 2013)

Just curious... the first photo in the thread shows an LCD. Did you ever build a version of this with an LCD showing dosing history (or next dose time) or anything like that?

Trying to decide if I want to build one as an interim step or just go straight to iAqua...


----------



## AnotherHobby (Mar 5, 2012)

kman said:


> Just curious... the first photo in the thread shows an LCD. Did you ever build a version of this with an LCD showing dosing history (or next dose time) or anything like that?
> 
> Trying to decide if I want to build one as an interim step or just go straight to iAqua...


It wouldn't be hard to do. I'll shoot you a PM.


----------

