-->
Page 1 of 1

ESP-Now-with-sensor, web server, and relay

PostPosted: Fri May 27, 2022 11:03 am
by Sirquil
Continuing ESP-Now previous project; added another ESP32 to remotely, change relay from off to on and back to off.

Project uses one ESP32 for BME280 sensor readings from an ESP-Now sender configuration. Second, ESP32 is a combination receiver and sender; hosts Async web server. Using web server "GET" request for "Camera view" calls function "relayOn" to send ESP-Now struct_message to third, ESP32 turning on relay. Third ESP32 configured as only a receiver to control a relay for completing battery power path powering a Wyse Cam v3 or to break battery power path. Goal is to conserve battery power; switching on only during a two minute viewing window. Ticker library instance onceTicker sets a two minute window; calling relayOff function; which sends struct message from second, ESP32 to the third, ESP32 turning relay off.

"collectdata2.php" is used with hosting website on a domain website server; used with the Asyncwebserver, "webInterface" function. Link in the file to Stephen Borsay's "Hackster.io" article; "Send ESP8266 Data to Your Webpage - no AT Commands!" is about the use of "collectordata2.php" file. Purpose of the php is to retrieve sensor data from your webserver and build a new web page "on-the-fly" dynamically!

Relay is emulated; easily, add your own relay N.O or N.C.

Project code

Previous Asycnwebserver project is the main portion of "ESP-Now-with-Remote-Relay."