Wifi add

My plant watering system is coming along nicely with the great help of this forum. I would like to add WIFI to my project to send data to a iot. I am also looking at gather weather data to project when it will rain so the plant system will not water the plants.
I am looking for the best way to do this. Thank you for the help.

Project include Arduino uno

Try a Google of ESP8266 and Weather Stations. These chips are great for adding Wifi, accessing the internet, and in many cases like with something the NodeMCU board, just running your entire project as well. I have done a tone of Wifi and weather projects with them including weather sensors and displays.

wzaggle:
Try a Google of ESP8266 and Weather Stations. These chips are great for adding Wifi, accessing the internet, and in many cases like with something the NodeMCU board, just running your entire project as well. I have done a tone of Wifi and weather projects with them including weather sensors and displays.

I do like the esp8266 for small project. The Arduino has more analog pins and it seems works better for this project. I see alot of help has gone out to connect an esp8266 to an Arduino. But I also see a lot of people having trouble with it too. Which is prefer of the esp8266 with the Uno? Which iot is prefer with an UNo and esp8266? Thanks again for the help

Sprinkfitter

Have started using the new ESP32 with a lot of success. Dual Core, Wifi, Bluetooth, Lots of IO pins, and pretty cheap at $10. BLE and Wifi had some issues but it is pretty steady as of the last update.

I have also used ESP-01 and ESP-12e both stand-alone and with serial connection to other processors like the UNO.

Nice to offload the Wifi stuff and not burden a smaller controller. I am sure others on the forum will have their preferences and suggestions as well.

wzaggle:
Have started using the new ESP32 with a lot of success. Dual Core, Wifi, Bluetooth, Lots of IO pins, and pretty cheap at $10. BLE and Wifi had some issues but it is pretty steady as of the last update.

I have also used ESP-01 and ESP-12e both stand-alone and with serial connection to other processors like the UNO.

Nice to offload the Wifi stuff and not burden a smaller controller. I am sure others on the forum will have their preferences and suggestions as well.

As the name says Newbie and very much a beginner I will say the esp32 is a great chip but let just say not all the way cooked to my liking. The Arduino on the other hand is season veteran. Tons of libraries and one great forum This beginner needs all the help he can get. I hope one day soon it will be less reading and more building. LOL.
I have not had very much luck with the esp8288 01. I think I fried one and the other don't act right. I will try the esp8266 12e. Any help on getting it up and running would be great.Is any difference hooking up the 12e with a Mega instead of a Uno. I ask that because for the last few days I have been running the code on my Uno for the plant watering system. I have a Mega as a stand by.
Sprinkfitter

Looks like this topic is dead. Thanks for the help

Answers are as good as the question.
You mentioned a "plant watering system", but nothing more.
You could at least have explained what that system should do.
An ESP is a 3.3volt processor (all fast ones are), and that (3.3volt) could restrict you in choosing sensors etc.
Bare ESP modules need supporting parts.
A newbie (or parts-fryer) should start with a complete ESP board (WeMos etc) instead of the bare module.
That excludes an Uno/Mega with an ESP-01 dangling off it.
More I/O shouldn't be a problem with I2C expander chips.
Leo..

I started this project with an esp8266 12e.  Then went to an esp32. The first part was a lcd i2c with an rtc i2c.  I work trying to put the twn together on digital pins forever.  Until I went to the Arduino Uno analog pins did I get it to work.  So I  went ahead using the Uno wrote the code.  I have been running this code for a few days and everything seems to be solid.  
[
code]// RTC and LCD use i2c port (i2c Gnd 5V and pins a4 sda, a5 scl) DHT-11 BRICK unit uses Gnd 5V and pin 4
// Released to the public domain
//
/*-----( Import needed libraries )-----*/
#include <Wire.h>              // In standard library
#include <dht.h>               // https://arduino-info.wikispaces.com/TemperatureHumidity
#include <LiquidCrystal_I2C.h> // https://arduino-info.wikispaces.com/LCD-Blue-I2C
#include "RTClib.h"            // https://arduino-info.wikispaces.com/DS1307_RealTime_Clock_Brick
/*-----( Declare Constants )-----*/

