Jason_25
Posts: 113
Joined: Tue Oct 20, 2015 6:25 pm

Backlight Control on Waveshare 5" Touchscreen

Wed Nov 18, 2015 5:15 pm

This device comes with a physical backlight on/off switch but I'm worried that I will wear it out the way I plan on using it. It's also very small and difficult to solder.

I don't see any entries in /sys/class/backlight. Is it possible to use the "gpio" command to vary the current going to the screen to affect the backlight? The manual shows it uses 3.3v power on pins 1 and 17 and 5v power on pins 2 and 4.

Thanks for any help.

batfastad
Posts: 7
Joined: Fri Jul 13, 2012 12:12 am

Re: Backlight Control on Waveshare 5" Touchscreen

Wed Dec 23, 2015 1:30 am

Hi there

Wondering if you got any further with this?
I recently bought a 5" touchscreen with a hardware backlight switch... https://drive.google.com/file/d/0B9Jjnx ... sp=sharing

I'd love to be able to toggle on/off by script, eventually based around light sensor readings.

Cheers, B

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Fri Mar 11, 2016 8:39 am

Any news on this yet?

I would also like to control the backlight of the waveshare 5inch (B) HDMI Display by software e.g. from a python script.
If it is only possible to control the backlight by switching the button on the backside of the Display, I will not buy the display.

I'm looking for a 4,5 or 5 Inch Display that does not interfere with the GPIOs 18-21 of my hifiberry amp+. At the moment I'm using the official dsi 7" Display but I'd like to find a smaller and cheaper display. Any ideas? :?:

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: Backlight Control on Waveshare 5" Touchscreen

Sat Mar 12, 2016 9:22 pm

You can't control BL in those cheap/simple HDMI screen. The converter IC (HDMI to RGB) does not have output that can control BL driver - I have 5" LCD with HDMI in and it's build on TI TFP401 - this chip does not have output signal that could drive a backlight of LCD panel.

I've took a look on my 5" LCD that I bought on aliexpress, and I came with those conclusion:
This won't be an easy task - you need to have some knowledge in electronic circuits (a much more that connecting a LED diode to Pi GPIO and blinking it).
You need to hack your screen. I see 3 options (basing on my screen model):
1. add a transistor in series with backlikght LEDs - easier but it depends on used DC/DC converter for BL (if DC/DC converter is specialized for driving LEDs then this won't work)
2. figure out how to control DC/DC converter that supply power for backlikght LEDs and control the DC/DC chip (almost all DC/DC IC converters have shutdown/enable input).
3. Replace your switch (I see you have one) with right transistor (PNP/NPN or P-MOSFET/N-MOSFET) - nevertheless this might not be that simple as it sounds.
I suggest for you the 3rd option - easiest. And of course you have to spare one GPIO from you Pi :)

P.S. In my case (my LCD) I can go for option #2 only, because I have specialized DC/DC converter for LEDs (PT4103 - and this one require to have LEDs connected to him). But I see a EN input that is connected to +5V through resistor, so I just need to add a transistor between EN and GND and drive transistor from one Pi GPIO :)
Ps2. I got inspired by your question , and I'm thinking to add a backlight control for my display :D - If I do this, then I public my hack on new topic.

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Sat Mar 12, 2016 10:00 pm

I just had the idea to set max_usb_current = 1 in /boot/config.txt to make the PI supply as much power as possible to the USB port. Then it might be possible to power the display via USB. I am not a 100% sure if the 1.2 A current that can be drawn from the power rail of the pi are sufficient to power the display.

When the display could be properly powered via USB, it would be possible to cut off the USB power supply using the following command:

Code: Select all

sudo ./hub-ctrl -h 0 -P 2 -p 0 ; sleep 3; sudo ./hub-ctrl  -h 0 -P 2 -p 1
I haven´t tested it because I haven't decided to buy the display yet.

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: Backlight Control on Waveshare 5" Touchscreen

Sat Mar 12, 2016 11:41 pm

Hi,

Thanks, for remembering about max usb current option (I forgot about it :D while I was connecting my lcd).
The display draw max 800mA - avarage 600-650mA . Check my movie - I've been testing USB-Power meter but you can see how much current need 5" LCD: https://www.youtube.com/watch?v=p9LmTqubu7w

As for switching off USB port - not possible, Pi does not have power switches for USB ports that you can control - yes, Pi can monitor for overload on USB but I'm not sure how it's done in Pi2/Pi3 - there are no schematics for those Pi versions...

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Sun Mar 13, 2016 8:57 am

Many thanks for posting the link to the youtube video. Very helpful. Are you really sure that the usb ports cannot be cut off from power supply. I didn't dive deeply into the schematics but found this thread:

viewtopic.php?p=813383&sid=a95c741742fa ... 4f#p813383

Maybe someone could clarify for which pi model it is possible or not possible to disable the USB power supply.

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: Backlight Control on Waveshare 5" Touchscreen

