question

wildmustango avatar image
wildmustango asked

Cheap 3.5" TFT touchscreen backlight Raspberry Pi Modification

Hello everyone, I know there's many people trying to use a Cheap 3.5" TFT touchscreen display for the GPIO on the Raspberry Pi with VenusOS. As you will have read on this forum, there are some solutions to get it working. The main issue, is that these cheap displays do not come with a backlight control solution.

So, I bring you a small hardware modification and some software I prepared for your convenience.

https://github.com/wild-mustango/VenusOsTFT35

This tutorial I bring you, also gathers all the required info to get the screen working from scratch.

I know it is not really a question for the forum, but I think posting a solution is always a good way to answer people questions.

Feel free to test it and post here any comments.

I hope you find it useful.

Regards

P.S.: Regarding the framebuffer solution I show you on the GitHub repo, there is a cleverer and cleaner solution posted https://community.victronenergy.com/questions/132858/venus-285-raspberry-pi-35-tft-and-framebuffer-assi.html. I will try to update my repo with it.

P.S.2: I am not able to get links to work, sorry. If anyone can give a hint, will be appreciated.

Raspberry Pitouchscreen
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

4 Answers
Lars Filusch avatar image
Lars Filusch answered ·

@wild.mustango

Hi, i have a waveshare touchscreen running with blanking but the backlight is still running even the display is off. The display controller has to pins to pwm control the backlight.

Shout be easy to adopt your modification to get this running, but i think i need some help.

As far as i understand i need your backlightcntrl program. but where in the fs? and how to call it? ore is there no need to call the the program more then ones for installation?

thx

Lars

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

wildmustango avatar image
wildmustango answered ·

Hello @Lars78 I don't exactly know what model is your Waveshare display, but if it is based on the ILI9486 LCD controller, those pins will not solve the issue. This is because there is no circuitry connecting the controller and the backlight in cheap toucscreens.

If you still want to try, you can download source code for backlightCtrl and modify it for your needs from my GitHub repo.

In addition, you have venus-data.zip which has a compiled version.

This backlightCtrl program is loaded by rc.local at boot-up. It is stored at /data/tft35_scripts

Regards

5 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Lars Filusch avatar image Lars Filusch commented ·

ok, i’ll give it a try.

for my understanding, the display backlight is controlled by a pwm output from rpi, in my understanding no matter what kind of chip is the controller, just a pwm signal…?

thx!



PWM Light Adjustment

Connect the GND of the microcontroller (such as a potentiometer) to the GND pin in the figure below, and connect the voltage output terminal (DC 0~3.3V) of the microcontroller to the PWM pin as shown in the figure below so as to control the backlight brightness by changing the voltage.
Note: DC 3.3V is the darkest and 0V is the brightest.

https://www.waveshare.com/wiki/70H-1024600#PWM_Light_Adjustment

0 Likes 0 ·
wildmustango avatar image wildmustango Lars Filusch commented ·
It looks like PWM from the Raspberry is enough for controlling backlight of your display. There is a code snippet in the website you shared that uses WiringPi framework.

I think you will get it to work easily.

Regards

1 Like 1 ·
Lars Filusch avatar image Lars Filusch wildmustango commented ·

@wild.mustango it looks like i have to invert the PWM signal some how. after the installation of backlightCtrl the display is darker, after 30 sec. the display goes off, and after 45 seconds the backlight gets brighter...

best

lars

0 Likes 0 ·
Lars Filusch avatar image Lars Filusch wildmustango commented ·
...in normale operation the backlight is now much lower the before. touching the display after the 45sek. the display wake up with full backlight for a second. the backlight is very low again.
0 Likes 0 ·
Lars Filusch avatar image Lars Filusch wildmustango commented ·

as fare as i figured out with my very little experience in Arduino programming this is the part in backlightCtrl i have to change:

wiringPiSetup();
//Start screen switched off
pinMode (BL_CTRL_PIN, OUTPUT) ;
digitalWrite (BL_CTRL_PIN, HIGH);
while (1)
{
res=screenTouchDetect(&touchFd,delaySecs);
if (res == 1)
{
printf("Touch detected\n");
digitalWrite (BL_CTRL_PIN, HIGH);
}
else
{
printf("Timer expired\n");
digitalWrite (BL_CTRL_PIN, LOW);
}
}


am i right?

the question is: how to do that?

0 Likes 0 ·
Lars Filusch avatar image
Lars Filusch answered ·

solved!

Waveshare 70H HDMI has a on/off PIN on the PCB.

just connect to the PWM GPIO 18

very easy

install first RpiDisplaySetup via SetupHelper

install via USB Stick: https://github.com/wild-mustango/VenusOsTFT35 (nothing else to install!)


run RpiDisplaySetup setup

choose installation

choose HDMI automatic


modify /u-boot/config.txt


hdmi_blanking=1

hdmi_group=2

hdmi_mode=87

hdmi_cvt 1024 600 60 6 0 0 0

hdmi_drive=1


@wild.mustango thx for VenusOsTFT35

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

wildmustango avatar image
wildmustango answered ·

Hello @Lars78 sorry for my abscence. I'm happy to read you finally got your screen working!!

Goals take their time to arrive (:

I glad my GitHub repo helped you.

Kind regards

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources

Additional resources still need to be added for this topic

Raspberry Pi running Victron’s Venus firmware - Blog Post

Venus OS Large image: Signal K and Node-RED - Install

raspberrypi install venus image


Additional resources still need to be added for this topic