4
\$\begingroup\$

I wish to build an automatic watering system for my greenhouse and I would like to get some advice on how to do it.

Here is a sketch of the greenhouse system:

enter image description here

What I have right now:

  • Solar Panel (10W, 0.55A, 18V);
  • Arduino Uno Board;
  • Humidity and Temperature sensors;
  • Raspberry Pi;
  • 5 Li-ion batteries (18650) - 2.4Ah and 3.8V each

What I would like to do:

  • Charge the batteries using the solar panel;
  • Use the batteries to power the Raspberry Pi and the Arduino Board;
  • Make a website on Raspberry Pi so I can read the humidity and the temperature online;
  • Water the plants when the humidity is under a certain value.

I would like to know:

  • How to build a solar charger for the batteries? I know that Li-ion needs some kind of Constant Current-Constant Voltage charger type so I was wondering how can I build such a system?
  • Is there any way to know the state of charge of the battery without an advanced measuring equipment?
  • Would a pump be more convenient than a solenoid valve, to let the water flow down? The challenge here comes from the fact that the valve or pump requires 12V, while to power the Arduino board, it needs only 5V (through the USB). How can I rectify these voltages?
  • Can I connect a valve/pump directly to an Arduino or do I need extra power from the batteries?

The questions might sound confusing because I'm not an expert in the field, and if it does, please let me know and I will try to add more details. I would appreciate any advice on how to make such a system and what extra components do I need.

\$\endgroup\$

closed as too broad by Andy aka, Voltage Spike, pipe, Enric Blanco, DoxyLover May 1 '17 at 5:53

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Shopping questions often get closed. \$\endgroup\$ – Andy aka Apr 29 '17 at 11:05
  • \$\begingroup\$ Thank you for the info. This is not the main purpose of this thread. \$\endgroup\$ – Physther Apr 29 '17 at 11:06
  • \$\begingroup\$ Well you've deleted one sentence that was related to shopping but you still have more to go hint, near the end of your question. You might still find it gets closed due to not enough research or trying to cover too many technical topics. \$\endgroup\$ – Andy aka Apr 29 '17 at 11:11
  • 2
    \$\begingroup\$ Maybe I'm seeing the tidied version but seems a perfectly reasonable question, should not be closed. \$\endgroup\$ – TonyM Apr 29 '17 at 11:47
  • 1
    \$\begingroup\$ The vaguely-looks-like-shopping thing gets a bit obsessive round here at times... \$\endgroup\$ – TonyM Apr 29 '17 at 11:56
7
\$\begingroup\$

Use a 12V lead-acid battery, it's easier to charge safely. Ditch the pi, it's a 5W waste. Use an arduino instead. If you need wireless link, use an ESP8266 and not an arduino, the ESP8266 can be programmed in Arduino IDE. Check arduino.stackexchange for how to make a webserver on ESP8266. Personally, I would use an ESP8266 to send data to a Pi (in your house), and have the Pi make a nice page with graphs etc., at 60s intervals.

Use DHT22 for temperature+humidity, or better, use SI7021. If you need many sense points for temperature, add some DS18B20 sensors.

On the arduino, you can use the Narcoleptic library to drastically reduce power consumption.

I have a 12V battery charger controller for solar with an arduino (without Narcoleptic), but it needs polishing. There are three stages to charging:

  • 1) constant current
  • 2) topping charge
  • 3) floating charge

I never figured out how to do these three without some type of current sensor, so I just sensed battery voltage with a zener, and cut-off charging at ~12.7, waited, sensed again, and if necessary resumed charging. I charged with 13.5V @ 1A. There is a magic voltage at which you do not stress your battery, where you do not have to cut off charging, but I do not recommend it. You can consider a 12V battery 'empty' at 11.5V, I do not discharge below this mark. At this mark I disengage my loads with a relay and raise an alarm by blinking an RGB LED red.

I have it on fairly good authority that lead-acid batteries can tolerate higher temperatures without losing efficiency, than all that Li-* stuff. Though I suppose I would probably embed my battery in a hole in the ground anyway (properly protected against humidity), to keep it out of harms way, and fairly cool.

This works well enough for your application. I recommend getting some low-impedance Vgs MOSFETs to control charging. The IRF9630 P-channel MOSFET is okay, remember a pull-up resistor.

If you want Li-* batteries, those 18650 batteries are cheap, but you need to put some money into the charge controller. You'll also likely need some step-up conversion to drive the various bits in your greenhouse, which wouldn't be necessary for a 12V system.

For the solar panel itself, you need bypass diodes from with anode on negative terminal, for each cell, and a nice fat 2A blocking diode with its anode connected to solar panel Vout. When not illuminated, or saturated, these things consume power from an available source. Regardless of which voltage you need to charge, you will need a step-down converter to the charge controller input. 18V is just the rated output, it's going to be lower quite often. If a quality step-down converter is out of bounds, budget-wise, try an LM350 (it is lossy) voltage regulator temporarily.

