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

Arduino + ESP8266 Connected to Server but no Datatransfer


#1

Hi.
I connected my Arduino via ESP8266 to the Server, but if I want to send anything from the APP, the Arduino doesn’t react.
My Code:

#define BLYNK_PRINT Serial
 #include <ESP8266_Lib.h>
 #include <BlynkSimpleShieldEsp8266.h>
 
 char auth[]= "***";
 char networkName[]="T-NET";
 char pswd[]="psw";
 
 #include <SoftwareSerial.h>
 SoftwareSerial EspSerial(10, 11); //RX, TX
 
 #define ESP8266_BAUD 9600
 
ESP8266 wifi(&EspSerial);
 
 void setup()
 {
   Serial.begin(9600);
   delay(10);
   EspSerial.begin(ESP8266_BAUD);
   delay(10);
   
   Blynk.begin(auth, wifi, networkName, pswd);
 }
 
 void loop()
 {
   Blynk.run();
 }
 
 BLYNK_WRITE(V3)
 {
   int vpv = param.asInt();
   Serial.println("Hey:"+vpv);
 }

Output Serial Monitor:

[19] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on Arduino Uno

[603] Connecting to T-NET
[4304] AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(656edbf)
compile time:Jul 19 2016 18:44:44
OK
[9594] +CIFSR:STAIP,"***"
+CIFSR:STAMAC,"***"
[9604] Connected to WiFi
[19962] Ready (ping: 23ms).

Could anyone help me?


#2

Welcome to the Blynk Forum.

It looks like you are connected just fine.

Need much more more details here… what have you set up on the App and on the Arduino that you are expecting a reaction from?

PS I fixed your pasted code formatting, as required in the Welcome Topic, that you have of course read :wink:

Blynk - FTFC


#3

Thanks for the formatting :smiley:

In the App I use a Switch Button with the output pin V3.
Off: 0
On: 1

On the Arduinio isn’t anything esle as the ESP8266 connected yet.
My expected reaction of the Arduino would be a line at the Serial Monitor like: “Hey:0” or : “Hey:1”


#4

Thats your issue then. While you can use that basic connection to control digital pins directly (e.g. set a button to D13 to control the built in LED). With virtual pins you will need code… however you get much more control over the long run.

EDITED OUT the rest of my preamble… the result of not reading enough of your code first :stuck_out_tongue_winking_eye:

PS, in debug mode you will get that type of basic info… just not so concisely written :wink:


#5

OK, Big OOPS :blush: … I missed the bottom of your sketch… where you DO have that function… OK, let me look closer…

I don’t understand why, but I have had some issues, at times, mixing in too much in a Serial.print() command… Split it up and also add in a Display widget V4 and a Blynk.virtualWrite() command like this:

 BLYNK_WRITE(V3)
 {
   int vpv = param.asInt();

   Blynk.virtualWrite(V4, vpv);

   Serial.print("Hey: ");
   Serial.println(vpv);
 }

And of course implement that debug command I mentioned and show us here what output it provides as well.


#7

I enabled debugging and used

My output was:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on Arduino Uno

[104] Free RAM: 1195
[625] Connecting to T-NET
[3812] AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(656edbf)
compile time:Jul 19 2016 18:44:44
OK
[4889] Failed to enable MUX
[10092] +CIFSR:STAIP,"***7"
+CIFSR:STAMAC,"***"
[10102] Connected to WiFi
[20299] <[02|00|01|00] 248be1aca64a45ffbec94602022320ef
[20472] >[00|00|01|00|C8]
[20472] Ready (ping: 23ms).
[20473] <[11|00|02|00]fver[00]0.4.8[00]h-beat[00]10[00]buff-in[00]256[00]dev
[20734] <[00]Arduino Uno[00]cpu[00]ATmega328P[00]con[00]ESP8266[00]
[20879] <build[00]Nov 12 2017 16:51:37[00]
[21028] >[00|00|02|00|C8]
[31006] <[06|00|03|00|00]
[31132] >[00|00|03|00|C8]
[41110] <[06|00|04|00|00]
[41238] >[00|00|04|00|C8]
[51218] <[06|00|05|00|00]
[51346] >[00|00|05|00|C8]

And at the Value Display isn’t shown anything.


#8

I have duplicated your code and everything works as it should… so the issue must be on the App side.

