Hi I am struggling to get my project working so i decided to ask for a little help since i’m new with Blynk and wifi modules.
So what I want to achieve is an Arduino connected to WiFi capable of reading sensors and then displaying the value on the Blynk App.
I uploaded the following code on ESP8266
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "you can't read that";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "that's secret too";
char pass[] = "definitelynotmypassword";
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
I’m using an Arduino 2009 (Duemilanove) and after wiring it to the ESP, if i ground the RESET pin of the arduino it correctly display on the serial monitor the blynk startup message with the text “on ESP8266” below. I set up the android app with a button to control the GPIO2 (ESP builtin led) and it works perfectly.
But since i want to read Analog input i need the analog pins of the Arduino, i uploaded the following code on arduino
#define BLYNK_PRINT Serial
#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[] = "you can't read that";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "that's secret too";
char pass[] = "definitelynotmypassword";
// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1
// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(0, 1); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600
ESP8266 wifi(&Serial);
void setup()
{
// Debug console
//Serial.begin(9600);
//Serial.write("workin");
// Set ESP8266 baud rate
Serial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
Since there is no 2009 compatibility i read on the forum that i can just use the Uno code and just change some lines like i did. If i am saying something wrong please correct me.
Now i connected the ESP8266 to the Arduino
ESP Rx --> arduino Rx
ESP Tx --> arduino Tx
VCC --> arduino 3v3
CH_PD --> arduino 3v3
GND --> arduino GND
but i can’t control the arduino while i can still control the ESP builtin led so the module is working and is connected. The serial monitor shows the Blynk message
[9]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.6.1 on Arduino Uno
[592] Connecting to mywifySSID
[1606] ESP is not responding
The module is powered by arduino 3.3v, i even tried conneting an external power source for the arduino (but the module is always working so i don’t think it’s a power issue, rather a communication error between the arduino and the ESP). Also tried to wire the ESP Tx to arduino Rx and Rx to arduino Tx but that doesn’t work either. Do you guys have some suggestions?
Thanks in advice!