So far, in my “Growing Plant System” project, I’ve managed to display all the data from my sensors on my Blynk app. Now, I want to go a step further and add a button that will control a relay.
More exactly, I want to get a notification from my app when the value of my soil moisture sensor has fallen under a threshold, so I can know when to go and activate my water pump using a button inside the app or the web
What do I need to do in Blynk.Console datastream / events.
Put a tick in the “Available in Conditions” and “Available in Actions” checkboxes in the Automations part of the datastream. Do the same for your soil moisture datastream.
Nothing.
In the app, click on Automations (at the bottom) and create a new automation.
You can either set a condition of something equivalent to “if soil moisture < xxx send a notification” or “if soil moisture < xxx switch the Water Pump on”.
If you don’t need the water pump turning on automatically then it doesn’t need to be available in conditions/actions.
Ok, I’ve done the automation part, really cool stuff ! And easy aswell.
Now I’m gonna try and implement my relay , and yes, I do plan to also have it fully automated ( to turn on by itself for an x amount of seconds of condition is met ) .
I am already. I’m using millis() and creating events once every x seconds. If you check each functions , all of them have conditions to only do stuff after x seconds have passed. It’s multi-tasking implementation
I dont understand why im getting an error regarding Wifi.h when im not even using it ?
Also , an error regarging BlynkTimer timer aswell.
What am I doing wrong ? Do I need or not to use #include <WiFi.h> and #include <WiFiClient.h> with the new Edgent library?
Edgent_ESP32:40:12: error: redefinition of ‘BlynkTimer timer’
BlynkTimer timer;
^
In file included from C:\Users\filim\AppData\Local\Temp\arduino_modified_sketch_821966\Edgent_ESP32.ino:15:0:
sketch\BlynkEdgent.h:111:12: note: ‘BlynkTimer timer’ previously declared here
BlynkTimer timer;
^
Multiple libraries were found for “WiFi.h”
Used: C:\Users\filim\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1
redefinition of ‘BlynkTimer timer’
Another stupid question, but I cant figure it out. How can I set up my switch button ( both web and app) to send 1 when its OFF and 0 when ON? ( my relay is in normal open configuration , so I need to send 0 to to start it ).
I can of course set the ON value as 0 and OFF as 1, but then my switch button will turn on when I want to close my relay , and off when I want to start the relay, which is confusing as an interface
My program has a weird behavior when I start my pump. The ultrasonic sensor that is used to read my water level is showing 100% everytime I enable the pump , and then goes back to normal .
Showing 100% level either means:
the sensor reads a distance of 2cm or less all of the sudden
First of all, you have to stage timers
You have 3 timers at same time
then, you should insert Serial.println(distance) before if condition , to see the results in your serial monitor.
Very nice post!
So let me know I understood it corectly. I should use different periods of time, but also be careful for them to not be combinations like 1 sec / 2 sec or 2 secs / 4 secs etc .
Of course, I dont plan to call my temperature/humidity sensor once every 3 seconds. I was doing this now just so I can test things out. I will definitely make those numbers higher , 30 secs ++++ .
I will ran some tests to check how long each function takes to also have an idea on the delay .
Thank you very much for the information ! I will come back here if I have further problems with this project, to not spam the forum with new posts