It is almost like it is connecting to the Server… but just not the same project you are using. Double check that you are using the correct project (you can confirm the last few characters of the Auth code in the devices screen).

Perhaps even Refresh and Email the auth code again (it will be a new one), then reflash your sketch with the new code.

Also double check your Widget settings… even post screenshots of the settings here if you wish.


#9

I refreshed the Token and sent it per mail.
Now I use a refresh interval of 1 sec for the Value Display.
Here are my widget settings.



Now I get this output at the serial monitor:

[19] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on Arduino Uno

[104] Free RAM: 1195
[625] Connecting to T-NET
[3812] AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(656edbf)
compile time:Jul 19 2016 18:44:44
OK
[11099] +CIFSR:STAIP,"***"
+CIFSR:STAMAC,"***"
[11109] Connected to WiFi
[33859] <[02|00|01|00] auth
[45353] <[02|00|01|00] auth
[45574] >[00|00|01|00|C8]
[45574] Ready (ping: 24ms).
[45575] <[11|00|02|00]fver[00]0.4.8[00]h-beat[00]10[00]buff-in[00]256[00]dev
[45835] <[00]Arduino Uno[00]cpu[00]ATmega328P[00]con[00]ESP8266[00]
[46232] <build[00]Nov 13 2017 18:03:09[00]
[46404] >[14|1E]b[00|04]
[46404] >vr[00]4
[47020] >[00|00|02|00|C8]
[47209] >[14|1E]b[00|04]
[47209] >vr[00]4
[48054] >[14|1E]b[00|04]
[48054] >vr[00]4
[49021] >[14|1E]b[00|04]
[49021] >vr[00]4
[50025] >[14|1E]b[00|04]
[50025] >vr[00]4
[51023] >[14|1E]b[00|04]
[51023] >vr[00]4
[52022] >[14|1E]b[00|04]
[52022] >vr[00]4
[53023] >[14|1E]b[00|04]
[53023] >vr[00]4

#10

@Paul99 you can’t push and pull data, it’s one or the other. So change the 1s in the widget to PUSH as you are pushing the data with the virtualWrite() function in your sketch.


#11

Ok thanks.
But it doesn’t solved my main Problem.


#12

@Paul99 as pointed out by @Gunner he has run the code and it’s fine.

That’s why we are saying it’s likely to be a problem with the way you have set up your project. First error you have is pushing and pulling.

Maybe put up your QR code and someone such as @gunner, that likes pain (Arduino with shield) could check it over.

Meanwhile check your project in the app for obvious mistakes like selecting wrong MCU etc.

Are you still not seeing anything in Serial Monitor when you press the button?

Presumably V3 is button and V4 is the display widget?


#13

Well, at least we know your App is connected to the correct hardware… I believe this is your display on V4 trying to ask for data every second (1000ms)… but that is not the mode you want anyhow, so, yes, switch it to PUSH and not a timed frequency.

Might as well update your Libraries as well, https://github.com/blynkkk/blynk-library/releases

And confirm you have the latest App… I think the Android one just got another update. today.


#14

I updated my Libraries, the Blynk App on my IOS Device and changed my Display to push.
But sadly this doesn’t changed anything.


#15

Based on what we have seen so far, we can conclude that your App and MCU (Arduino & ESP) are both connecting to the server and can see each other (your App probably shows the device is online and your Serial monitor did show that 1 second polling from the display before you set it to PUSH).

Incidentally, as you have your Button Widget in SWITCH mode, be aware that the display (when working correctly) will only show a state change when you actually change state. So, for example, if the button is ON when the MCU starts up, it will not know the current state of that button, until you change it again (to OFF)… there are ways around that, but first we need to get you seeing data working back and forth. Try changing the button to momentary so you can get rapid state changes to look for.

I also recommend you keep trying with a few other examples, and widgets. For example, this one will push the seconds to a display widget, set to PUSH, on V5

https://examples.blynk.cc/?board=Arduino%20Uno&shield=ESP8266%20WiFi%20Shield&example=GettingStarted%2FPushData


#16

Thanks for your hlep.:+1:t4:
It seems to be a serverside problem.
Now I connected my App and Arduino to a private local Server (with the same settings and code).
Until that it works. :heart_eyes:


#17

LOL :slight_smile: didn’t know that @Gunner is an undercover masochist!


#18

Neither did @Gunner :hushed: … Challenges? sometimes… pain?.. nope nope nope.