/*-----( Declare objects )-----*/
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address Ox3F (Check yours)
RTC_DS1307 rtc;    // Create a RealTimeClock object (I set the time in another sketch)
/*-----( Declare Variables )-----*/
dht DHT;
#define DHT11_PIN 4 // use pin to sample data from DHT module
const int relay1 = 2; //Digital pin that the Relay is connected
const int relay2 = 5; //Digital pin that the Relay is connected
const int relay3 = 6; //Digital pin that the Relay is connected

const int OnMin1 = 46;
const int OnHour1[]= {17,18,19,20};//Array multi hour
const int OnDay1 = 16;
const int OnMonth1 = 12;
const int OnYear1 = 2017;
const int OffMin1 = 47;
const int OffHour1 = 17;
const int OffDay1 = 16;
const int OffMonth1 = 12;
const int OffYear1 = 2017;

const int OnMin2 = 42;
const int OnHour2 = 17;
const int OnDay2 = 16;
const int OnMonth2 = 12;
const int OnYear2 = 2017;
const int OffMin2 = 43;
const int OffHour2 = 17;
const int OffDay2 = 16;
const int OffMonth2 = 12;
const int OffYear2 = 2017;

const int OnMin3 = 17;
const int OnHour3 = 16;
const int OnDay3 = 16;
const int OnMonth3 = 17;
const int OnYear3 = 2017;
const int OffMin3 = 17;
const int OffHour3 = 16;
const int OffDay3 = 16;
const int OffMonth3 = 17;
const int OffYear3 = 2017;

void setup()
{
  Serial.begin(9600);
  Serial.println("DHT TEST PROGRAM ");
  Serial.print("DHT LIBRARY VERSION: ");
  Serial.println(DHT_LIB_VERSION);
  Serial.println();
  Serial.println("Humidity % \tTemperature (C) \tTime \tDate");
  lcd.begin(20, 4); // defines it is a 20 character four line display
  rtc.begin(); // Start the RTC library code
}

