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.
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
- 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
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
- Wood pieces
- Wood glue
- 2 small wood screws
- 2 strong magnets
- Washers for the number spice/powder containers desired
- Soldering iron
- 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.
- 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:
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:
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.
We have a be nice policy.
Please be positive and constructive.
What about hx711 module?
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.