Can WIO backlight intensity be adjusted?

So far, I found
digitalWrite(LCD_BACKLIGHT, HIGH);
digitalWrite(LCD_BACKLIGHT, LOW);
What happens is that HIGH turns on the backlight to a very bright setting, very well readable. LOW seems to turn it off completely, making the display unreadable.
Problem is that the display is far too bright in low-light conditions. And I also would like to save battery power.
I would like to use the built-in light sensor, enabled by pinMode(WIO_LIGHT, INPUT); and connected to A13 to adjust the backlight brightness.
Any idea if this is a possibility?

I wanna do the same thing. You found out how?

Hi Ben,

Yes!

Switching the backlight OFF and ON at faster-than-eye-can notice rate and the % of time it is ON is the intensity.
This works fine but it depends a bit on the rest of the code … in case you have a very time-consuming loop elsewhere in the software, the backlight intensity (if not 100%) is not constant which could be a bit irritating.

What works with my code: I now use the light sensor at the back of the WIO and depending on that value, I let the software decide between
A) 100% with black letters on white background
B) 20% with Green text on black background.
It would be possible to make use of timers and interrupts to further improve - but I didn’t go into that since good enough for what I wanted.

I copied a bit of code snippets from my software to illustrate. Pls note that this won’t compile unless you add init statements. WIOLoopcounter in my code is a counter that is incremented each loop and reset every second.
Also note that the 50 and 100 values might be a bit on the high side for a loose WIO, but my WIO is build in and light towards the window at the back on the WIO (where the amblight sensor is) is a bit obstructed.

AmbLight = analogRead(WIO_LIGHT);

int dividor = 5;
    if ((AmbLight > 100) && (dividor == 5)) {dividor = 1;} //High brightness
    if ((AmbLight < 50) && (dividor == 1)) {dividor = 5;} //Low brightness for dark environment
    
    //Set intensity
    if (WIOLoopcounter % dividor == 0) {
      digitalWrite(LCD_BACKLIGHT, HIGH); //ON 20% of the time in case dividor is 5. 
    } else {
      digitalWrite(LCD_BACKLIGHT, LOW);
    }

FYI: Another approach I tried and abandoned since didn’t work very well is following:
Replace the background “Full white” by various shades of Grey color. Darker grey if darker environment.
Major disadvantages were:

  • a value greyed out is no longer visible
  • Intensity varies significantly by the angle with which you look at the screen.
  • You need very dark grey before the backlight dimming is significant and display becomes hard to read since contrast is reduced to an absolute minimum.

Some Greytones I have been experimenting with in case you want to retry:

#define TFT_WHITE   0xFFFF
#define TFT_BLACK   0x0000
#define TFT_DGREY    0x5AEB  //01011|010111|01011      hard to tell difference from black letters
#define TFT_MGREY   0x9CD3   //Good for value "greyed out"
#define TFT_LGREY   0xC618
1 Like