Datasheet
Backlight Control
The backlight of the 2.8" PiTFT has 4 LEDs in series and it draws ~75mA at all times, controlled by a transistor. The
PiTFT 3.5" display has 6 LEDs in a row, and we use a boost converter to get the 5V from the Pi up to the ~20V needed
to light up all the LEDs.
There might be times you'd like to save some power and turn off the backlight. The screen and touchplate will still
work, you just can't see anything. We designed the board with the STMPE610 touchscreen controller which has 2 extra
GPIO and tied one of them to control the backlight. You can use the command line to control the backlight.
By default, the backlight's on...but you can control it in two ways!
PWM Backlight Control with GPIO 18
If you want precise control, you can use the PWM output on GPIO 18. There's python code for controlling the PWM but
you can also just use the kernel module and shell commands.
You'll need to make sure the STMPE control is not 'active' as the STMPE GPIO overrides the PWM output.
sudo sh -c 'echo "1" > /sys/class/backlight/soc\:backlight/brightness'
(Or if you are running an old kernel before the backlight object, try sudo sh -c "echo 'in' >
/sys/class/gpio/gpio508/direction")
OK now you can set the GPIO #18 pin to PWM mode using WiringPi's gpio command
With these basic shell commands, you can set the GPIO #18 pin to PWM mode with 1000 Hz frequency, set the output
to 100 (out of 1023, so dim!), set the output to 1023 (out of 1023, nearly all the way on) and 0 (off)
If you'd like to not have #18 control the backlight, simply
cut the solder jumper, the tiny trace between the two
large gold pads marked Lite #18
gpio -g mode 18 pwm
gpio pwmc 1000
gpio -g pwm 18 100
gpio -g pwm 18 1023
gpio -g pwm 18 0
© Adafruit Industries
https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-
pi
Page 54 of 70










