Idea is to send a control action for a relay from a GET request in a asyncwebserver. Remote location board will run off of battery; all it needs to do is activate relay, switching Wyse camera3 on/off.. Plan is to use ESP-Now from asyncwebserver that is running off of mains power. Already have figured out how to use get request using a flag to call for opening and closing relay.
Any ideals for communicating with the relay?
Can ESP-Now be used to receive control action for relay? Already have one receiver board.
Regards,
William
Hi.
Will the relay be connected with another ESP32 or ESP8266 board?
If you have a relay connected to an ESP32, it can receive ESP-NOW messages from other board and control the relay.
Regards,
Sara
Good Afternoon Sara,
One ESP32 will handle function of Asyncwebserver; with ESP-NOW receiving data from second ESP32; will use ESP-NOW, sending weather observation data. Third ESP32; using ESP-NOW, will need to receive relay control data.
Will I need to combine send and receive on ESP32 handling function of Asyncwebserver to send relay control data?
Project will be using deep sleep; to compound issues. First, I try to resolve ESP-NOW communicating with relay.
Best Regards,
William
See https://randomnerdtutorials.com/esp32-esp-now-wi-fi-web-server/ for how to combine ESP-NOW and WiFi web server. Note that ESP-NOW works on one channel. You would need to check the channel of your router and make it the same as the ESP32’s or change the channel in the code of the ESP32’s.
For deep sleeping ESP32’s I would suggest using Mosquitto. You can publish a message and then pick it up whenever the ESP32 wakes up.
Hi Steve,
Thanks for the link; already have WiFi and ESP-NOW combined, I am thinking; I need to have ESP-NOW send and receive in the same sketch as the Asyncwebserver.
Camera view that relay will turn on and off. Present camera is always on; battery discharges completely in a day.
GET request from client can come at any time for the video camera to be “live.” ESP32 board one will be on mains power; so no deep sleep. Second and third, ESP32 will run from battery.
Is there a way to use deep sleep on third, ESP32 board and awaken on receiving message?
ESP-NOW Two-Way Communication Between ESP32 Boards Will read tutorial; looks like what I am trying to accomplish, combining send and receive of ESP-NOW.
Regards,
William
Hi William.
Yes, you can combine receive and send on the same board.
Unfortunately, there is no way to wake up the ESP32 with an ESP-NOW message.
I hope this helps.
Regards,
Sara
This is why I suggested MQTT. You can set the ESP32 to wake up at time intervals and check for a new message. If there isn’t one, go straight back to sleep.
Thank you Sara appreciate the reply.
Hi Steve thank you for replying.
This project is a weather observation, web server with an option to view a “live” video stream. I believe checking at timed interval would not work for this application; since Camera view, GET requests from web, occur at random times and need close to immediate response. ESP32, board 2 is a BME280 sensor with deep sleep. ESP8266 or ESP32, board 3 will maybe have a sold-state relay; likely be a low power board on battery.
Regards,
William
I guess I’m not understanding why you need three boards when one can handle all of it. Is each board in a different location? Why do you need to deep sleep? Why do you need to run on battery? Perhaps an outline of what you are trying to achieve?
Hi Steve,
Receiver, ESP32 board 1 will be in the house, powered by USB power adapter; running web server and ESP-Now, two-way communication. Sender, Board 2 will be in a plastic, Stevenson screen in the yard; using deep sleep and solar power. Receiver, Board 3 will be in the shed; no electricity and limited by video camera, weather sealed USB power cable. Video camera is mounted above the shed.
William
You will have to figure out a way to get power to the shed. Video camera will drain a battery very fast and there’s no real way to replenish the battery. I guess you could put solar panels on the roof and a windmill but even then, unless it’s a very large shed, I don’t believe there would be enough power for a camera. You could try time lapse, say wake every 15 minutes, take a picture and save it to a server then back to sleep. You would have to figure out power requirements and change the frequency of on time to suit your battery and charging system.
Hi Steve,
Yes battery demand can be high; so far one day, plus a few hours on a 10,000 mAH power bank, for the Wyse Cam v3 being left on continuously. Objective for video camera is to see in near, real time approaching storm clouds.
I am turning relay on when a link is clicked on the webpage and turning off the relay with a “onceTicker” instance with the ticker library. Data is relay status, sent from the 2nd board with the web server; which receive BME280 readings from 1st board in the yard. 3d board controls relay remotely, in the shed. Solar is a future possibility; for now will swap out battery, power banks, as time permits.
Rather than using a camera to detect approaching storm clouds you may like to use a weather service API. NOAA has the free National Weather Service API. There are other API’s out there but I’m thinking the Tomorrow.io API is the one you should look into. It’s also free up to a point (500 calls per day).
Steve,
Already have camera installed and using camera. Making some progress…
William
Good Afternoon Sara,
Do you have a tutorial or example of using both sender and receiver on the same board? Have only been able to use mac address to broadcast to all (“FF’s”).
Keep getting: “Last packet Delivery Failed”. When sending from board combining bot send and receive.
William
Good Afternoon Sara,
Do you have a tutorial or example of using both sender and receiver on the same board? Have only been able to use mac address to broadcast to all (“FF’s”).
Keep getting: “Last packed Delivery Failed”. When sending from board combining bot send and receive.
William
Hi William.
As you’ve mentioned previously, we have this tutorial: https://randomnerdtutorials.com/esp-now-two-way-communication-esp32/
In that tutorial, both boards are senders and receivers.
Are you trying that tutorial? Are you getting the issue with that tutorial? Or have you modified the sketch?
If you’re using Wi-Fi at the same time, ESP-NOW and the other “Wi-Fi communication need to be assigned different wi-fi channels.
Regards,
Sara
Hi Sara,
I have separate WiFi channels for ESP-Now and webserver WiFi. Still; “Delivery Failure,” sending to “relay” receiver.
Correct me if I am wrong; trying to do something a little different than two-way ESP-Now. Board 1 is a sender; one-way, board 2 is a combo sender and receiver; both are one-way, and board 3 is a receiver; one-way. Board 2 receives from Board 1 and sends to board 3.
Board 2 requires two data structures; can this be accomplished?
Regards,
William
Good Morning Sara,
ESP-Now Relay Project is working ; you may mark this resolved.
ESP-Now; Relay Switched Remotely
Code updated 08/16/2022! Code: ESP-Now Relay Project
“Camera View” web server; option will use relay.
Regards,
William