Both I2C LCD screen backlights do not turn on

I have one 20x4 LCD screen with i2c module and a 16x2 with I2C and both are able to display text EXCEPT their backlights will not turn on. Ive looked everywhere for a solution but came up short.

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <NewPing.h>

#define I2C_ADDR 0x27 // <<- Add your address here.
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define MAX_DISTANCE 500 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
 lcd.begin (20,4); // <<-- our LCD is a 20x4, change for your LCD if needed

// LCD Backlight ON
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);

lcd.home (); // go home on LCD
lcd.print("Range Finder HC-SR04"); 
}

void loop()
{
 unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
 unsigned int cm = sonar.convert_cm(uS); // Convert into centimeters
 
 lcd.setCursor (0,1); // go to start of 2nd line
 lcd.print("Current Distance:");
 lcd.setCursor (0,3); // go to start of 4th line
 lcd.print("Ping: ");
 lcd.print(cm);
 lcd.print(" cm ");

 delay(500);
}

My wiring is correct Ive checked this schematic many times: https://brainy-bits.com/tutorials/connect-a-character-lcd-using-the-i2c-bus/

as you can see, I called the backlight function. and yes I ran a ic2 program to find its location.

Im really stuck guys! THANKS

as you can see, I called the backlight function. and yes I ran a ic2 program to find its location.

lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);

There are two possible configurations with this constructor.

LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7);

The backlight pin 3 can be POSITIVE or NEGATIVE. Did you use Bill Perry's i2c lcd guesser to determine the constructor, backlight pin and polarity? That program is not listed in the brainy bits link.

If you did not use that program to determine the constructor but ran the i2c scanner to determine the 0x27 address try using 3, NEGATIVE. If you see text, the rest of the constructor must be correct and the only two known backlight configurations with the 2,1,0,4,5,6,7 constructor are 3,POSITIVE and 3,NEGATIVE.

Hi, Thanks for the information. I tried setting it to (3, POSITIVE) and (3, NEGATIVE) both of which did not activate the back light. I a little confused on what you meant to do next

I tried setting it to (3, POSITIVE) and (3, NEGATIVE) both of which did not activate the back light.

OK. Some of the i2c interface boards have a jumper on them to enable the backlight. Do you see two pins across the module from the VCC.GND,SDA,SCL pins. Is there a jumper on the pins?

Yes I do! What should I do with those? :slight_smile:

Wait no im sorry, there is no jumper on the 2 pins. I got a little exited.

What should I do with those?

There should be a jumper. Connect the two pins together. The backlight should work.

Well this is the best thing thats happened to me all night. THANK YOU SO MUCH. I hope this helps anyone with the same problem. I cant thank you enough. :):):slight_smile:

Congratulations!
Strange: Normally all of the I2C backpacks come with the jumper plugged in.

To give you some more background I attached two pictures of an I2C backpack (sunrom.com, others are similar).
One picture shows details of such a backpack and the other one is the schematics, showing at the lower right side jumper J3 which connects Vcc to the LCD display’s backlight (LED anode).
Having a PWM controlled transistor connected instead of the jumper, you could dim the backlight.

I2C_Backpack.jpg

Sunrom.com I2C backpack schematics.jpg

If you replace jumper J3 with a pot you can control the brightness of the backlight.
One end of the pot on VCC and the wiper on A.

If you replace jumper J3 with a pot you can control the brightness of the backlight.
One end of the pot on VCC and the wiper on A.

I wouldn't recommend that.
Reason: Backlights can draw up to 120mA or more.
A potentiometer might be fried by the portion of the current, depending on its overall value and the position of the trimmer.

To rpt007:

I have nine 20x4 displays using the I2C backpacks with a 500 ohm 1/2 watt trimmer pot controlling
the brightness. And some of these displays have been in operation for over two years with no problems.

These pots cost me about $1.20 on ebay and seem to work just fine. As a matter of fact this post reminded me to order another ten pack from West Florida Components ( $11.99 with free shipping ).

@Oldtron:

Ok, you seem to know what you do. But your initial statement was imho a bit too general and when I read potentiometer in context with trimming a display, I think of those guys:

Trimmer linear 0.15 W.jpg

And those would be too weak to bare the current.

Think of all the newbies here without electronics experience.

I tried to post a pictured but couldn't figure it out. But it's a lot more robust looking than the picture you posted.

500 ohm Trimmer Trim Pot Variable Resistor 3106Y (10)

Top Adjust Trimmer Potentiometer
25 Turns
Sealed Cermet
POT3106 Series
Precise Adjustment
Square
9.5mm (3/8") package
Staggered Leads
Cross to Spectrol 64Y series and NTE 500-0240 series

Ratings:
Total Resistance Tolerance: +/-10% of standard total resistance value
Max Working Voltage: 300Vdc
Power Rating: 0.5W 70°C

Just put some numbers into the theory.
e.g. Vf = 3V @ 100mA

This means you need a current limiting resistance of 20R i.e. 200mW dissipation.
It is likely that the LCD module has already got a series resistor with this value.

So any extra resistance from Oldtron's trimmer pot will have the most dissipation @ 20R i.e. 100mW in the pot with 100mW in the existing pcb resistor i.e. 50mA LED current.

Personally, I can't see much point in a variable resistance. In practice, you might want BRIGHT, MEDIUM and OFF. And you could do this in software with a GPIO pin.

David.

It is likely that the LCD module has already got a series resistor with this value.

When you replace the jumper with a potentiometer you are only using two of the three terminals so you have actually configured it as a rheostat.

The problem with burned out rheostats typically occurs when there is no other current limiting in place. As the resistance is turned down toward 0 ohms the current can rise to a point where it exceeds the rating of the portion of the rheostat that is still being used.

High power rheostats are frequently constructed with windings that are heavier (can handle more current) at the low resistance end. Potentiometers, especially the kind used on pc boards, typically have uniformly fine wire, hence the problem mentioned in the previous paragraph.

Don

Ah-ha. I looked at a selection of LCDs.

Most have got 100R series resistors on the backlight. With a 5V supply, the backlight draws about 20mA
However, some have got 0R series resistors i.e. no current limit. They draw about 240mA with a 5V supply.

My mathematics is still applicable. Even to the 0R displays. i.e. maximum dissipation in the “external” pot is about 240mW. This is too much for the typical preset. Definitely bad news for a 10k preset. Reasonable for a 47R preset.

Obviously the 0R displays are intended for external resistors or PWM.
Most 20x4 datasheet specify maximum 60mA for the backlight.

The average punter will not realise whether they have a 0R or a 100R module.
She may or may not notice that the backlight is quite bright.

The 20x4 and 16x2 modules come in different makes and specifications.
I am sure that 100R vs 0R are not the only values found in real life.

Since this topic is about the typical I2C adapter. If your module has 0R installed, you can replace the jumper with a 47R series resistor across the 2-way header pins.

David.

I have to agree with david-pretice. A pot is overkill for this but it is one way to do it. Originally I used a fixed resistor to set the brightness. But then I spotted these cheap pots and have gone with them ever since. And since each LCD location seems to require a different brightness level a pot seems more practical than doing it in software. In the past I have even used shaded plastic film over the LCD to tone it down.

I have also noticed that LCD's often come stock with many varying levels of back-light. When I order a batch of ten there are always a few that are way brighter or dimmer.

Look for R7 and R8 on the typical 20x4 or 16x2. See if they are 0R (0) or 100R (101) or 47R (470)

I would just replace the 0R with a suitable series value.

David.