Hi I’ve been trying to figure out how to fix a problem. I’m a noob and I’m working on a simple project to turn a relay on and off with a esp01 relay and a simple button in the blynk app. The sketch for the esp01 is the stock blynk example and it works great but upon power up the relay turns on and stays on until I hit the push button one time and then it works correctly. Push the on pushbutton the relay turns on and vice versa. I would like to use this with a program I modified for a arduino nano to water my plants.I’m using gpio0 for the relay trigger. Momentarily turn on for 2 seconds then off until I trigger next event. I would prefer to use the NO contact as a safety measure in case the relay goes bad but if there’s a power outage the relay will remain on until I discover a gallon of water on the floor. I’m pretty sure I’m current on the version of blynk
I’m using iPhone 7 with latest OS
I’m using ai thinker esp01 board
The relay board has a larger regulator chip on it
I have great power to board
I’m using a stock example from blynk application
I’ve been chasing around the Internet all night.
Please forgive me for rambling on here but I’m new and I’m asking if someone can point me in right direction.
Hi thank you for the quick reply. I’ll have to read up so I can post what info you’ve requested. Morning in this household is a bit crazy. Thank you for your hard work!
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Please be sure to select the right ESP8266 module
in the Tools -> Board menu!
Change WiFi ssid, pass, and Blynk auth token to run
Feel free to apply it to any other example. It’s simple!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "-GHY-3cpgOZ8i";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "2";
char pass[] = "7";
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}
@jmartens2 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
im currently reading up on the syncall command. and i dont have the sketch i used for the nano to control the relays. i was going to experiment with setting the bit hi in the sketch.
i must admit i also need to read up a lot more on blynk coding. i see there a ton of new stuff added at the github page. its been a while since i last visited
thank you
hi, ive been caught in a vortex of info. everything points to a virtual pin being updated/synced.
im using gp0 to turn the relay on and off. so i figure the sync command will not work. im currently trying to work this out. either i figure out how to trigger relay with virtual pin in e4sp01 blynk app or i need to work in my nano sketch. thank you for your help!! im trying hard
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Y-3cpgOZ8i";
// This function will run every time Blynk connection is established
BLYNK_CONNECTED() {
// Request Blynk server to re-send latest values for all pins
Blynk.syncAll();
}
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "2";
char pass[] = "7";
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
ive tried leaving the widget off
ive tried the widget on
ive inverted the 1 on pushbutton to 0 and back but all that happens is as soon as it connects it turns the relay on (led is lit and relay NO is closed) and i have to toggle blynk pushbutton to get relay to correct state.im beginning to wonder if theres a hardware problem at bootup thats causing this problemn. thank you so much for your patience.
void loop()
{
Blynk.run();
}
Well, as @Bill_Donnelly said, if you always want your device to start-up with the relay off, regardless of what is set in the app, then you should do this in your void setup.
You’ll need a pinMode declaration for whichever oin you are using, and a digitalWrite to set that pin to the desired state (HIGH or LOW).
but now the timer in app will turn on at start time but will not turn off after 2 second stop time.
is there a limit of time needed to update the stop time?
thank you for being so patient, i havent been helped like this in other forums.
hi, ive added another timer after the first (start)timer and the toggle causes the first (start)timer to shut off. things are a bit weird. there must be some kind of time issue. im going to continue to work at it later
Hello friend @jmartens2 , I would like to carry out the same project as you for irrigation. I hardly know about code, what little I do I get based on a lot of trying and many tests. Could you pass me your code to make my modifications regarding my internet and the times? I would appreciate. All the best.
Hi friend. I would love to help you. I think I could do that for you but I’m not sure of the rules here. Give me some time to read the rules on this forum. If I can post it here I will. Are you sure that you understand I have 2 programs here that work two different boards? I use the blynk app to trigger the event each day.
That may not make a lot of sense but I’m a noob also.but I will try to answer your questions.