Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:49 10 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Backlight Command

     Page 1 of 2    
Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 08:27pm 22 Mar 2025
Copy link to clipboard 
Print this post

WebMite MMBasic RP2040 Edition V6.00.01
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION SYSTEM I2C GP20,GP21
OPTION AUTORUN  ON
OPTION LIBRARY_FLASH_SIZE  16000
OPTION DISPLAY 43, 80
OPTION LCDPANEL ILI9341, LANDSCAPE,GP7,GP8,GP9,GP2
OPTION WIFI Belong******, ************, PICOE6614104034
OPTION TOUCH GP14,GP15
GUI CALIBRATE 0, 3885, 3810, -895, -651

Using the Backlight command with the above does not seem to work properly. I usually run the display at 75% and to dim at night I use 2%.  2% works great on MM but with the above 2% is more like 50% and I can't make it dim any more. Backlight 0 does turn the screen off.
Edited 2025-03-23 07:13 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 09:44pm 01 Apr 2025
Copy link to clipboard 
Print this post

Ok I'm back on this after a short delay. I still can't get the BACKLIGHT command to work. I checked the hardware and all was ok, so I re optioned the LCDPANEL without the backlight and used the PWM command instead and it works as expected.
I can't get the BACKLIGHT command to work. As I said above BACKLIGHT 0 turns the Backlight off but Backlight 2 is more like Backlight 50.
Can someone test this on a Pico-W
My work around is easy enough to implement but BACKLIGHT should work.
Edited 2025-04-02 07:46 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2417
Posted: 10:13pm 01 Apr 2025
Copy link to clipboard 
Print this post

Works ok on mine.
Voltage measured on GP2 with "backlight 50" = 1.65V corresponding to 50%.
"backlight 10" = 0.33V corresponding to 10%.
> option list
WebMite MMBasic RP2040 Edition V6.00.01
OPTION SERIAL CONSOLE COM1,GP0,GP1,BOTH
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION COLOURCODE ON
OPTION LCDPANEL ILI9341, LANDSCAPE,GP7,GP8,GP9,GP2
OPTION WIFI WiFi-6BAC, ***************, PICOE6614104031
OPTION TCP SERVER PORT 80
OPTION TELNET CONSOLE ON
OPTION SDCARD GP17
>
> backlight 50
> setpin gp6,fin 'gp6 connected to gp2
> ? pin(gp6);" Hz"
50000 Hz
>

Edited 2025-04-02 08:17 by phil99
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 10:40pm 01 Apr 2025
Copy link to clipboard 
Print this post

Thanks Phil, I'm still no closer to solving my problem though, PWM works and Backlight doesn't. I'll try a different Pico-W.
Thanks
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2417
Posted: 11:38pm 01 Apr 2025
Copy link to clipboard 
Print this post

Can you measured the voltage on the backlight pin with a scope?
Perhaps at 50kHz it isn't going low enough to turn the backlight transistor (usually Q1 on most LCDs) fully off. Needs to be less than 0.6V.
You could try adding 330Ω to 1kΩ between the backlight pin and ⏚.

To see if the frequency is an issue set your PWM frequency to 50kHz or higher.
.
Edited 2025-04-02 09:47 by phil99
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 12:18am 02 Apr 2025
Copy link to clipboard 
Print this post

The PWM works the BACKLIGHT command doesn't work and it sets the frequency.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2417
Posted: 12:42am 02 Apr 2025
Copy link to clipboard 
Print this post

Yes the BACKLIGHT frequency is fixed at 50kHz but you can set the PWM command to almost any frequency. I was curious to know if setting that to 50kHz or higher causes the same symptoms. If so the problem might be with the transistor Q1 on the LCD panel.

Some possibilities to work through.

1) Does adding 330Ω between the backlight pin and ⏚ make a difference? If the transistor isn't turning off properly at 50kHz that might help.

2) When using the BACKLIGHT option what voltage do you get on the backlight pin as you vary the backlight value? At BACKLIGHT 50 you should get about 1.65V and at BACKLIGHT 10 it should be 0.33V.

3) When using PWM are you using the same pin as when using the backlight option - GP2?
If not change the backlight option to the pin that works for PWM.
Perhaps there is a problem with GP2.
.
Edited 2025-04-02 13:44 by phil99
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 09:51pm 02 Apr 2025
Copy link to clipboard 
Print this post

@Phill99
Backlight 50 gives me 3.3v
Backlight 2 gives me 1.3v
This is running the backlight with 5v as per Geoff's circuit for the Backpack.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2417
Posted: 10:32pm 02 Apr 2025
Copy link to clipboard 
Print this post

Is that the one with 2 FETs on the PCB between the Backlight pin and the LCD_LED pin?
If the design was in Silicon Chip tell me which issue and I will look it up.

If it has the FETs I think that is intended for displays that don't have Q1 to switch the backlight led. Those panels have the LED anode connected to the LED pin and cathode to ground.

