Adafruit is open and shipping! Let's build back better, together!
0

PiTFT 3.5" and backlight control
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PiTFT 3.5" and backlight control

by DaveHkent on Mon Nov 09, 2020 4:05 pm

Any advice on a PiTFT and backlight control issue?:
https://www.adafruit.com/product/2441
Running on a Pi Zero W:
Code: Select all | TOGGLE FULL SIZE
uname -a
Linux livroompi 5.4.51+ #1327 Thu Jul 23 10:53:06 BST 2020 armv6l GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID:   Raspbian
Description:   Raspbian GNU/Linux 10 (buster)
Release:   10
Codename:   buster


I have been controlling the backlight using the gpio commands in the Adafruit documentation, e.g.:
Code: Select all | TOGGLE FULL SIZE
gpio -g mode 18 pwm
gpio pwmc 1000
gpio -g pwm 18 1023

One of two problems I'm getting is that when in screensaver mode (showing a moving clock), 1023 is way too bright. However the lower I drop the brightness, the more I can hear a high pitched whine coming from it. Even at 512 it is quite noticeable.

If I leave out the 'gpio pwmc 1000' line (I noticed this was missing from one guide) then it is quieter, but it looks like the brightness range is from about 875 to 1023. 871 flickers a lot.

All the backlight control examples I could find was for the 2.8 version. What is the correct way of doing this on the 3.5"?

The other problem I did see was originally I was just turning the backlight off by setting the pwm value to 0. Sometimes when waking up the screen again, it would cause a power cycle. I'm using an official Pi power supply that came with the Pi Zero. What current supply should you need for a Zero with the PiTFT (no other hardware attached)?

DaveHkent
 
Posts: 5
Joined: Thu Dec 27, 2018 1:13 pm

Re: PiTFT 3.5" and backlight control

by mikeysklar on Tue Nov 10, 2020 9:11 pm

Here is our guide page for the 3.5" PiTFT backlight control:

https://learn.adafruit.com/adafruit-pit ... ht-control

It is all going to be going through pin 18 so the commands are the same.

Code: Select all | TOGGLE FULL SIZE
gpio -g mode 18 pwm
gpio pwmc 1000
gpio -g pwm 18 100
gpio -g pwm 18 1023
gpio -g pwm 18 0


The display at full backlight brightness should be about ~100mA.

The Pi Zero W is about ~120mA with WiFi on.

5v / 500mA would be enough, but I tend to give them a lot extra and run my Zero's at 1A+.

mikeysklar
 
Posts: 2389
Joined: Mon Aug 01, 2016 8:10 pm

Re: PiTFT 3.5" and backlight control

by DaveHkent on Wed Nov 11, 2020 4:50 am

Thanks, those are the commands I followed. 0 turns the screen off fine, 1023 is pretty bright and anything in between makes a high pitched noise, which starts to become audible around 700. 100 seems quite loud. You certainly hear it walking past.

The note does change with the brightness value, so I have been considering seeing if I can play a tune, just for the hell of it!

If nobody has reported this, it could be that I've got a faulty screen (which I have had for a while). Any ideas on possible solutions? An extra bit of grounding or solder on an extra capacitor?

DaveHkent
 
Posts: 5
Joined: Thu Dec 27, 2018 1:13 pm

Re: PiTFT 3.5" and backlight control

by mikeysklar on Wed Nov 11, 2020 7:28 pm

TFT backlight inverters are notoriously noisy.

Your best option is to find a quiet setting for PWM that is bright enough or to switch to another display type.

An OLED would be ideal, but we don't get into the kind of resolution you are at with the Pi 3.5" TFT.

Maybe checkout the hyperpixel different models of TFT might have better backlight noise supression.

https://www.adafruit.com/product/3578

mikeysklar
 
Posts: 2389
Joined: Mon Aug 01, 2016 8:10 pm

Re: PiTFT 3.5" and backlight control

by DaveHkent on Thu Nov 12, 2020 4:15 am

Thanks for the responses. It is disappointing to find it is a 'feature' and the answer is to start again with another Adafruit product. I'll stick with the very binary full brightness or off and see if I can work out why that was crashing my Pi.

DaveHkent
 
Posts: 5
Joined: Thu Dec 27, 2018 1:13 pm

Please be positive and constructive with your questions and comments.