Peristaltic Pumps for Hydroponic Nutrient Dispenser

Nutrient Containers and Pumps

Time to mock up some hardware and write some code to drive the pumps using the nutrient containers and pumps now on hand.


  1. Use the transistors available spare parts bin
  2. No need for speed control so PWM not required
  3. Dispense a specific volume (ml) of liquid
  4. Pump a volume (ml) liquid over a period of time (s)
  5. Periodically dispense a volume (ml) of liquid every interval (s)

Wiring Diagram

I did not have any MOSFETs on hand and the BJTs available could easily drive small loads.  The measured current draw of the pump came in at around 160mA. The max current the Arduino can source is 40 mA per pin with a max of 200mA combined. Given that the hydroponics drives several circuits, I opted to limit the driving current to 4mA resulting to a 1kΩ resistor and would drive the transistor into saturation. (switch mode).









The flyback diode is to prevent any back-emf to harm the transistor.  The before and after reveal  shows the effects of shunting the excess voltage when turning off the pump.






The software is built on top of what is currently written. The partial class diagram with public methods highlights the gist of the PeristalticPump class.









Dispensing fluids becomes quite simple. I’ve tested the outputs using an oscilloscope. The one issue the cheap pumps and hoses is the max flow rate degrades over time. e.g. hoses don’t contract and expand the same way. I will deal with that later but there is a method to set the maxflowrate which could be part of the calibration process.


Now that this is unit tested, it is time to replicated the setup 2 more times, and come up with a control philosophy for pH/EC.