With help from Jake and Emborg I think I now have an idea how to go about
making the garden nodes do what we want.
We'll use the ESP8266-07 version which has a number of useful features over
the cheaper versions:
* A single ADC input (cheaper versions have none)
* Many more GPIO pins
* Shielded wifi chips
* Both ceramic on-board antenna and u.fl connector (not that we really need
either)
And it's still only $3.34 including shipping:
http://www.ebay.com/itm/ESP8266-Remote-Serial-Port-WIFI-Transceiver-Wireles…
We'll then use a 4051 chip to switch between eight different analog inputs.
These are dirt cheap (about 13 cents apiece if you buy 100):
http://www.aliexpress.com/item/CD4051BE-CD4051-4051-Free-shipping-100PCS/32…
Selecting analog input will take up three GPIO pins, but we have plenty.
We'll use three one-dollar solar garden lights:
http://www.dollartree.com/household/outdoor-living/Stainless-Steel-Solar-Po…
We will connect them such that their batteries are hooked up in series,
providing a maximum of 3.6 volts total for the ESP8266 (which happens to be
the maximum it can handle). If we're worried about too much voltage then
that can be dealt with easily, and the minimum voltage is 1.7 volts, which
makes things easy.
The ADC is 0-1 volts, so we'll use a voltage divider to read the voltage of
the three series-coupled batteries.
The ESP8266 has a deep sleep feature where it basically uses no power. It
can be programmed to wake up after custom amount of elapsed time. We'll
program it to wake up e.g. every ten minutes, measure the voltage, then
shut down if there is not enough. If there is enough voltage it will read
sensor data, connect over wifi, report data, and go back into deep sleep
mode.
We will measure soil humidity using a capacitance measurement which
requires two GPIO pins and two analog inputs. Treehearder already has the
code for this, it just has to be ported from an Atmel attiny to the
ESP8266. The sensor consists of two long pieces of conductive metal wrapped
in thin non-conductive insulation (two long pieces of iron in heat-shrink
tube should be good) and a couple of simple support components.
Measuring door opening/closing is still up for grabs. I'm not sure how to
do this reliable on any type of door/gate in a way that will be reliable
and won't break. On top of that it's not clear whether we'd need to check
door status more frequently than every few minutes but if we do then we'll
need some way to save "the door was opened" such that the ESP8266 will know
about it when it wakes up. This could be done with a simple flip-flop/latch
circuit.
For directional antennas we can make a laser-cuttable Yagi template (using
online template-generators and some inkscape foo), cut and hot-glue copper
elements onto the template and fit the assembled yagi into a piece of PVC
pipe and seal with hot glue. It probably makes sense to fit the ESP8266
inside of that tube as well and cover it in hot glue to avoid
condensation-related failure. Jake suggested that we simply solder the
ESP8266 board straight onto the yagi active element.
All of this being said, I'm 100% for mcgyvering the first prototype using
whatever is fast and easy!
--
marc/juul