Newer panels have a 10kΩ resistor from the LED pin to Q1 base. Q1 emitter goes to ⏚ and collector to the LED cathode via a low value resistor. Anode to Vcc.

All my previous suggestions are based on the newer panels, where the LCD_LED pin connects directly to the backlight pin, no FETs on the PCB.

If the PCB has the FETs try soldering a 1kΩ from the LCD_LED pin to ⏚, that will give the drive FET a proper load.
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 11:29pm 02 Apr 2025
Copy link to clipboard 
Print this post

Phil,  That was May 17 SC
Ive always used this circuit, never had a problem with Backlight or PWM.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2417
Posted: 12:27am 03 Apr 2025
Copy link to clipboard 
Print this post

  Quote  WebMite MMBasic RP2040 Edition V6.00.01
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION SYSTEM I2C GP20,GP21
OPTION AUTORUN  ON
OPTION LIBRARY_FLASH_SIZE  16000
OPTION DISPLAY 43, 80
OPTION LCDPANEL ILI9341, LANDSCAPE,GP7,GP8,GP9,GP2
OPTION WIFI Belong******, ************, PICOE6614104034
OPTION TOUCH GP14,GP15
GUI CALIBRATE 0, 3885, 3810, -895, -651

Using the Backlight command with the above does not seem to work properly. I usually run the display at 75% and to dim at night I use 2%.  2% works great on MM but with the above 2% is more like 50% and I can't make it dim any more. Backlight 0 does turn the screen off.
and
  Quote  PWM works and Backlight doesn't. I'll try a different Pico-W.

Ok now I am confused. May 17 SC is a MicroMite backpack, not WebMite.
I had loaded the same firmware and LCD settings shown above on a WebMite and it works perfectly. My previous answers have been based on that.

The circuit in May 17 SC uses 2 FETs to control the backlight and is intended for LCD panels that do not have Q1.
Backlight control comes from pin 26 of the MicroMite. Check the voltage on pin 26 at  BACKLIGHT 50 and again at BACKLIGHT 10. that should give 1.65V and 0.33V *** See Edit below.

If it does there is a hardware problem between there and the display.
  Quote  Newer panels have a 10kΩ resistor from the LED pin to Q1 base. Q1 emitter goes to ⏚ and collector to the LED cathode via a low value resistor. Anode to Vcc.
Does the panel you are using have Q1?
If it does try soldering a 1kΩ from the LCD_LED pin to ⏚, that will give the drive FET on your PCB a proper load to help turn Q1 off.

Edit.
Have setup a MicroMite II (MMBasic Ver 5.05.05) with an ILI9341 as per May 17 SC except without the LED drive FETs as my panel has Q1 so doesn't need them. Pin 26 goes straight to the LCD_LED pin.
The MicroMite firmware doesn't have the BACKLIGHT command so used PWM 2,250,50 and got 1.6V on pin 26 as expected. Changed to PWM 2,250,10 and got 0.33V as expected and the display dimmed correctly. PWM 2,250,100 gave 3.15V and full brightness.

In summary you can't use the BACKLIGHT command as it isn't supported on the MM2 but is on the MM+ though for SSD1963 display only, PWM is all there is.

Edit 2.
Got out a MM+ LCD Backpack and measured the voltages at the LCD_LED pin, it has the 2 MOSFETS and an old ILI9341 without Q1. They are similar to the voltages you posted above at the same PWM settings.
My guess is your panel has Q1 and needs the 1kΩ from LCD_LED pin to ⏚ to make it compatible with the 2 FET circuit.
Edited 2025-04-03 16:23 by phil99
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 08:45am 03 Apr 2025
Copy link to clipboard 
Print this post

Phil,
AS I said in my original post I am using a PicoW, I designed a board for the Pico and use the same backlight circuit. The backlight circuit works fine with PWM on MM and I have used my Pico board before and never had a problem with the backlight command until I used it on a PicoW. I will look at Q1 on the board tomorrow
Edited 2025-04-03 18:47 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 109
Posted: 09:49am 03 Apr 2025
Copy link to clipboard 
Print this post

G'day Palcal,
This problem is not isolated to the Pico-W variant.

I have just finished assembling a Pico-Backpack board (SC kit) and it is showing the same symptoms.

After some investigation it appears the backlight frequency was changed from 1Khz in V50707 to 50Khz in V50800. (according to the manual and measured in V60001)

The second FET in the backlight circuit takes too long to turn off so the backlight won't effectively drop below 12-15% @ 50Khz, it will turn off however at 0%

A couple of solutions would be to drop the 1K gate resistor to FET 2 to a lower value.
Or use the PWM command at 1Khz as per the older software.

Hope this helps.

Regards,
Lyle.

P.S. This is the older ILI9341 without transistors in the backlight circuit.
May be worse with other versions.
Edited 2025-04-03 19:51 by mozzie
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 10:03am 03 Apr 2025
Copy link to clipboard 
Print this post

