Reef Central Online Community

Go Back   Reef Central Online Community > General Interest Forums > Do It Yourself
Blogs FAQ Calendar Mark Forums Read

Notices

User Tag List

Reply
Thread Tools
Unread 05/05/2011, 07:22 PM   #1
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
Disc1 Arduino Doser

I promised over on the equipment forum to post this. This is a project still in development, so it looks ugly. But I think you can see how to utilize these pumps to build something cheap for yourself. I'll try to come back and post updates as I finish it.

I bought these cheap peristaltic pumps off e-bay for about $30 each. I wanted to use them to dose 2-part. To my surprise I found that they were quite precise. So I built a little Arduino sketch to run it.

These are the pumps that I got.



These pumps run from about 6V to 12V dc. The flow rate of the two pumps did not match, one pumps 26ml/min at 12V and the other pumps 40ml/min. I think the slow one is defective, but there's really no sending it back and even though it is slow it is consistent. I use it for alk since I like to drip that slower anyway.

The flow rate is nice and linear with voltage, being about half at 6V. So I decided to use a MOSFET (RadioShack IRF510 was what I had on hand.) and PWM signal from the arduino. Power goes from positive to the pump, then from the pump to the drain pin, and then from the source pin to ground. The PWM signal goes to the gate pin. Since the pump doesn't run below 6V, use PWM values from 127 - 255 in the Arduino sketch.

Here is the full set-up...



And a close-up on the breadboard part.




The knob and the two ic chips are part of a rotary encoder that was put together for an entirely different project and ended up getting absorbed into this when I got tired of pushing buttons over and over. It's a horribly inefficient use of a rotary encoder using two 555 timers and an 8-bit shift register, but it worked well for what it was originally built. When I build a permanent version to put on a board I will trim this whole part down. Besides, it doesn't work very well.

Aside from that there are two pushbuttons, both of which are connected to arduino, but only one is used. It is used to select menu items or values. The knob allows you to scroll through the menus and adjust values. There are a couple of capacitors to keep the power smooth and two diodes running backwards towards positive from the drain on the MOSFET's to handle any kick-back from the pumps. Without these two diodes, you arduino will reset everytime the pump runs.

Once I had the program working, I wanted to make it pretty so I could put it in a box and use it on my tank. So I added the LCD screen I had laying around and added some functionality to the program. There are options to calibrate the pumps, prime the pumps, and build a dosing schedule. The schedule is stored in a seperate class that has arrays full of times and volumes. The flow rate is the same for all doses. There is currently room for two schedules, Alk and Cal, but I am going to trim the program down a bit once I am satisfied and probably add functionality for more pumps. It also saves the schedule and the calibration in the EEPROM so you don't lose it on a reset.

Right now the schedule is built by selecting a start time, end time, total volume, and max volume per dose. Right now I dose 60ml per day of the bicarbonate recipe so I do 5ml every two hours and I do the calcium doses on the odd hours. It runs the schedule every day and starts over at midnight. There is absolutely no error checking to see if the schedule will fit or to make sure that two additions don't coincide. I want to add that, but as of right now you have to calculate things before you put it in.

That pretty much does it. If I can find somewhere to host the code I will post it. It uses several of my home-made libraries. I'll package them up and post them too if anybody wants it. I'm sure a real programmer would have a field day with my code, but it works and that's good enough for me. I'm not claiming any real skill here. Just didn't want to pay big bucks for a dosing pump.


disc1 is offline   Reply With Quote
Unread 05/05/2011, 07:28 PM   #2
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
Oh and here's a couple pics of my 75gallon.




disc1 is offline   Reply With Quote
Unread 05/06/2011, 06:27 AM   #3
shifty51008
12-5 Chiefs record
 
shifty51008's Avatar
 
Join Date: Mar 2010
Location: NW Iowa
Posts: 10,134
very nice job. I would be intrested in seeing the code and your lib.s


__________________
75 gal. mixed DT, 100 gal. sump, 50 gal. fuge,

Clownfish breeder
shifty51008 is offline   Reply With Quote
Unread 05/06/2011, 06:49 AM   #4
BeanAnimal
Registered Member
 
Join Date: Feb 2003
Location: Pittsburgh
Posts: 20,772
Nice work

