Go Down

Topic: I2c device is not found when connected to 16x2 lcd (Read 91 times) previous topic - next topic

Sanjeev7398

Feb 12, 2019, 06:28 am Last Edit: Feb 12, 2019, 06:30 am by Sanjeev7398
Can anyone help me with this? I am not able to detect the I2C module (attached to 16x2 LCD)when connected with arduino and also the LCD displays blocks in first line.

Gnd to Gnd of arduino
Vcc to 5v of arduino
SDA to A4 of arduino
SCL to A5 of arduino

This is the program I used to scan I2C module
#include <Wire.h>


void setup()
{
 Wire.begin();

 Serial.begin(9600);
 while (!Serial);             // Leonardo: wait for serial monitor
 Serial.println("\nI2C Scanner");
}


void loop()
{
 byte error, address;
 int nDevices;

 Serial.println("Scanning...");

 nDevices = 0;
 for(address = 1; address < 127; address++ )
 {
   // The i2c_scanner uses the return value of
   // the Write.endTransmisstion to see if
   // a device did acknowledge to the address.
   Wire.beginTransmission(address);
   error = Wire.endTransmission();

   if (error == 0)
   {
     Serial.print("I2C device found at address 0x");
     if (address<16)
       Serial.print("0");
     Serial.print(address,HEX);
     Serial.println("  !");

     nDevices++;
   }
   else if (error==4)
   {
     Serial.print("Unknown error at address 0x");
     if (address<16)
       Serial.print("0");
     Serial.println(address,HEX);
   }    
 }
 if (nDevices == 0)
   Serial.println("No I2C devices found\n");
 else
   Serial.println("done\n");

 delay(5000);           // wait 5 seconds for next scan
}

not_a_noob

Well all I can say is that it's not your code, since it works for me:

Code: [Select]
Scanning...
I2C device found at address 0x27  !
I2C device found at address 0x57  !
I2C device found at address 0x68  !
done


As we speak my I2C LCD is also just showing a line of blocks too; I think that just means it has power but isn't being told to do anything. Soon as I load my normal "clock" sketch, it behaves as expected.

Do you have any other I2C devices to test?


pylon


cattledog

#3
Feb 12, 2019, 07:44 pm Last Edit: Feb 12, 2019, 07:45 pm by cattledog
Can you please post a photo of the reverse side of the module which shows the pin out for SDA/SCL/Vcc/GND

Go Up