BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

ESP8266-12F to run Relay

esp8266
#1

I’ve been searching around for a few days… and I haven’t really found any answers…

I have an ESP8266-12F programed with the “ESP8266_Standalone”
the only editing I have done to the code is add my ‘auth’ token and set my network SSID and Password.

I have my button all set up in the blynk app and I can see when the esp comes online. I can easily turn the light on the ESP on/off by setting the blynk button to Digital gp2 but if I set the button to use Digital gp4 it immediately activates the relay as soon as I hit ‘play’ in the blynk app… and the only way to deactivate the relay is to set the app to a different gpio and power cycle the circuit.

It seems that by activating any digital gpio it then has a dc voltage of 0.2 when not active… and an activated voltage of 3.3 but apparently the 0.2v DC is enough voltage to trip my 5v DC Relay??

I was reading somewhere that I should be using Virtual pins instead of digital in the blynk app?
is this true? if so how do I Define the virtual pins? and link gpio4 to V19? because just setting my button to use Virtual pin 19 (defined as gpio4) It does not work.

So I assume I need to do some rudimentary programing! woo!
Is there a good tutorial for basic blynk program language and syntax?

I am excited to automate more things in the future and not just relays, but they can be a valuable asset in themselves :smiley:

Thanks for any and all input.
if you need more info from me, just ask.

0 Likes

#2

Is your relay Active HIGH or Active LOW?

If active LOW then YES

What are your button settings? Push or Switch?

0 Likes

#3

You joined the forum two days ago, and have spent a total of 15 minutes reading 20 posts in 4 different topics.
image

Personally, I wouldn’t say that that constitutes “searching around for a few days”.

I would certainly recommend using virtual pins rather than digital ones, if only because it gives you much more control over how you talk to your hardware.

If you have a button widget attached to V19 then when it’s value changes it will automatically trigger a function within your code called BLYNK_WRITE(V19), assuming that you’ve created that function when you wrote your code.
The value of the button widget (0 for off or 1 for on) can then be read within the BLYNK_WRITE function and appropriate actions taken (such as setting a GPIO pin HIGH or LOW).

Do a bit of searching for BLYNK_WRITE and you’ll find some answers. If you get stuck then come back here with your code and an explanation of what’s happening and we’ll try to help.

Pete.

0 Likes

#4

Thanks for your quick response PeteKnight, Also I think we should keep the criticism constructive?

:smiley:

here’s my code:


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "";

char ssid[] = "";
char pass[] = "";

/************switch button on android*************/ 
BLYNK_WRITE(V19) // virtual V19 to activate relay
{ 
    digitalWrite(V19, param.asInt());  // use value provided by widget
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

I haven’t had a chance to check it because my Adafruit Huzzah Feather board broke; but I thought we could at least run it by you guys, see what you think! While I figure out how to program the generic ESP12 without getting:

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

0 Likes

#5

I personally happen to think that encouraging people to read more, and by inference learn more is constructive, and I’d highly recommend it to anyone.
I joined the forum two years ago yesterday, and apparently since then I’ve spent 24 days of my life reading 49,000 posts

One of the things you apparently didn’t read was the welcome information when you joined the forum, or the information that appeared when you created this topic, which explained how to format code properly so that it displays correctly:
Blynk%20-%20FTFC

You should use the pencil icon at the bottom of your last post to edit the post and insert the backticks.

To save me responding separately to the PM you sent:

Hey Pete,

I certainly hope you were just having an off day and took your anger out on me, and do not greet all new members with the same haughty tone you started your post with.

I do value your input and just wanted to make sure you were okay.

Let me know if I can help. I am a good listener :slight_smile:

Take Care Pete,
-Luke

Thank you for your concern regarding my mental health, but don’t wait in for my call.
I can assure you that you have never witnessed my anger - very few people have :wink:
If you don’t like my “haughtiness” then that’s fine, I’ll step back and let other forum members chip-in with their thoughts.

BTW, as you appear to be of a delicate disposition, I’d avoid heading over to stackoverflow.com, if you want C++ coding tips, they can be brutal over there!

Pete.

2 Likes

#6

i get the same error, until i install and follow the instructions for the ch340 driver. The instructions were printed on the back of my board.

Until you can get to the point of uploading a sketch, the blynk library wont do much for you. I would try to get the arduino blink code to work first.

0 Likes

#7

Wow, now we can get psych support in this forum… the benefits just keep rolling in :rofl::rofl:

I always get a kick out of new members acting all put out when we give them responses that while sometimes flavored with personality, is at least still actual answers and advice, instead of :cricket::cricket::cricket:

The easier it is for anyone to learn new stuff and find answers on their own, the more it seems their attitude is “Give me all the help and answers I want, quickly, and do it with nothing but kind words and back patting… cuz I am a No0B and thus deserve it”

2 Likes

#8

Im not sure how you guys deal with kind of stuff. Its very frustrating.

1st post

“hey, i bought a $3 chip, i want it to be my new girlfriend, who has the code for that, please help, urgent”

2nd post

“Ive already searched how to do it, but not really. Oh, im supposed to do my own coding?, Im not going to do that”

Part of my soul disappears everytime i read this. And its more than once per day.

2 Likes

#9

I know Blynk professed “No programming needed”, but the fact is that is more marketing & less reality. Yes, some stuff can be done with minimal programming… but rarely is that good enough for actual needs.

It is mostly bog standard Arduino style programming, so thousands of tutorials out there.

As for the Blynk specific Library stuff… lots of examples and documentation here for that… Scroll up to the top of this page and start clinking on the Docs, Help Center and Sketch Builder links for that.

You want our assistance, you get our personalities…

Honestly, we (fellow forum members that VOLUNTARILY take our time and effort to respond) do get very sick and tired of the constand “I searched all over the world and can’t find any help” type messages from self proclaimed noobs, as if that was a badge of righteousness, deserving of hand holding or something.

And yes, I was even one of those asking for more code examples (at the time we didn’t have the resources Blynk has since made availed) but after some “gentle” urging of others, I quickly buckled down and exercised my Google Fu :muscle: And so can you :wink:

PS, here are a bunch of examples i have been building that may give you something to experiment with for “How to code with virtual pins”

1 Like