Unlike the resistive PiTFT, the capacitive version does not have a resistive touch controller chip that we can take advantage of as an extra backlight control pin. Instead, you can set up GPIO #18 as an on/off or PWM control.

Note that if you are playing audio out the headphone jack, you can't use the PWM capabilities of GPIO #18 at the same time, the PWM function is reassigned to do audio. However,  you can use it as a simple on/off pin

To enable using GPIO #18 as a backlight, solder closed the #18 backlight jumper on the PiTFT capacitive PCB!

OK now you can use the PWM output on GPIO 18. There's python code available for controlling the PWM pin but you can also just use the WiringPi shell commands.

With these basic shell commands, you can set the GPIO #18 pin to PWM mode, set the output to 100 (out of 1023, so dim!), set the output to 1000 (out of 1023, nearly all the way on) and 0 (off)

gpio -g mode 18 pwm
gpio -g pwm 18 100
gpio -g pwm 18 1000
gpio -g pwm 18 0

Try other numbers, from 0 (off) to 1023 (all the way on)!

This guide was first published on Jul 21, 2014. It was last updated on Apr 04, 2024.

This page (Backlight Control) was last updated on Oct 07, 2014.

Text editor powered by tinymce.