Connecting Arduino to Blynk server using esp 01

Greetings:

I'm working on a blynk project with Arduino Uno,I used esp 01 to connect the Arduino to internet.

I want to display the results on lcd with I2c but it doesn't work for some reason :thinking:, I tested ESP 01 alone and it's working just fine in controlling a led.

This is the code





// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID           "TEMPLATE_ID "
#define BLYNK_DEVICE_NAME           "DEVICE_NAME  "
#define BLYNK_AUTH_TOKEN            "AUTH_TOKEN  "


// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

char auth[] = BLYNK_AUTH_TOKEN;

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

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1
char dat[] = "to confirm";
// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// Your ESP8266 baud rate:
#define ESP8266_BAUD 38400

ESP8266 wifi(&EspSerial);

BlynkTimer timer;



// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  
  Blynk.virtualWrite(V5, dat);//millis() / 1000
 Blynk.virtualWrite(V0, 58.9);   


}

void setup()
{
  // Debug console
  Serial.begin(115200);
LiquidCrystal_I2C lcd(0x26, 16, 2);
lcd.begin();   
 lcd.backlight();
 lcd.clear();
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);


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


  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
 
}

and the connection as shown below:

I appreciate any ideas best regards.

so Blynk works ans you want display a value on an I2C LCD.
so maybe forget Blynk for a short time and start with an example of the LiquidCrystal library

That's no the way to run I2C on an UNO. Wrong connection pins. Usually SCL and SCK are found on the board left of pin "Aref", upper left in Your painting.
Those pins are also connected to A4 and A5.

@Railroader there is no I2C and LCD in sketch or on the picture.

???

Thanks for your replay :blush:.

The connection in the picture is for esp 01, and the LCD is connected to A4 and A5 pins(sorry I didn't mention this).

i appreciate your fast response :+1:.

what I meant was i want to display the same results in both blynk (lcd widget) and I2C LCD.( I wasn't clear enough )

Please update Your post to show the situation You are asking about.
Schematics, links to datasheet are preferred. Sadly Flow Charts is something learned from courses but unknown by members using word sallad.
W s way to often goes like this causing lots of posting to clarify the first post. This is bad use of helpers time.

1 Like

so you can display on the LCD everything else but not the values send to Blynk???

I'll try to be more specific in this reply:

In pic below I added I2C LCD

I tried ESP alone without LCD and i get the desired results , and the same goes for LCD alone without ESP and it's working correctly.

The problem is when combined both LCD and ESP the LCD prints out just the first print order , And the ESP stay connected to blynk server for seconds (in blynk app shows that your device is **offline** ).

I couldn't find out the reason for this conflict, I tried to find which command the conflict starting with , so I deleted every command required for LCD to work then added them one by one ,turns out it's the command to declare the address for LCD .

LiquidCrystal_I2C lcd(0x27, 16, 2);

below is data sheet for ESP-01:

https://pdf1.alldatasheet.com/datasheet-pdf/view/1179098/ETC2/ESP-01.html
I hope this is clear enough .

Thanks again.

yes , just for the first print command to LCD, and the ESP stay connected to internet for a short time.

Thanks to pin point where I'm lacking :+1: .

For Your little setup the pic is good enough but for larger projects, it would be a useless coloured bird nest.
Nothing wrong in the connections shown but how do You power the UNO? That could be an issue if it's not proper.

I power it from PC (USB cable)

Ok. Measure the 3.3 volt line from the UNO. What does it say?

we need to see your sketch with the problem

The result doesn't update in blynk app.(I change the values of V0 and V5 to know if it's working or not)

Is that measured with the ESP connected?

I measured it again with ESP connected and max value I get when measured few times is 3 v