Introduction: Arduino Run Accurate Liquid/Powder Dispenser System
Objective: Make something to do some measuring for you, whether for cooking or otherwise. It will do both liquids and powders from the same control panel. It uses an Arduino to run the system.
NOTE: Neither of us (the designers) have any electrical engineering experience, this is pretty much the first either of us have done, so there’s probably some stupid things in our circuit design. We’re both programmers, so we deal with the software side usually. We would welcome any input on how to improve things.
Materials:
Interface and circuitry:
- 1 Arduino Mega (or equivalent)
- 4 breadboards or circuit boards
- 1 LCD screen
- 1 potentiometer
- 5 buttons
- 5 10 k ohm resistors
- Jumper wires
Liquid Dispensing:
- 1 peristaltic pump
- 1 set food safe silicon tubes
- 1 2.2 k ohm resistors
- 1 12 volt power supply
- 1 diode
- 1 Mosfet transistor
- 2 alligator clip one-sided wires
Powder Dispensing:
Volume Based (not in current design, but probably a better way to do it):
- 1 Volume measuring auger
- 1 Stepper motor
Weight Based (current implementation):
- 1 kitchen scale
- 1 10 ohm resistor
- 1 TI INA125p IC
- 1 PNP transistor
- 1 330 ohm resistor
- 1 diode
- small shrink tubing
- 1 small motor (not a servo motor) or vibration cell
Structural:
- Wood pieces
- Wood glue
- 2 small wood screws
- 2 strong magnets
- Washers for the number spice/powder containers desired
Tools
- Screwdrivers
- Soldering iron
- Drill
- Small hacksaw
- Precision scale or weights for calibration purposes
Step 1: Assemble the Interface Circuits
First things first, let’s put together the interface. It will make some of the calibration steps later a little easier. Starting with the LCD screen, and associated potentiometer dial (put on the pump circuit board), wire up a breadboard according to the diagram above. The potentiometer is only there to control the contrast on the screen, so it doesn't need to be on the front panel, cramping the rest of the interface.
Next comes the buttons. The two little button were salvaged from the scale circuit board, so you can wait to put them in unless you have other buttons you’d rather use (bigger buttons might suit your fingers better). The green button is the GO button, the red button is the STOP button, and the yellow button is the OK button for menu navigation. The two little buttons are used as LEFT (cyan) and RIGHT (purple) to navigate the menus. Wire them up like the left breadboard in the diagram above.
Step 2: The Liquid Circuit
Hooking up the pump is the next step. The pump we used (found here: http://www.adafruit.com/products/1150 ) needed 12 volts to run, so hooking the plug up properly is very important. The diagram shows how that should be done. There are 3 pins on the power supply connector, and the two that should be used are the back one for the voltage connection, and the pin opposite it for the ground, closest to the front of the plug. The middle pin isn't used in this design. There's a good explanation of the pump circuit, which we used ourselves here: http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/.
The pump itself is reversible, depending on which way the voltage and ground are hooked up. These are attached with the alligator clips, so you can swap them around easily if you end up mounting it backwards or something. There is a potentiometer knob on this, which is needed to control the LCD contrast, but not necessary to have on the main interface panel. There was room on this board, so that's where it goes. Feel free to move it if you have a different structural design; it won't interfere with any of the pump circuitry.
Step 2b: Finding the true pump rate
Pumps come with a listed flow rate, but most of the time they don’t actually have exactly that rate. Since the goal of this is accuracy, finding out what rate the pump actually has is important. Basically, you’ll be pumping liquid through and timing it, refining the rate number over several iterations until you get the exact amount of liquid during a specific time as you were looking for. It is also important that the pump is primed before you start measuring, meaning that you’ve run water through the pump and it has no air inside it. This can be done without the code, by cutting on/off power to the pump manually. Having a graduated cylinder for this is nice, but regular kitchen measuring cups work fine if you can't get your hands on one for a little while.
Basic steps:
- Prime pump
- Time how long it takes to pump a given volume
- Calculate the rate
- Run pump for that amount of time
- Check volume matches your original volume
- If it does, you’re done, if not, repeat the steps
Step 3: The Powder Circuit
This circuit has two parts: the scale and the shaker motor. The idea is that the shaker agitates the spices enough to knock some loose and onto the scale. The scale weighs the spice and when it weighs enough for the volume entered, it stops the agitation. The circuit for this part should be wired according to the diagram above. There are some spices that this setup doesn't work for; we found it worked good for leafy spices, rather than the fine powders or things like mustard seeds. Since we're adapting spice containers to our design, it might help to get some shaker tops for them, rather than just the open top that some spices have. We also made the mistake of mounting our spice container completely vertical, but putting it at an angle will help reduce any initial excess. The next step will explain how to hack the kitchen scale to use the load cell inside it with the Arduino. Overall, we do recommend a volume auger system for this part; the scales don't really have the precision that is necessary for doing smaller amounts of spices, despite their claims. Our decision to use a scale was probably a direct result of our missing engineering knowledge.
Step 4: (Optional) Hacking the Scale
If you do decide to go with the scale, this is how you can go about it. This involves taking apart the scale, so have a screwdriver or two handy. It also involves un-soldering components on the circuit board, so a soldering iron is a must.
Open up the scale to get at the circuit board inside. There should be four wires close together, an E+, E-, I+ or S+, and I- or S-, which are red, black, green, and white. Detach these from the board. Also detach the wires going to the power source and remove the board from the scale. If it has buttons, feel free to take them off to use for your interface. There’s a pretty good tutorial here:
https://www.instructables.com/id/Arduino-Load-Cell-Scale/
The wires will probably need to be extended, so solder some extensions onto them and cover the joints with the shrink tubing. Now the scale has been hacked to work with our Arduino.
NOTE: The load cells in the kitchen scales do not typically have the precision they claim. Also, there is an additional threshold to overcome before the scale can detect small enough variations, which in our case we found to be 400 grams. That threshold determines the minimum weight of the container measured into. This issue is why the volume measuring auger is a much better choice for precision. This step also includes a way to figure out the threshold for the scale you choose, if you go that route.
The easiest way to find the threshold is to hook the scale up to the Arduino. Using the serial read example from the Arduino code should be plenty. You can take out the voltage part and just take the number from 0-1023. It also helps to have a scale standing by or a good variety of gram weights to use on the scale. What you’re looking for is the weight that the number the Arduino gets changes by one value for one gram. It might be possible to get more precision the higher the threshold, but with the scale we used, this was the best we could get. Each scale is probably different, but above is our calibration chart. It has an exponential curve, so based off of that, your threshold is where the curve begins to move upward more than sideways.
Step 5: Building the Structure
We built our structure out of wood, because it was handy and cheap, but the options for this are pretty much up to you. These are some pictures of construction along the way. Our design was to have the scale on the right, and the pump on the left. The storage reservoir for liquids goes behind and underneath the interface shelf panel, while the measuring containers sit on top of the scale, and the small wooden platform. The spice containers are held on with magnets, for easy exchange.
Step 6: Arduino Code
This is the part of the thing we are both very familiar with. Our code can be found here:
https://github.com/ryanmilvenan/measure_machine
It runs the whole deal, the interface, the pump, the scale and shaker motor. Pretty much the only things that should be changed are the pump rate and any spices/liquids to the list in the menu. It uses a finite state machine to keep track of the current state of the machine, and as a result has the capability to operate both the liquid dispenser and the solids dispenser at the same time.
16 Comments
16 days ago
i can't find FiniteStateMachine library. can anyone help me
Question 2 years ago on Step 1
This is amazing!
Could you give an estimate of the cost of materials?
3 years ago
For measuring the powder, I would use both the auger and the scale, but use the scale to weigh the powder container you are dispensing from, not dispensing to. When you are about to dispense, tare the weight of the container with the powder, and run the auger until the container has lost the weight you are trying to dispense. I would also use a PID loop to control the auger.
5 years ago
Spectacular.. How can I code project to give accurate volume per price
5 years ago
NYC project work perfectly..I would like to know though how I could get the pump give exact volume required per the price given
Question 5 years ago on Step 6
What about hx711 module?
Answer 5 years ago
You could probably adapt this to use the hx711 module, if that's your question. I haven't updated this code or project in 3 years, so there is bound to be newer and better technologies that come up that will improve it. If you do make a working version of the code that runs with the hx711 module, please do consider submitting a pull request on the code repository so others can benefit from your experience with it as well. If you have a more specific question, I'd be happy to try answering it, but unless you give me a little more context about what you're trying to do, I'm not sure how helpful I can be.
5 years ago
Hi there,
I'm doing this project with only the liquid dispensing functions.
I've uploaded the codes from sketch_apr01a.ino but am unable to get it to get anything displayed on the LCD display.
Any advice what else could be the problem assuming the connections are identical?
Reply 5 years ago
You probably have already figured it out by now, but the only things I can think of off the top of my head are to play with the potentiometer, make sure the contrast is good to make it show up. You may also want to verify that you are plugged into the correct pin type (analog vs digital). If that doesn't work, that part of the circuit was taken from the sparkfun inventor's kit tutorial on LCDs pretty much verbatim, so I’d try that example with your LCD to make sure that it functions at all. Since this code is 3 years old at this point, it is possible they changed the libraries needed to include with LCD as well, so maybe double check that.
7 years ago
i no understand code good but need change some . how ?
i need weight scale measure liguid and menu have only liguid select 1-100milliter.
i use weight sensor whit HX711 amplifield and arduino, liguid pump have 2 different type peristaltic pump, 1 = 500ml/min 2= 100ml/min, 1=6mm tube thick liguid and 2= 3mm tube smooth liguid. pump motor use at TIP 120 transistor, can anyone help me make code changes ?
Reply 5 years ago
If you got any answer let me know
7 years ago
Amazing build. How much did this build cost you and What is the tolerance limit for the powder dispension system?
8 years ago
nice project. maybe the scale needs a preload en then reset to zero to eliminate the treshold?
8 years ago on Introduction
Something like this would be great for baby formula, and I am surprised it isn't a marketed product already. Could load up a container of formula powder and attach a sealed container of water. Press a button for automatic dispensing. Bonus if it integrated in water heating to the desired temperature (maybe while dispensing), which might not be too hard to add. Once its all dispensed all the mother/father would have to do is shake and serve. Definitely a premium device and not required but I bet something like that would sell. Very nice instructable.
8 years ago on Introduction
Very useful for many applications. Are you considering the volume based powder dispenser?
8 years ago on Introduction
Really cool idea! Thanks for sharing!