BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk and LCD I2C (16x2) not working

Hi, can anyone please help with this? I’m using Arduino Uno ans Esp 8266-01s for this project. My LCD (16x2) turn ON but cannot display alphabet through hardware and my wifi module doesn’t seem to connect. The connection banknotes and coins as inputs for the donation box. The coins will then be calculated directly using an
IR reflective sensor. For ESP8266 i using LC04A to ESP8266 accepts 5V signal into RX and the 3.3v it puts out of TX. From LC04A HR1 connect to pin 10 arduino and HT1 to pin 9 arduino for TX and RX. From LC04A LT1 connect to TX (esp8266) and LR1 to RX (esp8266).

Here my codes:

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>


char auth[] = "neWsZJyui_dp_0f80lfH_5m8vIP0y_-r"; 


#define EspSerial Serial1
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(9, 10); // RX, TX
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);

char ssid[] = "Ismail56"; 
char pass[] = "610101715450A"; 
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
#define S0 4
#define S1 5
#define S2 6
#define S3 7
#define outPin 8

LiquidCrystal_I2C lcd(0x27,16,2); // 0x27 is the I2C bus address for an unmodified module

//Coin Money define
const int coi10n  = 11;    //input from ir sensor
const int coi20n = 12;
const int coi50n  = 13; 
const int rm  = 2;
const int motor  = 3;
int ir10,ir20,ir50 = 0;
int cnt10r,cnt20r,cnt50r = 0;
float cnttotal = 0;

//Paper Money define
int rm1,rm5,rm10,rm20,rm50,rm100 = 0;
int rmt100r,rmt500r,rmt1000r,rmt2000r,rmt5000r,rmt10000r =0;
float rmttotal = 0;



// Stores frequency read by the photodiodes
boolean DEBUG = true;
int redFrequency = 0;
int greenFrequency = 0;
int blueFrequency = 0;

// Stores the red. green and blue colors
int red = 0;
int grn = 0;
int blu = 0;

String color ="";
int count = 0;
long startTiming = 0;
long elapsedTime =0;



void setup() {
  {
    // Debug console
    Serial.begin(9600);

    delay(1);

    // Set ESP8266 baud rate
    EspSerial.begin(ESP8266_BAUD);
    delay(1);

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

   
  }
  
 pinMode(2,INPUT);
 pinMode(3,OUTPUT);
 Serial.begin(9600);
 
 pinMode(coi10n,INPUT);
 pinMode(coi20n,INPUT);
 pinMode(coi50n,INPUT);

  
 lcd.begin(16,2);
 lcd.backlight(); // You can turn the backlight off by setting it to LOW instead of HIGH
 lcd.write(EEPROM.read(5));

 // Setting the outputs
  pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  
  // Setting the sensorOut as an input
  pinMode(outPin, INPUT);
  
  // Setting frequency scaling to 20%
  digitalWrite(S0,HIGH);
  digitalWrite(S1,LOW);
  
  // Begins serial communication
  Serial.begin(9600);
  Serial.println("Paper Money Color Detector");
  startTiming = millis();
}

