just blocks on the first row, adjusting the contrast doesnt help, just fades the blocks in or out. All of the wirings are correct, I have tried just about every code and library you can find. This is one of the codes I have tried:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// The LCD constructor - address shown is 0x27 - may or may not be correct for yours
// Also based on YWRobot LCM1602 IIC V1
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup()
{
lcd.begin(16,2); // sixteen characters across - 2 lines
lcd.backlight();
// first character - 1st line
lcd.setCursor(0,0);
lcd.print("Hello World!");
// 8th character - 2nd line
lcd.setCursor(8,1);
lcd.print("-------");
}
void loop()
{
}
The backpack model is LCM1602. Could it just be that the backpack is faulty? I have tried just about every i2c scanner code you can find but none of them print anything in the serial monitor (yes, i have tried every baud rate out of desperation). well actually 6 hours ago I did get something and the addresses were 0x28 and 0x39 instead of apparently usual 0x27. So I have changed the address value in every code that I tried to 28 and 39 plus some other common ones.
i have tried bunch of different libraries, but this one I found to be the best one: https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/
Has anyone got this type of a system to work? Was there something crucial I may have missed based on this post? Any other tips? Help would be appreciated.
you did swap the SDA & SCL lines, just for S & Gs?
For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.
Install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.
The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.
In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.
groundFungus:
For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.
Install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.
The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.
In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.
yeah, i couldnt get anything to work. tried some example sketches under the i2cexp class as you said. OK outside the topic, why doesnt my serial printer work?? tried the diagonal sketch aswell plus some other scanner sketches and none of them print anything to my serial printer. baud rate and ports are correct. codes have unconditional serialprints. tried the diagonal code 5 more times and in one of the times serial printer managed to print: Scanning i2c bus for devices..
but that was it.
IoT_hobbyist:
See this post LCD I2C does not work! checklist - Introductory Tutorials - Arduino Forum
tried those things. tried the code at the link too but as with others, nothing is being printed at the serial monitor
1. Try this sketch with the attached Library.
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
Serial.begin(9600);
//---------------
lcd.int();
lcd.backlight();
//--------------
Wire.beginTransmission(0x27);
byte busStatus = Wire.endTransmission();
if(busStatus != 0)
{
Serial.print("LCD is not found...!");
while(1); //wait for ever
}
Serial.print("LCD is found.");
lcd.setCursor(0,0);
lcd.print("Hello World!");
//----------------------
lcd.setCursor(8,1);
lcd.print("-------");
}
void loop()
{
}
2. If the sketch of Step-1 does not work, re-try changing the address to 0x3F in place of 0x27.
LiquidCrystal_I2C-master.zip (8.98 KB)
GolamMostafa:
1. Try this sketch with the attached Library.
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
Serial.begin(9600);
//---------------
lcd.int();
lcd.backlight();
//--------------
Wire.beginTransmission(0x27);
byte busStatus = Wire.endTransmission();
if(busStatus != 0)
{
Serial.print("LCD is not found...!");
while(1); //wait for ever
}
Serial.print("LCD is found.");
lcd.setCursor(0,0);
lcd.print("Hello World!");
//----------------------
lcd.setCursor(8,1);
lcd.print("-------");
}
void loop()
{
}
**2.** If the sketch of Step-1 does not work, re-try changing the address to 0x3F in place of 0x27.
lcd.int(); line
expected unqualified-id before int
All of the wirings are correct,
Let's start from the beginning.
a) Upload the I2C Scanner and show us the result of the Serial.Output
b) make GOOD pictures of your Arduino + Wiring + Backpack + LCD, we must be able to see and identify each single wire.
noiasca:
Let's start from the beginning.
a) Upload the I2C Scanner and show us the result of the Serial.Output
b) make GOOD pictures of your Arduino + Wiring + Backpack + LCD, we must be able to see and identify each single wire.
the result of serial monitor as I said is a blank screen. one time i did get 0x28, 0x39 and another time just scanning. otherwise nothing
Heres the video: Help - YouTube
just to be clear, as long as the I2C Scanner will not find your PCF reliable it makes no sense to install any other LCD library. So we have to work on the I2C connectivity first.
What's the reason of the resistor between the red cable an VCC?
and by the way: NEVER connect or disconnect components under current any more.
fenbhguardsperson:
lcd.int(); line
expected unqualified-id before int
Extremely sorry for being careless!
It should be:
lcd.init();
GolamMostafa:
Extremely sorry for being careless!
It should be:
lcd.init();
still didnt work. just a blank display
noiasca:
just to be clear, as long as the I2C Scanner will not find your PCF reliable it makes no sense to install any other LCD library. So we have to work on the I2C connectivity first.
What's the reason of the resistor between the red cable an VCC?
and by the way: NEVER connect or disconnect components under current any more.
I have seen some use a resistor between 5v and vcc. I only added it recently. to answer the question: desperation. It doesn't change anything so I'll probably just remove it. So what can I do to get I2C connected?
remove the resistor and connect the backplane to the 3.3V of the ZERO
make new pictures of your setup and upload them to the forum (the video is not clear and most of the time it's rotated 90 degrees, I can see lit. NOTHING what's on your PC)
post the Sketch of the I2C Scanner you are using.
press RESET on the Zero, wait for output on the Serial Monitor and THEN make a screenshot of your monitor.
Upload the scrrenshot to forum.
fenbhguardsperson:
still didnt work. just a blank display
Slowly change the contrast pot -- clockwise and then CCW. Are you getting this message: LCD is found? If not, you must check the continuity of your jumper wires and then change the LCD if necessary. There is no point to spend ages for making the LCD working?
GolamMostafa:
Slowly change the contrast pot -- clockwise and then CCW. Are you getting this message: LCD is found? If not, you must check the continuity of your jumper wires and then change the LCD if necessary. There is no point to spend ages for making the LCD working?
no, it just says scanning, and that is an unconditional command. I have another LCD without the backpack which works but I'm working on a project and for it would be much better to have the pins rotated 90 degrees. I can be pretty petty about these things. 24 hours ago I started working on this and I'm the type of a guy that refuses to give up so here we are. In my latest reply decluding this one I did also come to the conclusion that it could very well be a connection issue with wires or faulty components. For reason 1) i have tried almost everthing 2) i saw another thread where OP had the exact same problem and did almost the same steps as I did only to realize the jumper wires were faulty. I got a multimeter so I'll check mine out.
noiasca:
remove the resistor and connect the backplane to the 3.3V of the ZERO
make new pictures of your setup and upload them to the forum (the video is not clear and most of the time it's rotated 90 degrees, I can see lit. NOTHING what's on your PC)
post the Sketch of the I2C Scanner you are using.
press RESET on the Zero, wait for output on the Serial Monitor and THEN make a screenshot of your monitor.
Upload the scrrenshot to forum.
noiasca:
remove the resistor and connect the backplane to the 3.3V of the ZERO
make new pictures of your setup and upload them to the forum (the video is not clear and most of the time it's rotated 90 degrees, I can see lit. NOTHING what's on your PC)
post the Sketch of the I2C Scanner you are using.
press RESET on the Zero, wait for output on the Serial Monitor and THEN make a screenshot of your monitor.
Upload the scrrenshot to forum.
I have used multiple I2c scanners but this one from arduino playground I have used the most:
// --------------------------------------
// i2c_scanner
//
// Version 1
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26 2013
// V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
// by Arduino.cc user Krodal.
// Changes by louarnold removed.
// Scanning addresses changed from 0...127 to 1...119,
// according to the i2c scanner by Nick Gammon
// https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
// As version 4, but address scans now to 127.
// A sensor seems to use address 120.
// Version 6, November 27, 2015.
// Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
#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
}
the setup: https://imgur.com/IGJdWd8
the serial monitor: https://imgur.com/BcRDcrU
reset did indeed reset it so i got to multiply the scanning... part
the lines printed were unconditional so that was the least it could have done. the connection to i2c is yet to be. As i said before i did manage to get something couple of times but it was a long time ago. I'll check if there's an issue with wiring with my multimeter.
check your ground connection.
Connect the ground between the PCF board directly with zero NOT with your big breadboard.
I asume your larger breadboard with the mess of wires doesn't provide ground / VDD on all rails because the blue and red markings are interupted.
So put away all unnecessary connections and only connect the PCF with your ZERO. And do again your tests.
P.S. you can upload pictures to the forum - you don't need a third party picture hoster.
I suspect this problem:
