Page 1 of 2

Cytron ESPWiFi Shield with Blynk

PostPosted: Fri Sep 09, 2016 5:38 pm
by azizi.afiq
I'm currently doing Blynk IoT project which we can control from Smartphone to the SHIELD-ESP-WIFI ESP8266 with CYTRON UNO. My ESP WIFI already connected to the Wifi, which I check through the AT+CIFSR command in Serial Monitor. It just a simple Blynk project, to turn ON and OFF the LED. However the problem I face is DHCP failed. Really appreciate if you can give me the solution, already look in other forum, but still not solved. Thanks.

Re: Cytron ESPWiFi Shield with Blynk

PostPosted: Sun Sep 11, 2016 7:33 pm
by bengchet
Hi,

A few photos or printscreens regarding results of serial monitor, hardware setup will be helpful. You can also attach here with the Arduino program so we can troubleshoot more easily.

Re: ESP8266 with Cytron UNO DHCP failed

PostPosted: Thu Sep 29, 2016 11:35 am
by azizi.afiq
Sorry for late reply bengchet. Still new to forum, and didn't know you already replied coz don't get notification.

Here's the screenshot and some pictures of the problem I faced:
https://www.dropbox.com/s/3z2cas4gdxw5z ... 8.png?dl=0

https://drive.google.com/a/brainbytes.o ... sp=sharing

https://drive.google.com/a/brainbytes.o ... sp=sharing

Hope you can help. Thanks a lot!

Re: Cytron ESPWiFi Shield with Blynk

PostPosted: Fri Sep 30, 2016 9:53 am
by bengchet
Hi,

For your case, you have to use this sketch.

CODE: SELECT_ALL_CODE
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Your Auth Token";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Your WiFi SSID";
char pass[] = "Your WiFi Password";

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

void setup()
{
  // Set console baud rate
  Serial.begin(9600);
  delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

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

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


You also need to install the attached library to Arduino Library folder. Extract to My Documents -> Arduino -> libraries.

After you have uploaded the program, you can open serial monitor to monitor the progress. If it shows "Ready (ping: XXms)", the blynk application is ready.

You can also find some reference here.

Hope this helps!

Re: Cytron ESPWiFi Shield with Blynk

PostPosted: Fri Sep 30, 2016 3:41 pm
by azizi.afiq
Hi bengchet,

Thanks a lot it really working!

Here's the link video if you wanna take a look:
https://youtu.be/2_R3TFYaoAw

Again to be clear on the problem. What I understand is the previous code for my .ino is not complete and it don't have the library for ESP8266, is it correct? Hope you can make a clear statement on what cause the problem for a learning process.

Again thanks a lot, you really helping me :)

Re: Cytron ESPWiFi Shield with Blynk

PostPosted: Fri Sep 30, 2016 3:59 pm
by bengchet
Hi,

You previous code actually includes wrong header file, which is meant for Ethernet shield. So if you want to use ESP8266 shield instead for your application, you have to include correct header file BlynkSimpleShieldEsp8266.h to let Arduino know actually you are launching Blynk application with ESP8266 shield.

Of course to allow ESP8266 to perform functions properly, ESP8266_Lib.h is the file you need to include in your sketch. It handles how ESP8266 connect to your WiFi network,send http request, fetch data from Blynk server, etc.

I have to admit Blynk community has done a good job for creating such powerful library which can support so many platforms, including ESP8266 shield.

Thanks for sharing video and have fun learning! :D

Re: Cytron ESPWiFi Shield with Blynk

PostPosted: Tue Oct 04, 2016 9:23 am
by azizi.afiq
Hi bengchet,

Thanks again for your explanation. I now understood and really thanks for your help and kind :D

Re: ESP8266 with Cytron UNO DHCP failed

PostPosted: Thu Oct 06, 2016 4:47 pm
by jim0
Hi, faced this error even though have included all the mentioned files in libraries. Kindly advise tq!

Error:

Arduino: 1.6.10 (Mac OS X), Board: "Arduino/Genuino Uno"

In file included from /Users/Mac/Documents/Arduino/libraries/BlynkESP8266_Lib/BlynkSimpleShieldEsp8266.h:25:0,
from /Users/Mac/Documents/Arduino/Projects/Blynk/latestblynk2/latestblynk2.ino:3:
/Users/Mac/Documents/Arduino/libraries/BlynkESP8266_Lib/BlynkApiArduino.h:14:28: fatal error: Blynk/BlynkApi.h: No such file or directory
#include <Blynk/BlynkApi.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Re: ESP8266 with Cytron UNO DHCP failed

PostPosted: Fri Oct 07, 2016 7:43 pm
by bengchet
Hi,

Your Arduino seems can't find your Blynk main library. You might need to install Blynk library first. Go to Sketch -> Include library -> Manage libraries. Type 'Blynk' in textbox and there you go.

Re: ESP8266 with Cytron UNO DHCP failed

PostPosted: Fri Oct 07, 2016 9:47 pm
by jim0
Hi Bengchet,

Thanks for kind reply.

Still same error message:

Arduino: 1.6.12 (Mac OS X), Board: "Arduino/Genuino Uno"

In file included from /Users/Mac/Documents/Arduino/libraries/BlynkESP8266_Lib/BlynkSimpleShieldEsp8266.h:25:0,
from /Users/Mac/Documents/Arduino/Projects/Blynk/latestblynk2/latestblynk2.ino:3:
/Users/Mac/Documents/Arduino/libraries/BlynkESP8266_Lib/BlynkApiArduino.h:14:28: fatal error: Blynk/BlynkApi.h: No such file or directory
#include <Blynk/BlynkApi.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Including screen shot of your advised steps too.
ArduinoBlynkError.jpg