Sun Mar 13, 2016 12:38 pm

Hi,

I have looked at schematics available at raspberry pi github , there is only schematic for A/B (not plus), for B+ and newer there is no schematic of USB circuits. Also I had good look on PCBs of Pi2 and Pi3 and I didn't see any USB power-switch IC .
And I remember reading, that if you backfeed power via USB socket , and your USB hub happens to have some power issue (voltage spike, etc...) then you fry your RPi because USB ports are behind protection circuit that is installed just after microusb power socket - so there would be a power switch ic on usb port(s) then you could not backfeed power to Pi.

The topic you linked - you can only reset/disable a usb port not the power line of that port.

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Sun Mar 13, 2016 1:48 pm

Ok, if it´s only possible to reset the usb ports and if the usb ports are permanently powered, it won't be easy to find a way to control the backlight of the waveshare 5" HDMI display by software. :(

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: Backlight Control on Waveshare 5" Touchscreen

Sun Mar 13, 2016 10:27 pm

Hi,

Without hacking your screen - not it's impossible to control BL by software.
I found clone (with switch) on aliexpress of this waveshare 5" hdmi screen. As far I can tell from photos, replacing switch with transistor won't work, because switch is in circuit with LEDs connected to dedicated LED switched (DC/DC) power supply . But you can replace switch with relay - I forgot about this :D . You can buy tiny relays with contact about 1A/30V and coil working in 5V - those small relays usually need small current for coil to operate, so adding small driver with transistor ,and driving transistor from GPIO will do the trick :)

--- update ---
I just dropped on YT two films with my hacked LCD so I can control backlight in my screen (using EN input of IC powering backlight LEDs).
This is a test before adding transistor buffer for RPi: https://www.youtube.com/watch?v=TtfMw2QhIUY
This is working presentation of my hack: https://www.youtube.com/watch?v=lP1gdCcOtek

I will tomorrow create new topic and put there photos, schematics, and links to YT movies with my hack information :)

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Mon Mar 14, 2016 7:23 am

Excellent work, very impressive!


Just one more question before I'm going to buy it. Does your hack interfere with the touch function? Is the touch function still working after you have hacked it?

It would also be great to have a python interface to control the backlight. The system could be called from Python to execute the command that you have shown in your yt video.

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: Backlight Control on Waveshare 5" Touchscreen

Mon Mar 14, 2016 10:21 pm

There is no need for python interface, just do as you control GPIO state from python code, just use any gpio lib that you like - child's play :ugeek: :D

I have created topic with link to github repo with more photos/etc :) viewtopic.php?f=44&t=140182

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Tue Mar 15, 2016 12:31 pm

Great many thanks for posting the link to the new topic.

I don't see a reason why the touch function shouldn´t work anymore. Just to make sure, is the touch screen still working, after you have hacked it?

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: Backlight Control on Waveshare 5" Touchscreen

Tue Mar 15, 2016 3:52 pm

This have nothing to do with touch, touch works on SPI in waveshare lcd, and in my on usb . It have to work (unless you break something around touch circuit (touch FPC/touch controller, cut some tracks around touch,etc.) while hacking....)

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Tue Mar 15, 2016 5:14 pm

Great, thanks for the confirmation that the hack doens´t interfere with the touch function. :D

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Tue Mar 15, 2016 9:22 pm

I just found this sainsmart 5" HDMI display with touch:

http://www.sainsmart.com/sainsmart-5-in ... -b-b.html/
http://hardware-libre.fr/2015/07/review ... h-display/

Probably I'm going to buy this one because I am not very good at soldering.

The above mentioned display comes with a SPI & HDMI interface and it seems that the backlight can be controlled without additional hardware. I am not a 100% sure but it seems that it is possible to power on/off the backlight by software. Dimming is also supposed to be possible.

What do you think of the above mentioned display? Do you think that it should be possible to control it by software without additional hardware? You seem to be very familiar with schematics and hacking displays so it would be great to have your opinion on these questions. :D

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: Backlight Control on Waveshare 5" Touchscreen

Fri Mar 18, 2016 4:42 pm

Hi,

I think you want my opinion :) , so...

I didn't found anything that could suggest the backlight can be controlled. Looking at those low-res photos I can only tell that BL circuit is made on PT4103 (this circuit looks identical). I don't see anywhere any mentions about BL control nor there is no solder pad (or goldpin) to connect to free GPIO for controling BL.... I'm pretty sure that's finding a display with BL control (with HDMI & USB/SPI touch) will going to be really hard, easier is just hack a display :D, wait, no, that isn't hack, that's an upgrade :D

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Sun Mar 20, 2016 4:46 pm

Saper_2 many thanks for giving your opinion :-) Very much appreciated! Thanks for your help.

I also think that the way how you are controlling the backlight of your display is more an upgrade than a hack. Hacking sounds forbidden and your solution is not illegal ... so lets call it an upgrade ;-)

