Raspberry PI - Enable (WaveShare) 4" 800x480 IPS HDMI screen blanking and backlight off

For a project I needed a Raspberry with a screen, preferably in compact package. While researching the options, a comment mentioned the quality of the picture of those screens so I decided to try it.

As usual there are clones of clones of those around, but the instructions that work are at the wiki of WaveShare here: 4" HDMI IPS

The screen works fine on a Raspberry 3 I have. What I wanted to have and was missing on others similar displays I have is not only to blank the screen, but also to turn off the LED back light. There is a physical switch to turn off the light, but that does not make a lot of sense if you want to embed this thing into a box. There is a single IC that looks like a DC/DC and most probably is the LED constant current controller. It is 5 pin SOT-23 package with markings N66J. Searching for that I found only links in Chinese on sites related to parts sourcing, but no datasheets were linked.

I searched around for 5 pin LED boost controller IC, and looked at datasheets, while probing with a multimeter if the pins of the actual IC match those described in the documentation. Finally there was somewhat of a match - TI LM3410. Such boost controllers usually have a current setting resistor of a low value, input and output capacitors, inductor and a diode. If there are additional components they could be a small capacitor to set the oscillation frequency and eventually a resistor to control the dimming pin, usually pulling it to a defined state to fully on. There was only one additional 10k resistor connecting a pin to input voltage pin.

From a youtube video I saw someone else doing the same and mentioning that pin 8 of the main IC that deals with HDMI - TFP401A is sync detect and will be pulled low if there is no signal. A perfect match! The led IC will be stopped when there is no signal from the PI. Adding hdmi_blanking=1 to /boot/config.txt will be allow screen blanking to be triggered by power management, which will then pull low pin 8 of the IC which will turn off the screen backlight.

Here is a short youtube video I uploaded