I built a fairly complex dosing controller using an Atmega, but the code is in BASCOM basic. Oddly, I used a grayhill rotary encoder for menu navigation.

In any case, the code allows for dosing windows to be set and the dose to be metered in many modes (all at once, in even increments, etc.). External input can also "hold" or "push" or "cancel" the current dose (for example if the system is in maintenance or feeding mode).

With all of the error checking and functionality to split the dose and fit it into the dosing window, calibration functions and other features, the code got very bulky. While I am pleased with the outcome, it was extreme overkill in the sense that I only use the basic function of dosing a fixed amount per day over a fixed time window

Nothing like beating a horse with a microcontroller when all you needed was a carrot to get the job done


BeanAnimal is offline   Reply With Quote
Unread 05/06/2011, 02:54 PM   #5
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
Quote:
Originally Posted by BeanAnimal View Post

Nothing like beating a horse with a microcontroller when all you needed was a carrot to get the job done

Amen to that.


disc1 is offline   Reply With Quote
Unread 05/08/2011, 01:38 PM   #6
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
Let's see if I can just upload the code here. You will need to move the libraries into you library folder. You will also need the latest version of the Time library from the arduino site.

For you programmers out there, take a look at my QuickPin library and tell me what you think. It make my life simpler in programming, but it's relatively new so I haven't really had a chance to run into any major problems with it. It's sort-of documented. You should be able to figure it out from the header.


Attached Files
File Type: zip Dose_Comp.zip (18.1 KB, 284 views)
disc1 is offline   Reply With Quote
Unread 05/08/2011, 05:24 PM   #7
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
And here's a basic diagram of what's going on on that bread board. I've got it in an Eagle file if anyone wants it.


Attached Images
File Type: jpg bread_pic.jpg (21.8 KB, 506 views)

Last edited by disc1; 05/08/2011 at 05:24 PM. Reason: Add attachment.
disc1 is offline   Reply With Quote
Unread 06/07/2011, 01:36 PM   #8
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
How complicated is it to learn how to use something like arduino? I have basic coding knowledge and have done some soldering and working briefly with a bread board.

Would this be something I would be able to pick up quickly or is it a complicated process?


nrbelk is offline   Reply With Quote
Unread 06/07/2011, 02:03 PM   #9
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
The coding is as complicated as you want to make it. I learn computer languages fast, it took me a week or two with an old text book to get moving in C++. That's all the arduino language is, a fancied up C++. But for someone who's not familiar with programming, it has pretty much all the commands you need to write a basic program. If you understand loops and if/then type logic you can pick it up pretty quick. If you understand how to use pointers and arrays and referencing, and more hardcore C++ stuff, then you can get real dangerous. It all works. Except the feakin new operator. But somebody wrote one, it's actually commented out on one of the pages of code with this thread.

Go on the Arduino website and look at the reference section and the playground. If you get what's going on there, then Arduino will work for you. Go put C++ tutorials into google and check out some of that. If you get what's going on there then Arduino will be a breeze to master and you can do some really neat stuff with it.


__________________
David


Current Tank: Undergoing reconstruction...
disc1 is offline   Reply With Quote
Unread 06/07/2011, 02:27 PM   #10
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
I did three college classes in C++, I know arrays, loops, if/then, but pointers and references I haven't had to ever use even though we were taught about them. Currently I write little scripts in perl to automate some menial tasks at work every once in a while. With this background, would you feel comfortable telling me to go for it?

I looked up arduino boards and I saw that there are various types/models. Which one is a common one to get for this type of project?


nrbelk is offline   Reply With Quote
Unread 06/07/2011, 02:42 PM   #11
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
Oh yeah. You should be good to go, ahead of the curve even. Anything you don't know how to do google it. It's just the nature of the web to have great info on writing code. Go figure.

There are basically two types of arduino to start out with. The others are variations on the theme. There's the ATmega328 chip like in the UNO. That's what the one in this thread is, an UNO. There's also the ATmega2560 which has more inputs / ouputs and more memory. That's the Arduino Mega. It's more the scale for like a full on controller for the whole tank. Then there's all sorts of versions that are flexible, or have built in blue-tooth, or are the size of a button, whatever you can imagine.

