Two ESP8266s and an Arduino?

Good Morning,

I’m really just getting started with the Arduino and ESP8266, but I have an ambitious project I’d appreciate some help with.

As I understand it, as well as acting as a wifi for the Arduino, the ESP8266 module can be programmed to run a simple code (using the Arduino as a bridge) and has a single, digital I/O pin which can be attached to a sensor or button. Is that correct?

If that’s the case, I’d like to have an ESP8266 attached to a rain sensor and another ESP8266 attached to an Arduino Uno which has a relay shield attached. So once there was enough rain to max out the digital pin (I realise I won't have the ability to set the rain trigger level as the input is digital, not analogue), the ESP8266 would send a message to the ESP8266 equipped Arduino and make it activate the relays in a specific sequence – i.e. to close a set of windows?

Is that possible? Can the ESP8266’s be made to communicate directly or would I require a router?

All help greatly appreciated!

an ESP8266 in the nodemcu format has multiple pins. you can use something like a tipping bucket to get digital pulses of rain quantity. the higher frequency the harder the rain, the total counts per hour or day is the amount of rain.

then have the wifi alert your phone

and you have pins to send out signals to the sprinkler.
and have pins left over for recording the light level
and have pins left over for data logging all this.

are you using all your pins and you need more pins ? one ESP can certainly control a greenhouse of a dozen sensors and a dozen relays for sprinklers.

Just remember that when you are designing your system with an Arduino in the center and and ESP8266's as peripheral devices, that the ESP8266 outspecs and outperforms the Arduino (say ATMEGA328P based Uno) in all respects, many times over.
It is a 32bit 80Mhz device with 96KB ram. Where the Arduino is greatly superior, however, is the quality of the documentation and supporting 'ecosystem'.

The more I read about the ESP8266, the more I appreciate how capable it is, but there's very few idiot-proof guides for getting it up and running the way I want (i.e. an ESP8266 with a sensor communicating with an Arduino using an ESP8266 as a wifi module). In comparison, the Arduino Uno has a wide array of projects and documentation. Plus I have enjoyed playing with my Arduino Uno, but it's time to put it to permanent use in an application.

The windows I want to control are on a conservatory roof, linked to a keypad which has a PIN code.
I have 6 relay boards which will be soldered to the keypad buttons to enter the pin code and control the window's which need to be opened. I'll let the Arduino do that side of things as I'm confident I can program and activate it manually.

I want an ESP8266 with a rain sensor out in the garden, ideally running off a solar cell and a USB battery pack which I already have (with a 3.3V converter).

When the rain sensor digital input on the ESP goes high, I want it to activate the 'Close Windows' relay sequence in the Arduino (i.e. enter pin code, press 'right' button a few times, then press OK). When it goes low again, I want it to tell the Arduino, which will wait for a set time (to make sure the rain really has stopped) and then activate the 'Open Windows' part of the program. Not interested in logging or anything, just want a smart way to open and close the windows based on kit I already own.

How do I get the rain sensor ESP to communicate with the Arduino?

Thanks for the help!