void loop()
{
  // READ DATA
  DateTime now = rtc.now();
  int chk = DHT.read11(DHT11_PIN);
  Serial.print(DHT.humidity, 1);
  Serial.print(",\t");
  Serial.print("\t");
  Serial.print(DHT.temperature, 1);
  Serial.print(",\t");
  Serial.print("\t");
  Serial.print("\t");
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.print(' ');
  Serial.print(now.day(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.println(now.year(), DEC);
  lcd.setCursor(0, 0); // start postion of Humidity text on LCD
  lcd.print(DHT.humidity, 0); // 0 creates whole number, 1 two decimal
  lcd.print("% Humidity ");
  lcd.setCursor(14, 0); // start postion of temperature text on LCD
  lcd.print(DHT.temperature * 1.8 + 32, 0); //Farhenheit conversion
  lcd.setCursor(17, 0);
  lcd.print("F");
  lcd.setCursor(0, 1); // start postion of time text on LCD
  lcd.print(now.hour(), DEC);
  lcd.print(':');
  lcd.print(now.minute(), DEC);
  lcd.print('.');
  lcd.print(now.second(), DEC);
  lcd.print('.');
  lcd.print(now.year(), DEC);
  lcd.print('/');
  lcd.print(now.month(), DEC);
  lcd.print('/');
  lcd.print(now.day(), DEC);
  lcd.print(' ');
  lcd.setCursor(0, 3); // start postion of time text on LCD
  lcd.print("ZONE-1 " "ZONE-2 "  "ZONE-3");

  delay(1000); // screen - sample & LCD refresh time 1 second although DHT say min 2 seconds but works ok.

  if ((now.hour() == OnHour1) && (now.minute() == OnMin1) && (now.day() == OnDay1) && (now.month() == OnMonth1)) {
    digitalWrite (relay1, LOW);
    lcd.setCursor(1, 2);
    lcd.print("ON");

  }
  else if ((now.hour() == OffHour1) && (now.minute() == OffMin1) && (now.day() == OffDay1) && (now.month() == OffMonth1)) {
    digitalWrite (relay1, HIGH);
    lcd.setCursor(1, 2);
    lcd.print("OFF");

  }

  if ((now.hour() == OnHour2) && (now.minute() == OnMin2) && (now.day() == OnDay2) && (now.month() == OnMonth2)) {
    digitalWrite (relay2, LOW);
    lcd.setCursor(8, 2);
    lcd.print("ON");
  }
  else if ((now.hour() == OffHour2) && (now.minute() == OffMin2) && (now.day() == OffDay2) && (now.month() == OffMonth2)) {
    digitalWrite (relay2, HIGH);
    lcd.setCursor(8, 2);
    lcd.print("OFF");
  }

  if ((now.hour() == OnHour3) && (now.minute() == OnMin3) && (now.day() == OnDay3) && (now.month() == OnMonth3)) {
    digitalWrite (relay3, LOW);
    lcd.setCursor(15, 2);
    lcd.print("ON");
  }
  else if ((now.hour() == OffHour3) && (now.minute() == OffMin3) && (now.day() == OffDay3) && (now.month() == OffMonth3)) {
    digitalWrite (relay3, HIGH);
    lcd.setCursor(15, 2);
    lcd.print("OFF");
  }
}

//
// END OF FILE
//

Now I have been wanting to add wifi just to keep track of the relays. I also want to add a flow device.

With the esp8266 01 today I had one working with AT commands and then switch it to mode 3 and it work great. So I push my luck and put another one on the breakout board. AT = error. I decided to switch back to make sure the other one is still working and I got the old AT = error on that device. To say the esp8266-01 is challenging to me is an understatement. I have order some new boards
I have done a small project with the esp8266 12e with three soil sensor connected to a iot. Work great.
I was looking for information on hooking up an wemos mini with the uno. I have not found direction for it. I have not seen anyone use the mini that way. Probably a good reason why

sprinkfitter:
With the esp8266 01 today I had one working with AT commands and then switch it to mode 3 and it work great. So I push my luck and put another one on the breakout board. AT = error. I decided to switch back to make sure the other one is still working and I got the old AT = error on that device. To say the esp8266-01 is challenging to me is an understatement.

Useless story to us without knowing HOW you have connected the ESP.
The ESP is a 3.3volt processor, so did you use a level shifter on the RX pin.
How did you power the module, and which pins was it connected to.
Did you use SoftwareSerial, or the hardware serial pins on a Mega.
A diagram would clear things up (one of the requirements with problems like this).
Leo..

Yes crazy story!!!!

I connected the esp8266 12e like the following

GPIO15 (grey) -> pull-down
GPIO2 (blue) -> pull-up
GPIO0 (purple) -> pull-up
CH_PD (green) -> pull-up
REST (orange) -> pull-up
TXD (black) -> Arduino TX (pin D1)
RXD (white) -> Arduino RX (pin D0)
VCC (red) -> breadboard V+ rail
GND (brown) -> breadboard GND rail
Arduino 3.3V (red) -> breadboard V+ rail
Arduino GND (black) -> breadboard GND rail

Result nothing happen. Could not communicate at all with the device

I connected an esp8266-01 like this

The steps you need to take are simple. This is written for the ESP8266-01 but you can find the pinout for other models easily and use the same pins. First we will connect the Arduino UNO to a breadboard:

Connect the Arduino’s 3v3 (3.3V) output to the red line on a breadboard. The ESP8266 works with 3.3V and not 5V, so this is necessary. If you want to connect other components that use 5V, you can connect the 5V output to the other red line of the breadboard, just make sure you don’t connect the two.
Connect GND (ground) to the blue line.
Connect the RES or RESET pin to the blue line. When you ground the reset pin, the Arduino works as a dumb USB to serial connector, which is what we want to talk to the ESP8266.
Connect the RXD pin of the Arduino to the RX pin of the ESP8266 (yellow color in the picture).
Connect the TXD pin of the Arduino to the TX pin of the ESP (green color in the picture). Usually, when we want two things to talk to each other over serial, we connect the TX pin of one to the RX of the other (send goes to receive and the opposite). Here we do not have the Arduino talk to the ESP8266 though, our computer is talking to it via the Arduino.
Connect the GND pin of the ESP to the blue line and the VCC pin to the red line.
Finally CH_PD goes to the red line, supposedly it will not work if you do not connect this.

This actually work with on ESP 8266-01 but not other one ESP 8266-01
Now both do not accept AT commands returns error

Any help with the esp8266-01 is what I am looking for. Thanks

Sprinkfitter

This is the link I used for the ESP 8266-01
http://www.teomaragakis.com/hardware/electronics/how-to-connect-an-esp8266-to-an-arduino-uno/

Don't know what colours you're referring to. The ESP-12E is just a bare module with castellations on the side.
So no level shifter to lower the 5volt TX signal from the Arduino to the safer 3.3volt the ESP-12 is expecting.
And no (10k) safety resistors for the pull up/down/program pins.
Have a look at the diagram in this guide.

I assume you're using the Serial1 (or 2,3) pins on a Mega, or SoftwareSerial on an Uno, not pins 0 and 1.
(unless you use the Uno as a USB<>Serial bridge, with a blank sketch loaded).

Powering a module that needs ~400mA peak (transmit) current from an Arduino Mega 3.3volt pin that can only supply 150mA tops is not very wise. The supply might dip during those peaks, and create unexpected results.

You can power an ESP-12 from the 3.3volt pin of an Uno/Mega (not a smaller board like a Nano).
But you need a beefy buffer cap on that supply rail to have enough current reserve for those transmit spikes.
I use 470uF tantalum, but go to 1000uF low-ESR if you use an aluminium cap.
It might be better (long term) to use a dedicated external 3.3volt regulator that can deliver that 400mA.
Leo..

Wawa:
Don't know what colours you're referring to. The ESP-12E is just a bare module with castellations on the side.
So no level shifter to lower the 5volt TX signal from the Arduino to the safer 3.3volt the ESP-12 is expecting.
And no (10k) safety resistors for the pull up/down/program pins.
Have a look at the diagram in this guide.

I assume you're using the Serial1 (or 2,3) pins on a Mega, or SoftwareSerial on an Uno, not pins 0 and 1.
(unless you use the Uno as a USB<>Serial bridge, with a blank sketch loaded).

Powering a module that needs ~400mA peak (transmit) current from an Arduino Mega 3.3volt pin that can only supply 150mA tops is not very wise. The supply might dip during those peaks, and create unexpected results.

You can power an ESP-12 from the 3.3volt pin of an Uno/Mega (not a smaller board like a Nano).
But you need a beefy buffer cap on that supply rail to have enough current reserve for those transmit spikes.
I use 470uF tantalum, but go to 1000uF low-ESR if you use an aluminium cap.
It might be better (long term) to use a dedicated external 3.3volt regulator that can deliver that 400mA.
Leo..

Thank you for your reply. Thanks for the link great read and will try as soon as my new esp8266 chips get in.

Sprinkfitter

I think the ESP-01's c an be alittle daunting at first.. onc eyou set a nice little flashing setup going though.. its just 'rinse and repeat' (usually) without issue.

The ESP can be programmed directly from the Arduino IDE as well.. (and can actually be use in PLACE OF an aArduino if the ESP module of choice supports the needed I/O pins of course)..

In your situation.. you will really only need this to do the heavy WIFI lifting. I wouldnt stray from this approach, dont give up.

Alternately you could buy a wifi 'shield'.. but (for me).. the $2.00 USD esp board is by far a better purchase.

I think it would benefit you as well others if you broke down your wants/need into a list.. and tackle them one by one.

You mention want to send data from your 'garden' to the IoT....

  • what does that mean to you?
  • Is this a webservice somewhere? what one? link? protocol? data format? API?
  • Is this a local WAMP/LAMP install on a computer in your house? So you can locally log the data to a MySQL table or something?
  • So you need to to SENDING data out for this

You mention you want to gather weather data...

  • what does that mean to you?
  • Is this a webservice somewhere? what one? link? protocol? data format? API?
  • What do you plan to due with this data? Log it to a database/table for further analysis? Use it to immediately change the behavior in your garden?
  • To me..... I'm not really finding the 'weather service' additon beneficial.. while a 'cool feature'.... as it can be wrong, nothing will really trump the local senors (temp, rain..etc..etc) regardless of what some service tells you.
    -So you need to REQUEST & RECEIVE data for this

How do you plan to put all this together? What is the 'order of operation' so to speak?

IMHO.. this could be a super cool/fun project done just locally.. with the IoT being a WAMP/LAMP install on an extra (or current) machine somewhere in your house.

You can map and plot all the data you want.. simple PHP scripts to collecy all the incoming data and then log it to the table(s) you need.

Pulling the data out is another simple PHP script that can be used/shared anywhere.. (making graphs...etc)

xl97:
I think the ESP-01's c an be alittle daunting at first.. onc eyou set a nice little flashing setup going though.. its just 'rinse and repeat' (usually) without issue.

The ESP can be programmed directly from the Arduino IDE as well.. (and can actually be use in PLACE OF an aArduino if the ESP module of choice supports the needed I/O pins of course)..

In your situation.. you will really only need this to do the heavy WIFI lifting. I wouldnt stray from this approach, dont give up.

Alternately you could buy a wifi 'shield'.. but (for me).. the $2.00 USD esp board is by far a better purchase.

I think it would benefit you as well others if you broke down your wants/need into a list.. and tackle them one by one.

You mention want to send data from your 'garden' to the IoT....

  • what does that mean to you?
  • Is this a webservice somewhere? what one? link? protocol? data format? API?
  • Is this a local WAMP/LAMP install on a computer in your house? So you can locally log the data to a MySQL table or something?
  • So you need to to SENDING data out for this

You mention you want to gather weather data...

  • what does that mean to you?
  • Is this a webservice somewhere? what one? link? protocol? data format? API?
  • What do you plan to due with this data? Log it to a database/table for further analysis? Use it to immediately change the behavior in your garden?
  • To me..... I'm not really finding the 'weather service' additon beneficial.. while a 'cool feature'.... as it can be wrong, nothing will really trump the local senors (temp, rain..etc..etc) regardless of what some service tells you.
    -So you need to REQUEST & RECEIVE data for this

How do you plan to put all this together? What is the 'order of operation' so to speak?

IMHO.. this could be a super cool/fun project done just locally.. with the IoT being a WAMP/LAMP install on an extra (or current) machine somewhere in your house.

You can map and plot all the data you want.. simple PHP scripts to collecy all the incoming data and then log it to the table(s) you need.

Pulling the data out is another simple PHP script that can be used/shared anywhere.. (making graphs...etc)

First think you for your responds. There is so many possibility on which way to go on this project.

With the wifi I want it to be able to tell me if something is going wrong with the system. Dumping to much water.... Not coming on... Coming on at the wrong time.... This is the reason I thought adding a flow meter would help. I plan to use a iot like Cayenne to do the monitoring. I could see in the future having this done local and track it with screens set up in the house.

Determining when to water and when not to water is tricky. I believe the information is out there it just getting it and analyzing different sources to determine how likely it will rain.

Right now my focal point is getting it up and running. The esp8266 is the focal point now. Still waiting on parts to test the esp8266. WaWa gave me a great link to help me with the chip.

Thank You for the help.