You should use a relay to drive the pump, and add bypass diode with anode on its negative terminal. A pump can be pretty noisy for arduinos. You may also want 100V 10-100uF decoupling capacitor on the pump circuit.

See http://www.bristolwatch.com/solar_charger.htm - it's a very nice and verbose article.

Here's an obscure diagram of my charger module: Charger diagram

And a picture of the prototype (Yes, I know it's not beautiful): Charger picture

Please ignore the 14.67 input voltage, I had the novel idea of using a LM317 current limiter. Don't do that. Just use 12.7V.

Edit: Use this as a template for your Pi webserver: http://randomnerdtutorials.com/esp8266-publishing-dht22-readings-to-sqlite-database/

\$\endgroup\$
  • \$\begingroup\$ Thank you so much for the great ideas! I was trying to avoid lead-acid, but it does make a bit more sense, especially because it can provide the 12V. Also, thank you for the Wi-Fi idea, didn't think about it. Makes sense! So you are saying that I could use the Arduino board for controlling the charge? It's a bit hard for me to follow the part with the pump. So you say that between Arduino and Pump, I should add a relay? And finally, do I need the battery only for the board and the pump will be powered by it or did I get it wrong? I'm looking at the diagram now and see what I can get out of it \$\endgroup\$ – Physther Apr 29 '17 at 13:26
  • 1
    \$\begingroup\$ The ESP8266 itself can replace the arduino, and will never draw 5W, or even 1W. \$\endgroup\$ – user2497 Apr 29 '17 at 13:54
  • 1
    \$\begingroup\$ @Physther Yes. See github.com/esp8266/Arduino/blob/master/README.md , there are many similar libraries. \$\endgroup\$ – user2497 Apr 29 '17 at 14:47
  • 1
    \$\begingroup\$ @Physther esp8266.com/viewtopic.php?f=29&t=3249 A temperature+humidity sensor setup. \$\endgroup\$ – user2497 Apr 29 '17 at 14:49
  • 1
    \$\begingroup\$ @Physther Yes, just via the relay's COM and NO port. \$\endgroup\$ – user2497 Apr 29 '17 at 16:16
3
\$\begingroup\$
  1. Use a battery management system to charge and monitor the charge level of the batteries. If you build it yourself, you stand an excellent chance of maltreating the the lithium batteries - causing them to fail and "vent with flames" which will cause your green house to go up in smoke as well.

  2. The BMS also solves your "how to monitor the charge state" question.

  3. Connect the batteries in series for over 12Volts. Use a buck regulator to get 5V to power the Pi and the Arduino. This way, you can power all needed parts from the batteries. Bucking down to the lower power for the 5V parts should be more efficient than boosting the high current stuff up to 12V.

  4. You cannot connect a pump or a solenoid directly to the Arduino or the Pi. You will either have to build an appropriate switching circuit (switches the 12V to the pump/solenoid using a 3.3V or 5V signal, many examples available on this stack) or purchase a relay module to do the switching.

  5. Whether a pump or a valve is sufficient depends on the physical setup. For gravity feed (using just a solenoid valve,) you need the tank to be high enough to provide enough pressure for the water to reach everywhere. For a pump, same problem - it must provide enough pressure and volume to water all of your plants, but still be low enough powered for your available power supply (batteries.) You will have to figure out how much water and how much pressure and whether gravity feed is enough or if a pump is needed.

You should be able to connect the sensors directly to the Pi and eliminate thevArduino. Fewer parts is usually better.

\$\endgroup\$
  • \$\begingroup\$ Thank you very much for your answer. So I guess if I plan to use Li-ion, I should purchase an already built BMS. As for the buck regulator, is it only to reduce the voltage from 12V to 5V for the board? And use the power for the pump/valve (the 12V) directly from the battery? I like the idea of eliminating the Arduino. I need to check if the sensors can work with it. \$\endgroup\$ – Physther Apr 29 '17 at 13:30
  • 1
    \$\begingroup\$ Yep. Power the pump or solenoid from the higher voltage, use a buck regulator to bring it down to power the Pi. \$\endgroup\$ – JRE Apr 29 '17 at 13:45
  • \$\begingroup\$ Thank you very much for your help!I can't really find a small BMS for multiple Li-ion cells. I found a charger for single cells: sparkfun.com/products/12885 and a kickstart: kickstarter.com/projects/electrodacus/… \$\endgroup\$ – Physther Apr 29 '17 at 13:56
1
\$\begingroup\$

You could always use some pumps like these which I also bought, just about the same price as a solenoid valve and 5v to boot

\$\endgroup\$
  • \$\begingroup\$ No way! I just ordered this one early this morning. Thank you for your answer! \$\endgroup\$ – Physther Apr 30 '17 at 19:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.