Start out with an UNO or a mega (or one of the clones) since they are pretty much plug and play. Get a kit or something with some little leds and caps and diodes and resistors and stuff to play with. Spend a few days just writing programs around an led, make it come on, make it blink, make it fade, fade based on a pot. By the time you have written a few of those, you will know what's up.


__________________
David


Current Tank: Undergoing reconstruction...
disc1 is offline   Reply With Quote
Unread 06/07/2011, 02:46 PM   #12
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
Thanks! This is great, I'm getting way excited!

To do all that, do I need a bread board?

Also, with what you said about the differences of the two, uno and mega, I think I will go with mega so that perhaps I can eventually make a full on aquarium controller. When I get proficient that is



Last edited by nrbelk; 06/07/2011 at 02:53 PM.
nrbelk is offline   Reply With Quote
Unread 06/07/2011, 02:53 PM   #13
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
It will make it a whole lot easier to build circuits. When things are trial and error, you don't want to have to unsolder things to hook it up a different way.

Check out this site. www.sparkfun.com
I don't know if it is the absolute best prices, but it's reasonable and it will have just about everything you need to get started. digikey.com and mouser.com are two more that I use a lot, but they are more the type of thing where you need to know what you are looking for. Sparkfun has all sorts of good tutorials and how-to's on all of their products. I can get lost for days in there.


__________________
David


Current Tank: Undergoing reconstruction...
disc1 is offline   Reply With Quote
Unread 06/07/2011, 04:12 PM   #14
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
thanks for the site! I found kits that come with mini breadboards, I think it would be perfect for me at this time!

Ok, I think I have one last question before I pull the trigger and buy a mega instead of an uno. Would you be able to do things like dim LEDs? I'm guessing that turning high power LEDs on and off would be similar to the pumps, but what about dimming them? and how do I find how many inputs/outputs the arduino has? Also, are there ways to add more inputs/outputs?

Ok, I guess it was more than one question..... sorry.. but now I'm so excited!


nrbelk is offline   Reply With Quote
Unread 06/07/2011, 10:22 PM   #15
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
To dim LEDs with an arduino, you are going to be using pulse width modulation to control your LED driver. It has to be a dimmable driver that works with pwm. The ATmega328 boards have 14 IO lines with 6 that can be pwm outputs. The mega has 54 IO lines, 14 of them with pwm. There are other chips you can get that can extend the IO capabilities of either board.

http://arduino.cc/en/Main/Hardware
Go to that site and look all over it. At the top of the page getting started, reference, learning. And check out at the very very top of the page, the playground.

You feed the pwm signal to the driver on it's dimmer line and viola, all you gotta do is write code. Well there's a little more to it, but nothing you can't do. There are TONS of arduino LED threads on here. And lots of ways to get the same thing done.


__________________
David


Current Tank: Undergoing reconstruction...
disc1 is offline   Reply With Quote
Unread 06/08/2011, 10:05 AM   #16
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
Thanks! I bought a starter kit, can't wait to start. Perhaps I will do a DIY write up too!


nrbelk is offline   Reply With Quote
Unread 06/15/2011, 01:32 PM   #17
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
what do you use to get the arduino board to be able to turn the pumps on and off? I'm not exactly sure how to do this. Do I get a power cord for the pumps that accepts an input from the arduino or is there a better way?

I can't find the link of what I'm talking about with the power cords. They look like a PC powercord (with the brick thing) but on the brick thing, there are connectors for an electronic on/off switch


nrbelk is offline   Reply With Quote
Unread 06/15/2011, 01:57 PM   #18
theshoes
Registered Member
 
theshoes's Avatar
 
Join Date: Sep 2010
Location: Santa Ana, CA
Posts: 61
take at look at MOSFETs
That's what I'm using
Sent from my T-Mobile G2 using Tapatalk


theshoes is offline   Reply With Quote
Unread 06/15/2011, 02:30 PM   #19
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
Quote:
Originally Posted by nrbelk View Post
what do you use to get the arduino board to be able to turn the pumps on and off? I'm not exactly sure how to do this. Do I get a power cord for the pumps that accepts an input from the arduino or is there a better way?