I got the sainsmart 5 inch display delivered 2 days ago. I will connect it to my pi3 and then we will see, if controlling the backlight by software is possible. When it is not possible, I'll also uprade/hack my display.

Snyder
Posts: 31
Joined: Fri Sep 04, 2015 9:25 am

Re: Backlight Control on Waveshare 5" Touchscreen

Thu Mar 24, 2016 9:21 am

saper_2 wrote: I didn't found anything that could suggest the backlight can be controlled. Looking at those low-res photos I can only tell that BL circuit is made on PT4103 (this circuit looks identical). I don't see anywhere any mentions about BL control nor there is no solder pad (or goldpin) to connect to free GPIO for controling BL.... I'm pretty sure that's finding a display with BL control (with HDMI & USB/SPI touch) will going to be really hard, easier is just hack a display :D, wait, no, that isn't hack, that's an upgrade :D
In the meantime the manafucterer has confirmed that backlight control is not possible and the retailer has apologized for the mistake in the product description of the sainsmart display.. Backlight control is definitley not possible without upgrading it like you have done it.

HorstBaerbel
Posts: 4
Joined: Thu May 26, 2016 7:48 pm

Re: Backlight Control on Waveshare 5" Touchscreen

Wed Jun 15, 2016 7:14 pm

I've added backlight control to my screen with a simple circuit. You can read about it here.

stanlus
Posts: 1
Joined: Fri Nov 23, 2018 9:54 am

Re: Backlight Control on Waveshare 5" Touchscreen

Fri Nov 23, 2018 10:05 am

Hi guys,

I have a Waveshare 5inch HDMI LCD (B) and I would like to have a dimmable backlight control, as mentioned in this unofficial hack.

Unfortunately, this hack uses GPIO BCM18 (Pin12) to control the backlight which is also used by my Pi-DAC+.

Does one of you have an idea, whether it would work if to use BCM12 for backlight control?
Thanks, Kind Regards!

JohnsUPS
Posts: 19
Joined: Fri Jul 06, 2018 2:13 am

Re: Backlight Control on Waveshare 5" Touchscreen

Mon Dec 10, 2018 2:24 am

I bought an inexpensive 5" LCD panel for a recent project, and I needed a way to turn the backlight on and off. The display had an on/off switch on it, so instead of cutting traces, I added a couple of mosfets.
I measured the backlight currrent, which was ~107ma. The mosfets I used were rated higher than that, but I designed and installed the circuit prior to measuring the current. I could have got away with just using one.

What I did was use two TP2104N3 P-channel mosfets in parallel (it is what I had laying around). I used P-channel mosfets because they can be connected right across the switch. One side of the switch is +5v, the other is the backlight. It is because one side of the switch goes to +5 rather than one side of the switch going to ground that necessitated the use of a P-channel mosfet. The gates are connected together and switched by a 2n3904 to ground, and the base of the 2n3904 goes to a GPIO pin through a 1k or so resistor. I could probably do away with the transistor, but I typically follow any GPIO pin with a transistor to protect it. Works like a charm.

The backlight could also be dimmed with this circuit by providing a variable duty cycle signal to the GPIO pin.

oort
Posts: 1
Joined: Fri Dec 14, 2018 4:43 pm

Re: Backlight Control on Waveshare 5" Touchscreen

Fri Dec 14, 2018 5:57 pm

JohnsUPS wrote:
Mon Dec 10, 2018 2:24 am
I bought an inexpensive 5" LCD panel for a recent project, and I needed a way to turn the backlight on and off. The display had an on/off switch on it, so instead of cutting traces, I added a couple of mosfets.
I measured the backlight currrent, which was ~107ma. The mosfets I used were rated higher than that, but I designed and installed the circuit prior to measuring the current. I could have got away with just using one.

What I did was use two TP2104N3 P-channel mosfets in parallel (it is what I had laying around). I used P-channel mosfets because they can be connected right across the switch. One side of the switch is +5v, the other is the backlight. It is because one side of the switch goes to +5 rather than one side of the switch going to ground that necessitated the use of a P-channel mosfet. The gates are connected together and switched by a 2n3904 to ground, and the base of the 2n3904 goes to a GPIO pin through a 1k or so resistor. I could probably do away with the transistor, but I typically follow any GPIO pin with a transistor to protect it. Works like a charm.

The backlight could also be dimmed with this circuit by providing a variable duty cycle signal to the GPIO pin.
Could you post some schematics of your solution? You have connected transistor directly to backlight's switch and left it in off position, right?

JohnsUPS
Posts: 19
Joined: Fri Jul 06, 2018 2:13 am

Re: Backlight Control on Waveshare 5" Touchscreen

Sat Dec 22, 2018 12:23 am

I'll try to post my schematic....

My standard practice is to buffer a GPIO pin with a small value resistor, then to the base of a transistor. This is done to protect the GPIO pin. The transistor then does the heavy lifting for whatever I'm wanting to drive.

Image

Return to “Interfacing (DSI, CSI, I2C, etc.)”