void loop() {
{
 ir10 =digitalRead(coi10n);  //read the state of coi100n and store it as ir100
 ir20 =digitalRead(coi20n); //read the state of coi100n and store it as ir200
 ir50=digitalRead(coi50n);  //read the state of coi100n and store it as ir500
  
 if(ir10 ==LOW){cnt10r+=10;  delay(300);}
 Blynk.virtualWrite(V1,cnt10r);
 if(ir20 ==LOW){cnt20r+=20;  delay(300);}
 Blynk.virtualWrite(V2,cnt20r);
 if(ir50 ==LOW){cnt50r+=50;  delay(300);}
 Blynk.virtualWrite(V3,cnt50r);
 
 cnttotal =cnt10r+cnt20r+cnt50r;
 cnttotal = cnttotal/100;
Blynk.virtualWrite(V4,cnttotal);
 
EEPROM.write(5,cnttotal);
Serial.println(EEPROM.read(5));

lcd.setCursor(0,0);
lcd.print("TOTAL COIN :");
lcd.setCursor(1,1);
lcd.print(cnttotal);
}
{
  
  
  if(digitalRead(2)==1)
  {
  Serial.println(digitalRead(2));
  digitalWrite(3,HIGH);
  delay(100);
  }
else
  {
  digitalWrite(3,LOW);
  }
  }
{
   
    //read red component
    digitalWrite(S2, LOW);
    digitalWrite(S3, LOW);
    redFrequency =  pulseIn(outPin, LOW);

    Serial.print(" Red = ");
    Serial.print(redFrequency);
    Blynk.virtualWrite(V5,redFrequency);
    delay(400);
    
  
   //read green component
    digitalWrite(S2, HIGH);
    digitalWrite(S3, HIGH);
    greenFrequency = pulseIn(outPin, LOW);

    Serial.print(" Green = ");
    Serial.print(greenFrequency);
    Blynk.virtualWrite(V6,greenFrequency);
    delay(400);
    
   //let's read blue component
    digitalWrite(S2, LOW);
    digitalWrite(S3, HIGH);
    blueFrequency = pulseIn(outPin, LOW);

    Serial.print(" Blue = ");
    Serial.println(blueFrequency);
    Blynk.virtualWrite(V7,blueFrequency);
    delay(400);

  // Checks the current detected color and prints
  // a message in the serial monitor

  // for RM10 color frequency - OK
  if ((redFrequency >= 85 && redFrequency <= 105) && 
      (greenFrequency >= 115 && greenFrequency <= 125) && 
      (blueFrequency >= 100 && blueFrequency <= 115))
  {
    Serial.println(" - RM10 detected!");
    {rmt1000r+=1000; delay(600);}
  }

  // for RM20 color frequency
  if ((redFrequency >= 90 && redFrequency <= 105) && 
      (greenFrequency >= 105 && greenFrequency <= 124) && 
      (blueFrequency >= 100 && blueFrequency <= 116))
  {
    Serial.println(" - RM20 detected!");
    {rmt2000r+=2000; delay(600);}
  }
  
   // for RM5 color frequency - OK
  else if ((redFrequency >= 100 && redFrequency <= 120) && 
      (greenFrequency >= 95 && greenFrequency <= 110) && 
      (blueFrequency >= 90 && blueFrequency <= 110))
  {
    Serial.println(" - RM5 detected!");
    {rmt500r+=500; delay(600);}    
  }

   // for RM1 color frequency - OK
  else if ((redFrequency >= 120 && redFrequency <= 138) && 
      (greenFrequency >= 128 && greenFrequency <= 136) && 
      (blueFrequency >= 85 && blueFrequency <= 105))
  {
    Serial.println(" - RM1 detected!");
    {rmt100r+=100; delay(600);}
  }

   // for RM50 color frequency
  else if ((redFrequency >= 26 && redFrequency <= 52) && 
      (greenFrequency >= 44 && greenFrequency <= 63) && 
      (blueFrequency >= 39 && blueFrequency <= 65))
    {
      Serial.println(" - RM50 detected!");
      {rmt5000r+=5000; delay(600);}
    }

    // for RM100 color frequency
  else if ((redFrequency >= 26 && redFrequency <= 52) && 
      (greenFrequency >= 44 && greenFrequency <= 63) && 
      (blueFrequency >= 39 && blueFrequency <= 65))
    {
      Serial.println(" - RM100 detected!");
      {rmt10000r+=10000; delay(600);}
    }

    rmttotal = rmt100r+rmt500r+rmt1000r,rmt2000r,rmt5000r,rmt10000r;
    rmttotal = rmttotal/100;
    Blynk.virtualWrite(V8,rmttotal);
    
    EEPROM.write(5,rmttotal);
    Serial.println(EEPROM.read(5));

    Serial.println("TOTAL PAPER MONEY :");
    Serial.println(rmttotal); 
}
{
    Blynk.run();
    
  }
}

@qylaaismail please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Also, if you wish to post serial monitor data to the forum then it’s much better if you copy and paste it (CTRL A to select and CTRL C to copy) rather than taking photos of the screen.
Using triple backticks with serial monitor output is also a good idea.

Providing information about how you’ve wired your Uno and ESP-01 would also be useful.

Pete.

okay , thanks will edit again

Fixed your edit :slight_smile:

Blynk - FTFC

Skip the logic converter, it is totally unnecessary (for the variable voltage levels on the serial connection at least) and just adds to the usual wiring complexities … I run many Arduino <–> ESP-01 links directly. Just make sure you cross the wires… Arduino TX to ESP RX and vice versa.

However, the ESP-01 really needs it’s own 3.3v power source… do NOT use the 3.3v pin on the Arduino. If you must use Arduino power, then tapping from the Vin pin, through a LDO 3.3v regulator (I have used AMS1117) will work fine, and sometimes a small value tantalum capacitor across the ESP-01’s 3.3v and GND will help if also loading the Vin pin down with other loads like servos, etc.

The ESP-01 will start sucking more power once it starts constantly communicating across WiFi… and that can quickly cause it to overload the Arduino’s built in 3.3v regulator, causing disconnects.

A little googling and I found this relatively close wiring example… the resistors are a rudimentary form of voltage leveling that might be simpler then your LC04A. In reality, only the TX from the Arduino to the RX on the ESP-01 needs “protecting”… I have used direct connection OK, but the resistor based voltage divider is not a bad idea for long term use.

The change I would make from the example (aside from you using SoftSerial pins on the Arduino) is to tap the Vin pin instead of the 5v pin for the 3.3v LDO regulator… that way you are not overloading the Arduino’s built in 5v regulator as well.

Thus if your arduino is powered by the barrel jack with 7-20v, there is plenty of juice to share across all the regulators to all the devices. If it is only powered by the USB, then a lot depends on the USB sources power limitations, some PC’s can only handle 500mA, some 1A or more.

image

BTW, becasue something is preventing the initial connection between the Arduino and the ESP (AKA ESP is not responding)… your code never passes the Blynk.begin() command… that is why your LCD is not displaying anything either.

And what is all this?? I am not sure how your code is even compiling with all these stray brackets?

image

image

…and so on throughout your code…

TX (transmit) from one device goes to RX (receive) on the other… Think from mouth to ear in a conversation. In the case of your software serial setup, pin 9 is the arduino’s RX (going to the ESP TX) and 10 is it’s TX (going to the ESP RX)

NOPE… totally different purpose devices…the lc04a doesn’t even contain any regulators… it expects two separate power sources HV± is 5v and LV± is 3.3v.

Get a proper 3.3v regulator.

Anyhow., that is all I can assist with for now… busy with other things over next days, weeks, more?

If you need further, hopefully someone else can chip in.

thankyou very much appreciate it