I can't find the link of what I'm talking about with the power cords. They look like a PC powercord (with the brick thing) but on the brick thing, there are connectors for an electronic on/off switch
That's one solution. The cheaper thing would be to use a transistor. I like a MOSFET for arduino stuff since it depends more on voltage and arduino doesn't source a lot of current. The "real" correct answer is to use a MOSFET and then an NPN to switch the MOSFET. With a built arduino board, you have enough protection that you can do away with the NPN without burning anything up.

Basically, a transistor is like a switch. You use a voltage on one pin to control a much larger voltage and/or current on the other two pins. If you look at the schematic with this thread, you can see how to hook them up.


__________________
David


Current Tank: Undergoing reconstruction...
disc1 is offline   Reply With Quote
Unread 06/15/2011, 04:59 PM   #20
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
Thanks! That is perfect, hopefully my local radio shack has them in stock.

Now the other part of the question would be what do I plug into the wall to give the pump(s) power. I'm fairly new at this electrical stuff so I'm still working on figuring it all out.

Do I take just a spare electrical outlet cord and cut and then strip it to get to the wires? Sounds excitingly dangerous!


nrbelk is offline   Reply With Quote
Unread 06/15/2011, 05:09 PM   #21
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
The pumps probably take DC. SO you will have to have some sort of transformer. A wall wart will do. In my project the pumps were 12VDC. So if you were using a MOSFET transistor the positive would go to the pump. The other side of the pump goes to the MOSFET drain, the source goes to ground. The base gets the signal from the arduino. You need to protect arduino and the mosfets from the kick-back voltage from the pumps. The easiest way to do this is to put a diode backwards between the ground from the pump and hot. That way if the positive voltage goes below 0, like on start or stop the pump, the diode acts like a short to ground. Without something like that, arduino will reset or lock up every time the pump runs.

Look at the right side of the schematic in post #7. The rest of that stuff on that pic is just to be able to use a rotary encoder instead of buttons. The right side towards the top has the two transistors.


__________________
David


Current Tank: Undergoing reconstruction...
disc1 is offline   Reply With Quote
Unread 06/20/2011, 01:18 PM   #22
nrbelk
Registered Member
 
Join Date: Mar 2010
Location: Idaho Falls, Idaho
Posts: 935
I'm trying to look at the diagram you included in post #7 but it shows up pretty small. Could you attach a larger version (or send it to me in an email if that works better?).

I want to review it and see what I can learn from it.

Thanks!


nrbelk is offline   Reply With Quote
Unread 06/20/2011, 02:31 PM   #23
disc1
-RT * ln(k)
 
disc1's Avatar
 
Join Date: Sep 2010
Location: Little Rock
Posts: 9,705
It won't let me post the eagle file here. I sent you a PM.


__________________
David


Current Tank: Undergoing reconstruction...
disc1 is offline   Reply With Quote
Unread 06/20/2011, 03:41 PM   #24
theshoes
Registered Member
 
theshoes's Avatar
 
Join Date: Sep 2010
Location: Santa Ana, CA
Posts: 61
Can I get the eagle file too

Sent from my T-Mobile G2 using Tapatalk


theshoes is offline   Reply With Quote
Unread 06/20/2011, 05:16 PM   #25
BeanAnimal
Registered Member
 
Join Date: Feb 2003
Location: Pittsburgh
Posts: 20,772
You still havent turned off that silly tapatalk signature?

Sent from my Commodore 64 using Multi-Term 5.2


BeanAnimal is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Meanwell ELN-60-48P & ARDUINO??? oceanicsquire Do It Yourself 15 06/25/2013 06:09 AM
slave doser auto dose question plankton99 GHL /ProfiLux / Mitras 4 02/04/2011 12:20 PM
Anyone doing an arduino controller? der_wille_zur_macht Do It Yourself 165 06/23/2010 08:29 PM
Hydor Koralia nano pump (12V) & arduino Monsta Do It Yourself 4 06/12/2009 10:57 PM


All times are GMT -6. The time now is 05:58 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Powered by Searchlight © 2024 Axivo Inc.
Use of this web site is subject to the terms and conditions described in the user agreement.
Reef CentralTM Reef Central, LLC. Copyright ©1999-2022
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.