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.
- Use the transistors available spare parts bin
- No need for speed control so PWM not required
- Dispense a specific volume (ml) of liquid
- Pump a volume (ml) liquid over a period of time (s)
- Periodically dispense a volume (ml) of liquid every interval (s)
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.
DA_PeristalticPump XY_001 = DA_PeristalticPump(XY_001_PIN, HIGH);
XY_001.dispenseVolume(50); // dispense 50ml
XY_001.dispenseVolumeEvery(10, 15); // dispense 10 ml every 15 seconds
XY_001.dispenseVolumeOver(150, 600 ); // dispense 150 over 10 minutes (600 seconds)
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.
Hydroponic – 4 Months Later
It has been 4 of months since the Arduino-based hydroponic control system has been in operation and I’ve since harvested arugula and lettuce. I’ve added a couple of columns to to grow cherry tomatoes. For the most part it has been a good experience.
I’ve finally added EC and pH measurement from Atlas Scientific and programmed it using I2C rather than serial. I also added voltage isolation between the probe and the rest of circuitry to reduce changes of noise interference. Data collected is via modbus over xbee to my SCADA host as before. The updated wiring includes the two extra sensors as shown below.
The spike in measurement resulted from adding more nutrient and pH down to the nutrient tank. More about that later.
New Development Environment
Most noteworthy, I migrated to using PlatformIO as the dev environment given that it supports multiple boards, has a command line interface, integrates nicely with the Atom editor and github.
- Inconsistent distribution of flow. The drip lines where sitting at the top and some plants would not get enough water. Fix: added 2″ caps (orange in pic) ensuring proper alignment of drip line.
- Water leaking to the floor. I could have done a better job in making the holes to host the net pots. When harvested, I would have to keep an empty net pot to avoid dripping of water. Fix: Replaced with 2″ Wye. It holds a 2″ net pot nicely. I could not find white wyes that did not cost and arm and a leg. I opted for the black drainage type. The photo shows a trial test.
- 3″ net pots to hold cherry tomatoes is throwaway. The holes where made into 4″ pipe and it caused all kinds of issues. Fix: Replace with TODO wyes.
- Drain pump. The one I bought is too slow and noisy. Fix: I use a wet vac to drain the water. It is a lot faster and helps with cleaning the tank.
- Level Sensor: The sensor got destroyed with the splashing of the nutrient mixture over time. Also, the readings on average were correct but I did not like the range in level during operation. Fix: Removed and looking for different sensor.
- Topping off nutrients is ok a the start but after a while, I just want to system to take care of it all. One has to add it over a period of time rather than in one shot. Otherwise, spikes in pH/EC occur. Fix: purchased nutrient containers and some peristaltic pumps. With some TODO driver circuitry and code, managing nutrients should be mostly automated.
The following plot represents nutrient temperature and growing chamber temperature. The nutrient temperature is on the low end of the range and I’m going to test to see if keeping the temperature around 21C (70F) impacts the growing cycle.
The fun stuff begins and it is machine vision. One to assess how well photosynthesis is occurring and the other is to measure growth.