Thanks for that Lyle, yes I am using PWM as a work around but couldn't understand why Backlight command didn't work properly. Does Matherp know of the problem, sounds like a simple fix.
Edited 2025-04-03 20:04 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2417
Posted: 11:36am 03 Apr 2025
Copy link to clipboard 
Print this post

In Edit 2 in my previous post I tried a MM+ LCD Backpack that has the 2 MOSFET backlight circuit and tested various frequencies from 250Hz to 50kHz and the brightness only varied slightly.
So I guess it depends on the component tolerances. Reducing Q2 gate resistor as suggested would certainly help with both variants of the ILI9341. 330Ω may be low enough. The newer version ILI9341 with Q1 may also need a 1kΩ from LCD_LED pin to ⏚ as any leakage through Q2 on your PCB will prevent Q1 on the panel turning off properly.

The other option is if the LCD panel has Q1 you don't need the 2 MOSFETs or their 5V supply. Q1 is usually between resistors R5 and R6. Q1 on the panel does the same job.
Remove the 2 MOSFETs and the 1kΩ and link the Backlight pin directly to the LCD_LED pin.
Edited 2025-04-03 21:48 by phil99
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 109
Posted: 02:19pm 03 Apr 2025
Copy link to clipboard 
Print this post

G'day,
After some searching a comparison of both types of ILI9341 is possible:
Ver 1.1 with no additional circuitry.
Ver 1.2 with backlight driver onboard.

As per Phil99's comments the expectation was that the extra driver circuitry would make the situation far worse, surprisingly its not a massive change, so possibly more to do with discharging the gate capacitance of FET 2?

Without Driver on LCD PCB: 1% @ 50KHz = 15% @ 1KHz
With Driver on LCD PCB: 1% @ 50KHz = 25% @ 1KHz

Also ILI9488 with Driver: 1% @ 50KHz = 22% @ 1KHz

This is swapping them onto the Pico-Backpack PCB with no changes, and judged by mk1 human eyeball.

As Palcal states these are still FAR too bright in a dark room, 1% at 1Khz is about spot on.

In my view ANYONE who fits a high brightness standby LED / clock to ANYTHING, without a dimmer control, should have their eyelids removed....  

Regards,
Lyle.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7504
Posted: 03:42pm 03 Apr 2025
Copy link to clipboard 
Print this post

Apparently the PWM frequency used for dimming the displays on mobile phones is usually  in the 215Hz - 250Hz region.

When the manual section on audio was written we only had PWM output and using PWM at 1kHz could well have introduced noise. I can understand shifting it to 50kHz to remove all audio problems, but it looks like that is causing problems on some displays. Of course, the answer is to use SPI or I2S for audio and reduce the dimming PWM frequency. :)

There are also special issues with OLEDs I believe. They switch faster, which may lead to flicker being more obvious in some cases.
Edited 2025-04-04 01:49 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 109
Posted: 08:44pm 03 Apr 2025
Copy link to clipboard 
Print this post

G'day Mick,
Good call, the move to digital audio might make the move back to 1KHz a simple solution.  

A message has been left for Matherp on the release candidate thread asking to have a look here.

The drivers for the small Oled displays appear to have an inbuilt dimming system, no backlight to PWM. Not sure about any of the larger versions, haven't tried one out as yet.

Regards,
Lyle.
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 09:01pm 03 Apr 2025
Copy link to clipboard 
Print this post

In the manuals the description for PWM is different for the Picomite compared to the MM. For the Picomite....
  Quote  Minimum frequency = (cpuspeed + 1) / (2^24) Hz. Maximum speed is
OPTION CPUSPEED/4. At very fast speeds the duty cycles will be
increasingly limited

For the MM....
  Quote  and ‘freq’ is the output frequency (between
20 Hz and 500 kHz) .

I did the calculation for the frequency on the Picomite and got a stupid answer, Maybe I did it wrong.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2417
Posted: 09:12pm 03 Apr 2025
Copy link to clipboard 
Print this post

If Peter chooses not to reduce the PWM frequency all is not lost.

For Ver 1.2 with Q1 backlight driver onboard.
Remove MOSFETs Q1 and Q2 and add a link from Q1 gate pad to Q2 drain pad.
Tested to 100kHz and dims correctly.

For Ver 1.1 with no additional circuitry.
Reduce the gate - source resistor to 330Ω, though this might only partly reduce the problem.
Or replace Q2 with a PN200 or similar PNP transistor.
The tricky bit is you need to add a 4.7kΩ in series with the base.

With through-hole components you can just bend the base leg up so one end of the base resistor can use the gate (base) pad. Join the free legs mid air.

For surface mount cut the gate (now base) track and solder the resistor across the gap.

Not tested.

Edit.
  Quote  I did the calculation for the frequency on the Picomite and got a stupid answer,
For a CPU speed of 252MHz I get a minimum of 15.02Hz and maximum of 63MHz
Edited 2025-04-04 07:24 by phil99
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025