Feather ESP8266 Wireless Indoor Irrigation Project, and Ques

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
petran1420
 
Posts: 93
Joined: Fri Jan 08, 2016 9:28 pm

Feather ESP8266 Wireless Indoor Irrigation Project, and Ques

Post by petran1420 »

Hi all!

I have a bunch of houseplants all on a table that take awhile to water, so I combined some components of Adabox 003 (namely the feather esp8266) with a Darlington transister, solenoid valve and some irrigation supplies to make an automatic watering system that can be turned on by Adafruit IO!

This is the solenoid valve in question. I couldn't use the Adafruit one because it needs at least 6 psi to function, I believe, and I was just using a gravity fed system that provides less than that:
Image
I whipped up my first ever proto board design using a Darlington transister as a switch. The esp8266 was hooked to the transistor's base pin, and when activated it switches the transistor on/off, either allowing or interrupting AC current provided by a barrel jack to flow from collector through the emitter of the transistor into ground. This switches on/off the solenoid valve, which is also wired into the AC portion of the transistor:
Image
Everything was small enough to fit into an Altoids tin, which I suspect was purposefully design by adafruit when making the perma proto board. The long wires hook up to the solenoid:
Image

I can switch the transistor on and off through adafruit IO. This is just a modified version of the Digital Output example for Adafruit IO. You'll need to make your own config file:

Code: Select all

#include "config.h"

/************************ Example Starts Here *******************************/

// define digital pin 4
#define SOLENOID_PIN 4

// set up the 'digital' feed
AdafruitIO_Feed *digital = io.feed("solenoid-trigger");

void setup() {

  // set solenoid pin as a digital output
  pinMode(SOLENOID_PIN, OUTPUT);

  // start the serial connection
  Serial.begin(115200);

  // wait for serial monitor to open
  while(! Serial);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  // set up a message handler for the 'digital' feed.
  // the handleMessage function (defined below)
  // will be called whenever a message is
  // received from adafruit io.
  digital->onMessage(handleMessage);

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();

}

// this function is called whenever a 'digital' feed message
// is received from Adafruit IO. it was attached to
// the 'digital' feed in the setup() function above.
// it is meant to show on the serial monitor if a message is received,
// then send that message (High or Low) to the solenoid pin. 
void handleMessage(AdafruitIO_Data *data) {

  Serial.print("received <- ");

  if(data->toPinLevel() == HIGH)
    Serial.println("HIGH");
  else
    Serial.println("LOW");

  // write the current state to the solenoid
  digitalWrite(SOLENOID_PIN, data->toPinLevel());

}
And here's the whole setup. Water from a gravity fed basin is taken into the 'closed' solenoid, and when it receives an 'open' command from adafruit io it lets water through into the 'header line' of irrigation. The header line has several smaller 1/4" tubes which flow into each pot. Larger pots have 2 lines going into them. Image



So far its working great! But I have one question. The esp8266 is currently battery powered with a small 500 mAh battery, so I have to charge it whenever I want to use this system. This isn't great because I have to be there whenever I want to use it, which sorta defeats the purpose. I can charge the feather battery and function the esp8266 simultaneously when I plug the usb cable into my computer, but the esp8266 won't function if I plug the usb into something like a portable battery I use to charge my phone. Is there any way to get around this? How can I power the esp8266 continuously without constantly connecting it to my computer? My suspicion is I would I need a 'powered' usb port, as oppose to the portable cell phone charging battery, which is 'unpowered' but I'm not sure because I'm not very familiar with what a powered usb port is and how it differs from an unpowered usb source.

Hope y'all like my project and can help me out!

User avatar
petran1420
 
Posts: 93
Joined: Fri Jan 08, 2016 9:28 pm

Re: Feather ESP8266 Wireless Indoor Irrigation Project, and

Post by petran1420 »

Oh duh, I bet I can just use a 5v adapter plugged into the wall to constantly power the esp8266, correct?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather ESP8266 Wireless Indoor Irrigation Project, and

Post by adafruit_support_mike »

Yep.. just plug a power-only cable into the USB jack and the Feather will run from that.

It will also charge the LiPo if one is connected, so you can have the best of both worlds.. run it from battery if you want to move it from one place to another, then plug it in for long-term operation.

User avatar
petran1420
 
Posts: 93
Joined: Fri Jan 08, 2016 9:28 pm

Re: Feather ESP8266 Wireless Indoor Irrigation Project, and

Post by petran1420 »

Thanks for the confirmation! Next up I want to put some soil moisture sensors in there and have the system water whenever it goes below a certain threshold.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather ESP8266 Wireless Indoor Irrigation Project, and

Post by adafruit_support_mike »

Fair warning: soil moisture sensing takes a bit of getting used to. It isn't the simple 100%-to-0% slope you might think.

The air between soil particles doesn't move much, and if there's any water trapped in the soil that can evaporate, it will. As a result, the humidity underground stays near 100% until there's no free water left. At that point, things are getting pretty dry.

Run some tests with a pot of plain soil to get a feel for how it works, and to test variables like sensor depth. The surprises are much less unpleasant that way. ;-)

User avatar
xtwombly
 
Posts: 14
Joined: Fri Jun 16, 2017 1:26 am

Re: Feather ESP8266 Wireless Indoor Irrigation Project, and

Post by xtwombly »

Please post about your experience with getting the humidity sensors working, once you've played around. I'd love to build a similar setup and would appreciate hearing about your experience with the sensors

-Xander

Locked
Please be positive and constructive with your questions and comments.

Return to “AdaBox! Show us what you made!”