I am very new to Arduino and programming. I just started with my very first Arduino learner kit, and I got stuck at this soil moisture sensor project. Not so much on the soil moisture sensor itself, but the LCD is not responding in any way, there is backlight lit up at the back of the LCD though (see pictures).
I have also tried the simple project like having the LCD to display "Hello World", it did not work too. I am not sure what to do with it. I have limited knowledge in both the hardware and the programming side. I have read many forum posts and FAQ, but it did not make much sense to me may be due to my limited knowledge in this area.
Have you tried adjusting the contrast (the potentiometer on the I2C backpack)?
For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correctly set up in the code. 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.
minicw:
there is backlight lit up at the back of the LCD though (see pictures).
Err, no, the picture is extremely poor, you really need to post a picture of at least two Megapixels, preferably taken in outside daylight but not full sun and fully focused.
However I see no backlight operating in that photo. Not really surprising as the backlight link is missing from the two pins on the backpack above the black "blob" on the LCD board. When you put the link back on and the backlight is showing, you can show us a decent picture of the display to allow us to explain the next step.
Did anyone mention? Read the instructions for posting so you know how to post your code for review.
Step1: you have to ensure that your I2C bus is working and your device is responding.
use a so called "i2c scanner to scan your bus. You MUST find the address of your display as working device.
If you fail, come back to us.
Step2: use that i2c address found with the i2c scanner in the hello world example which was delivered with your lcd library.
Interesting, but did you two guys not read my reply #2?
The backlight is not working because it has been disconnected. Without the backlight, it is very difficult to distinguish anything on the display.
The first step in addressing this problem is to actually see the display. So far, minicw cannot see the display so until that is remedied, discussion on the I2C bus and the I2Cscanner is pretty much irrelevant.
(Because for all we know, with the backlight lit and the contrast set, it may actually be displaying exactly what is desired.)
exiledyorkie:
Maybe supply the display with a separate power supply, rather than from the Arduino. It may be pulling too much current?
Sorry Yorkie, that is actually entirely irrelevant and a bad idea. Separate power supplies introduce more problems. The "pilot" LED on the backpack is showing that the backpack is powered and it is not impossible but quite unlikely that it would be brightly lit if it was not correctly connected.
This display requires less than 30 mA when the backlight is lit, less than 3 mA (or less than 2 if the mis-wired potentiometer can be fixed) when dark. While there may be some limitations to powering the UNO from the USB connector, it most certainly is more than capable of operating four or more of these displays together.
Thank you for all the information, your help is much appreciated.
I will give it a go with all the suggestion here this week, and see how I go with them. (Apology for the late response, I did not get email notification on the thread comments, I need to fix up some setting here too.)