Page 1 of 1

LCD 2x16 I2C backlight

Posted: Mon Oct 24, 2022 12:36 pm
by ule
Hello

I wrote simple program to control backlight on LCD 2X16 I2C. In simulation everything works fine, but in real life not. Backlight is always on. Using arduino nano, push button connected on D2 pin, lcd using i2c in pins C4 and C5.

Re: LCD 2x16 I2C backlight

Posted: Mon Oct 24, 2022 11:53 pm
by viktor_au

Re: LCD 2x16 I2C backlight

Posted: Tue Oct 25, 2022 8:49 am
by medelec35
Hi, ule.
To control the backlight, you will need to right-click on your LCD and select Properties.
Change Use Backlight from No to Yes.
The jumper needs to stay in place for the light to be controlled.
The state of the backlight will be remembered.
With that in mind, if you turn the backlight off, then at a later date when the LCD is repowered, the backlight will remain off.

Re: LCD 2x16 I2C backlight

Posted: Tue Oct 25, 2022 4:08 pm
by ule
Jumper is in, but in settings tab i only see this

Re: LCD 2x16 I2C backlight

Posted: Tue Oct 25, 2022 6:03 pm
by chipfryer27
Hi

That may have been a "typo".

I was under the impression the I2C LCD wasn't supported until FCv7 but could easily be quite wrong as I don't have any FC on this machine to check and it's been a few years.... I think then backlight control was an option under Component Macro not Properties, being used as per Viktor's link.

In FCv8 I think the backlight is as Martin describes.

I might be typing nonsense of course as I can't check :)

Regards

Re: LCD 2x16 I2C backlight

Posted: Tue Oct 25, 2022 10:02 pm
by medelec35
Hi,
IC2 LCD is supported in v6.
It looks like the enable backlight within properties is not present in V6.
However, it's not required as there is a backlight on/off function.
I have tested the attached project with my I2C LCD and it is flashing the backlight every second.
I have changed the original project to eliminate switch issues

Re: LCD 2x16 I2C backlight

Posted: Tue Oct 25, 2022 10:59 pm
by viktor_au
Hello
I have a question
Does the BacklightControl macro control the state of on-board of i2c module transistor?
Is it possible to show this macro?
Thanks

Re: LCD 2x16 I2C backlight

Posted: Tue Oct 25, 2022 11:17 pm
by medelec35
hello.
Yes, I believe it does.
It looks like the module's transistor is biased on via a base bias resistor.
One of the outputs from the PCF8574 pulls the base of the transistor low, to turn the backlight off.

Re: LCD 2x16 I2C backlight

Posted: Wed Oct 26, 2022 6:41 am
by ule
Schematic of i2c backpack interface is something like this. I also tried different versions to turn it off via i2c, but with no success. It does blink, like @medelec35 wrote, otherwise it remain on.

Re: LCD 2x16 I2C backlight

Posted: Wed Oct 26, 2022 5:26 pm
by chipfryer27
Hi

Back in front of my machine.

I could not find any I2C Display in v6 and seem to have found a "hidden feature" of FC which I'm glad to say is no longer. In Global Options you need to check a box to see everything in a category.....

Unknown Feature.JPG
Unknown Feature.JPG (60.83 KiB) Viewed 30428 times

Quite why this was the case is beyond me but no doubt a reason at the time. I can only hope I had that ticked when I used v6 or I might have upgraded to v7 needlessly :) (v6 only on this machine for historical reasons).

From the schematic it looks like with jumper inserted it would be on permanently until the pin went Low. Have you tried sending "0" using the component macro as per Medelec's chart? That should switch it off permanently or until a "1" is sent.

Regards

Re: LCD 2x16 I2C backlight

Posted: Wed Oct 26, 2022 10:17 pm
by ule
Medelec35 chart does only blinking (1s-on/1s-off). I use this before for warnings, but in normal condition the lcd backlight was on. Now I want to backlight stay off until the button is pressed. I posted flowchart with this function in first post, but it only work in simulation mode.

Re: LCD 2x16 I2C backlight

Posted: Wed Oct 26, 2022 11:00 pm
by chipfryer27
Hi

I might have an I2C kicking around to try, but if your hardware is blinking using Medelec's chart with the jumper inserted, then your hardware setup is fine, you would just need to modify to your needs.

If I find the display I'll see what happens for me with the codes posted.

Regards

Re: LCD 2x16 I2C backlight

Posted: Thu Oct 27, 2022 12:19 am
by viktor_au
Hello
Please have a look at the attached file.
I am not sure if that what you are after.

Re: LCD 2x16 I2C backlight

Posted: Thu Oct 27, 2022 7:21 am
by chipfryer27
Hi Viktor

Works for me in Sim and I'm sure if implemented in HW it will work there too.

Regards

Re: LCD 2x16 I2C backlight

Posted: Thu Oct 27, 2022 5:46 pm
by ule
@viktor_au: yours flowchart works in sim and hardware to. I only had to change i2c data line from C3 to C5. Thank you.

Re: LCD 2x16 I2C backlight

Posted: Fri Oct 28, 2022 3:51 am
by viktor_au
Glad it works.

Re: LCD 2x16 I2C backlight

Posted: Sun Nov 06, 2022 5:05 pm
by ule
Well, if I put viktor_au last sample code into my project it does not working as is should. I wrote some other sample code (i think is better, because it does not affects on whole flowchart, because of delay function). Attached code is working in simulation mode and on hardware. But.... :? I figured out, if i put any kind command via i2c to lcd, the display will put the backlight on and will remain on (only if I test on hardware, in simulators works fine).

Re: LCD 2x16 I2C backlight

Posted: Tue Nov 08, 2022 10:55 pm
by ule
I used different approach. I cut the trace on pcb of i2c backpack, between the PCF8574 and transistor. Remove pull up resistor from base of transistor. On my pcb i added pull down resistor to D6 on arduino and connected wire to base of transistor. Everything working as i want.