Hi, please, can anybody help me? How library to use or how change i need make to work my configuration with Blynk service. Thank You very much! I have this board http://www.arduino.org/products/boards/arduino-uno-wifi#board_communication
No it is notâŚ
arduino.org just put ordinaty uno + esp8266 module on one board.
Update: but they do not privide any library to work with TCP. So currently the only option is to use HTTP api via their Ciao library.
Thank You, Could you write it a little more? Please
Just try it and tell if something didnât work.
I donât have the board so I canât tellâŚ
The Arduino UNO WiFi board uses i2c not a simple UART to communicate wth the onboard ESP8266. Iâm still trying to understand how to use Blynk with this. I believe the firmware in the ESP8266 itself is based on esp-link by Jeelabs. If someone more knowledgeable has some ideas or some sample code for Blynk it would be greatly appreciated.
Hi guys, I recently bought this board (maybe itâs been an error) and Iâm trying to blynk for weeks now, no luck. Using the ESP8266_Shield example I get this output in the serial monitor:
[19] Blynk v0.4.0 on Arduino
[520] Connecting to InfostradaWiFi-aeae12
[1536] Failed to disable Echo
In the blynk app i get always: âyour arduino is not on networkâ.
Iâve been able to blynk with the USB example and the board connect correctly to WiFi.
Any idea on how to make it work?
Try reversing the softserial pins (since you donât have physical wires). Usually when messing with ESP as shield itâs Tx/Rx error, but it could also be the firmware on the ESP that is âwrongâ for this purpose. If the comms are indeed i2c it will probably not going to work and you will be better off buying a Wemos D1 for example. If you need the Arduino size, you can go for the old Wemos, but the new ones are pretty nifty too, with loads more memory than an Arduino, just not as much analog ports.
Thank you for the reply @Lichtsignaal. I get the same errors even reversing serial pins. Unfortunately Iâm sure that the UNO WiFi uses a i2c-uart for onboard communication like @bborncr said.
On the Arduino Uno Wi-Fi thereâs a SC16IS750IBS IO Expander Single UART with I2C-bus/SPI interface that allows the communication between AtMega 16u2, AtMega 328p and the ESP8266EX.
In fact, in UNO WiFi examples Wire library is often used.
Is I2c such a big problem? I wonder how putting together two supported hardware (UNO & ESP8266) leads to this catastrophic result
Can you guys think about any workaround for this?
http://www.arduino.org/images/products/details/ArduinoUNOWIFI_drawing2.jpg
Please find the board schematic here:
http://download.arduino.org/products/UNOWIFI/Arduino-UNO-WiFi-V4_AF1.pdf
I think Blynk just doesnât support any I2C protocols. This is probably also a bad idea since the âI2Câ libraries of the Arduino, like Wire, are not fully I2C compliant. They implement just a part of the protocol. That being said, I think you better find a different solution like the Wemos D1 or something similar.
Iâm not sure what the âProgram Useâ means in the diagram you sketched. And as said, if there is not AT firmware on the ESP chip it will not work anyway with Blynk because that is what they use if the ESP is setup as shield.
@russilui I guess you are with arduino.org rather than arduino.cc
From what I can see you will be limited to Blynkâs API but switch:
#include <ESP8266WiFi.h>
to:
#include <ArduinoWiFi.h>
So you will be combining http://www.arduino.org/learning/tutorials/boards-tutorials/restserver-and-restclient with https://github.com/blynkkk/blynk-library/blob/master/examples/Boards_With_HTTP_API/ESP8266/ESP8266.ino
Hi @Costas, yes it is an arduino.org board.
Following your instruction i get:
Arduino: 1.7.11 (Mac OS X), Board: âArduino Uno WiFiâ
ESP8266_http_API.ino:35:1: error: âWiFiClientâ does not name a type
ESP8266_http_API.ino: In function âvoid connectNetwork()â:
ESP8266_http_API.ino:42:3: error: âWiFiâ was not declared in this scope
ESP8266_http_API.ino:44:27: error: âWL_CONNECTEDâ was not declared in this scope
ESP8266_http_API.ino: In function âbool httpRequest(const String&, const String&, String&)â:
ESP8266_http_API.ino:62:7: error: âclientâ was not declared in this scope
ESP8266_http_API.ino:69:3: error: âclientâ was not declared in this scope
Error compiling.
Paste your sketch and ensure it is formatted for forum use.
Here it is:
/**************************************************************
* 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.
*
* Downloads, docs, tutorials: http://www.blynk.cc
* Blynk community: http://community.blynk.cc
* Social networks: http://www.fb.com/blynkapp
* http://twitter.com/blynk_app
*
* This example code is in public domain.
*
**************************************************************
* Project setup in the Blynk app:
* Value Display widget on V2
*
**************************************************************/
#include <ArduinoWiFi.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "****";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "InfostradaWiFi-aeae12";
char pass[] = "****";
// Blynk cloud server
const char* host = "blynk-cloud.com";
unsigned int port = 8080;
WiFiClient client;
// Start the WiFi connection
void connectNetwork()
{
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected");
}
bool httpRequest(const String& method,
const String& request,
String& response)
{
Serial.print(F("Connecting to "));
Serial.print(host);
Serial.print(":");
Serial.print(port);
Serial.print("... ");
if (client.connect(host, port)) {
Serial.println("OK");
} else {
Serial.println("failed");
return false;
}
client.print(method); client.println(F(" HTTP/1.1"));
client.print(F("Host: ")); client.println(host);
client.println(F("Connection: close"));
if (request.length()) {
client.println(F("Content-Type: application/json"));
client.print(F("Content-Length: ")); client.println(request.length());
client.println();
client.print(request);
} else {
client.println();
}
//Serial.println("Waiting response");
int timeout = millis() + 5000;
while (client.available() == 0) {
if (timeout - millis() < 0) {
Serial.println(">>> Client Timeout !");
client.stop();
return false;
}
}
//Serial.println("Reading response");
int contentLength = -1;
while (client.available()) {
String line = client.readStringUntil('\n');
line.trim();
line.toLowerCase();
if (line.startsWith("content-length:")) {
contentLength = line.substring(line.lastIndexOf(':') + 1).toInt();
} else if (line.length() == 0) {
break;
}
}
//Serial.println("Reading response body");
response = "";
response.reserve(contentLength + 1);
while (response.length() < contentLength && client.connected()) {
while (client.available()) {
char c = client.read();
response += c;
}
}
client.stop();
return true;
}
void setup()
{
Serial.begin(9600);
delay(10);
Serial.println();
Serial.println();
connectNetwork();
}
void loop() {
String response;
int value = millis();
// Send value to the cloud
// similar to Blynk.virtualWrite()
Serial.print("Sending value: ");
Serial.println(value);
String putData = String("[\"") + value + "\"]";
if (httpRequest(String("PUT /") + auth + "/update/V2", putData, response)) {
if (response.length() != 0) {
Serial.print("WARNING: ");
Serial.println(response);
}
}
// Read the value back
// similar to Blynk.syncVirtual()
Serial.println("Reading value");
if (httpRequest(String("GET /") + auth + "/get/V2", "", response)) {
Serial.print("Value from server: ");
Serial.println(response);
}
// Set Property
Serial.println("Setting property");
if (httpRequest(String("GET /") + auth + "/update/V2?label=" + value, "", response)) {
if (response.length() != 0) {
Serial.print("WARNING: ");
Serial.println(response);
}
}
// For more HTTP API, see http://docs.blynkapi.apiary.io
// Wait
delay(30000L);
}
I also tried:
#include <Wire.h>
like in the restclient restserver example but compiling errors remain the same.
Sorry my advice was incorrect.
What arduino.org show on the page I linked to is a server and a client.
There are 2 sketches on the page. I am purely guessing here but Blynk will be the server and you would need to modify the client sketch arduino org provides.
They show a local server address of 192.168.60.114 and hopefully you can substitute Blynkâs could IP address etc.
You would need to follow the format used by arduino.org with the client and server example rather than Blynkâs format. Maybe itâs not possible but there are very few people that can test this as we donât have the Uno WiFi board.
Ok, I can try to test this with some help from the community. Iâm not so good at coding
Looks like org supplied the boards and inadequate libraries.
Towards the end of August they made a GitHub entry for arduino-esp-firmware but more than 2 months later there is nothing there https://github.com/arduino-org/arduino-firmware-esp
I suggest you study the hacks in this thread http://www.arduino.org/forums/uno/arduino-uno-wifi-arduinowifi-library-incomplete-solution-for-mqtt-tcp-udp-socket-communication-540 to see how others have overcome the problem.
Just a though, perhaps follow the Arduino example for getting the board connected to the network, something very simple that just prints out its IP to the serial monitor to start with.
Once you can confirm its connected you should then be able to use one of the standard blynk libraries to âenableâ the blynk connectivity using
Blynk.config(auth, "blynk-cloud.com");
Yes, org has become âtoo Italianâ, this is also the reason why I am writing here and not in their forum. I will pick up your suggestions and post the results in the next days.
Otherwise I will think about buying new hardware, but it would be a surrenderâŚ