I’m trying to interface Sparkfun’s ESP8266 shield to work together with my Uno to run the Blynk app but have been majorly unsuccessful, possibly because I have zero understanding on how to get this to work. I can get the shield to connect up to the internet, but somehow cannot connect blynk. I basically modified the user defined code and came up with the code attached below. Any help or idea on how to integrate the shield into blynk will be much appreciated!
-#include (SoftwareSerial.h) // changed parenthesis so as to be able to post this on the forum
-#include (SparkFunESP8266WiFi.h)
-#include (BlynkSimpleUserDefined.h)
const char mySSID[] = "ssid";
const char myPSK[] = "password";
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "authkey";
bool connected = false;
// This function is used by Blynk to receive data
size_t BlynkStreamRead(void* buf, size_t len)
{
return Serial.readBytes((byte*)buf, len);
}
// This function is used by Blynk to send data
size_t BlynkStreamWrite(const void* buf, size_t len)
{
return Serial.write((byte*)buf, len);
}
void setup()
{
// Setup your connection here.
Serial.begin(9600);
if (esp8266.begin()) // Initialize the ESP8266 and check it's return status
Serial.println("ESP8266 ready to go!"); // Communication and setup successful
else
Serial.println("Unable to communicate with the ESP8266 :(");
int retVal;
retVal = esp8266.connect("Glen X", "yourmumisgay");
if (retVal < 0)
{
Serial.print(F("Error connecting: "));
Serial.println(retVal);
}
IPAddress myIP = esp8266.localIP(); // Get the ESP8266's local IP
Serial.print(F("My IP is: ")); Serial.println(myIP);
Blynk.begin(auth);
do {
connected = Blynk.connect();
} while (!connected);
}
void loop()
{
// Make sure that Blynk.run() is called
// only when the connection is established
if (connected) {
// Okay, handle Blynk protocol
bool hasIncomingData = (Serial.available() > 0);
// Tell Blynk if it has incoming data
// (this allows to skip unneeded BlynkStreamRead calls)
if (!Blynk.run(hasIncomingData)) {
// Error happened. No action for serial.
}
}
}
Any chance of getting some support soon so perhaps a little assistance? What about some generic code that I could try adapting to the shield? I tried the Blynk.run() command but it didn’t work.
We are trying to connect with SparkFun, but they never reply. If you could ping them from your side as a customer - that might shift it from dead point.
SparkFun hardware is always good but , the problem here is this $ 15 shield to work with blynk.
must the ESP8266 Soc must flashed with SDK firmware 1.0 running AT command V22.
you can easier get ESP-01 or better ESP-12 for $ 2-5 and you free to flash it either with AT or any other FW.
P.S AT v22 is a must to work with Blynk , i suffered because of wrong FW version flasher on my ESP-01
I just got an email from Sparkfun’s tech support that they’ve contacted the team at Blynk to see how they can work together. Keeping my fingers and toes crossed that something’s worked out soon. For now I’m just connecting to my uno via serial/pc connection.
Hopefully in time for when my prototype is fully operational without the kinks.
This worked for me from the example code, make sure you update the EspSerial Ports to (8, 9) for the SparkFun Software Serial:
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_SoftSer.h>
#include <BlynkSimpleShieldEsp8266_SoftSer.h>
// Set ESP8266 Serial object
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(8, 9); // RX, TX
ESP8266 wifi(EspSerial);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "code";
void setup()
{
// Set console baud rate
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
// 9600 is recommended for Software Serial
EspSerial.begin(9600);
delay(10);
Blynk.begin(auth, wifi, "name", "pw");
}
void loop()
{
Blynk.run();
}