question

Edouard Lafargue avatar image
Edouard Lafargue asked

Found a Raspberry Pi LCD touchscreen that needs no drivers or configuration

I haven't seen this on this forum before, so I thought I'd share: it is surprisingly easy to install a LCD on a raspberry Pi that needs absolutely zero configuration or calibration, either for the screen or touch.

Just search for "DSI" screens on Amazon or others, those are the screens that use the flat ribbon connection on the Pi instead of GPIOs, otherwise they look pretty much identical.

Those DSI screens are similarly priced as the small GPIO-based screens, but usually have a higher resolution (800x400 or higher), capacitive touch that requires no calibration, and of course they use no GPIO.

The nicest part is that once you connect the screen, that's it, no further action needed, it works. Just power up your Pi, remove `/etc/venus/headless`, reboot and you're in business!

I bought a "Waveshare" brand 4" screen on Amazon (perfect size for a Pi), but many other sizes/brands exist, I suspect they all behave the same. "Raspberry Pi DSI Screen" is a good search query.

Hope this is useful to others!

Raspberry Pi
40 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.

Hi @Edouard Lafargue,

do you have adaptive brightness and display off time working (just like on a GX 50 touch)?
I think that's the only thing which is not working, at least not without modifications.

0 Likes 0 ·
Edouard Lafargue avatar image Edouard Lafargue Stefanie (Victron Energy Staff) ♦♦ commented ·

Good question: the 4.3in screen does not have brightness adjust without a small hardware modification, but the 5in version has standard software backlight control and should work with Venus OS - I have not tried it yet.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Edouard Lafargue commented ·

Ah ok, didn't know that.

Well, the control buttons for brightness adjust and display off time in Venus OS remain empty, in contrast to the GX 50 touch/Cerbo GX combo, which automatically detects the screen and have the buttons shown.

bildschirmfoto-2021-02-18-um-164302.png

bildschirmfoto-2021-02-18-um-164237.png

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

You need to configure the RPI for brightness and blanking. Easiest way is to use my setup script:

https://github.com/kwindrem/RpiDisplaySetup

It requires adding an overlay for backlight and also hooking in the brightness and screen blanking to the /sys file system stuff. I have only used this on the official RPI 7" touchscreen so your milage may vary.

1 Like 1 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

Thanks Kevin,

I had your script in mind but then I thought it will work only for the HDMI port. Will give it a try and report back.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

Blanking is working just fine after running your script though no brightness. But I can live with that. Great and thanks!

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

my script does some tests in the /sys/class file system.

If the brightness control doesn't appear in the GUI, the script isn't finding the right bits. You might have a look in that file system and see if there is an alternate brightness file you can hook into.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

I see it in the script and it obviously cannot find

 device=/etc/venus/backlight_device

hence not installing rpi_backlight. There is no backlight_device in /etc/venus and a system wide search doesn't reveal anything like that.

Running 2.70~4, which maybe is missing something. I'll try another firmware.


0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

I'm not exactly sure how things work but my guess is the rpi-backlight-overlay does some magic and the /sys/class/backlight/rpi_backlight appears after a reboot. Since you aren't using the RPI display that won't happen.

I was suggesting you poke around in /sys/class and see if there is another device that might offer backlight control. You are partway there because you have the screen saver (blanking) working so it is possible you might find something for dimming.

For example, I discovered the blanking switch for HDMI displays in /sys/class/graphics/fb0.

If you think you found something that might be dimming for your display you can write to the file. Here's what you'd do to set the RPI display to 50% brightness

echo 50 > /sys/class/backlight/rpi_backlight

If you are happy with the way it's working then you probably want to spend your time on other projects.

This won't be related to software version.

1 Like 1 ·
Edouard Lafargue avatar image Edouard Lafargue Kevin Windrem commented ·

It looks like some screens support `/sys/class/backlight/rpi_backlight` while others don't, it's a bit of a hit or miss there. My 4.3in Waveshare screen does not populate anything inside of `/sys/class/backlight` for instance...

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

Interestingly after playing with it I let the script run a second time (just wanted to see the log output) and hit install over the already installed version. Now it's no longer blanking and instead is dimming to maybe 50% after a couple of seconds, independent of the blanking setting and no brightness adjust in the GUI.

What I've found

/sys/devices/platform/rpi_backlight/backlight/rpi_backlight

which seem to contain the controls. But their content doesn't match the actual values.

And I can't write into it. Example:

root@raspberrypi4:~# echo 50 > /sys/devices/platform/rpi_backlight/backlight/rpi_backlight/max_brightness

-sh: /sys/devices/platform/rpi_backlight/backlight/rpi_backlight/max_brightness: Permission denied

Permissions:

root@raspberrypi4:~# ls -l /sys/devices/platform/rpi_backlight/backlight/rpi_backlight

-r--r--r--    1 root     root          4096 Feb 19 06:50 actual_brightness

-rw-r--r--    1 root     root          4096 Feb 19 08:13 bl_power

-rw-r--r--    1 root     root          4096 Feb 19 06:50 brightness

lrwxrwxrwx    1 root     root             0 Feb 19 06:50 device -> ../../../rpi_backlight

-r--r--r--    1 root     root          4096 Feb 18 21:34 max_brightness

drwxr-xr-x    2 root     root             0 Feb 19 06:50 power

lrwxrwxrwx    1 root     root             0 Feb 19 06:50 subsystem -> ../../../../../class/backlight

-r--r--r--    1 root     root          4096 Feb 19 06:50 type

-rw-r--r--    1 root     root          4096 Jan  1  1970 uevent

Yes, I'm happy with just blanking and will set it to do just that.

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

It looks like some of the parameters are read only. max_brightness is one of those.

See if you can write to 'brightness' or 'bl_power'. Those are the two that control dimming and blanking for the RPI 7" display.

Once you find the proper parameters, you can hook those into the Venus GUI by putting the path to the parameter in /etc/venus/blanking_display_device and /etc/venus/backlight_device

Once that works, you might want to edit the script so it'll reinstall the mods when you update Venus OS.

Let me know what you find so I can look into incorporating it into my script.

0 Likes 0 ·
Edouard Lafargue avatar image Edouard Lafargue Kevin Windrem commented ·

I just did a bit more research on my Waveshare 4.3" screen, and I'm happy to report that dimming and blanking works fairly well. The only thing that does not work entirely is completely turning off the backlight when the screen is blanked, that particular screen does not seem to support that?

After installing the rpi-backlight overlay as described in https://github.com/kwindrem/RpiDisplaySetup here is what I configured:

cd /u-boot/overlays
wget https://github.com/kwindrem/RpiDisplaySetup/raw/main/rpi-backlight-overlay.dtb

echo "/sys/class/graphics/fb0/blank" > /etc/venus/blank_display_device

echo  "/sys/class/backlight/rpi_backlight" > /etc/venus/backlight_device"

... and reboot.

Interestingly:

  • /sys/class/backlight/rpi_backlight/max_brightness is 255
  • /sys/class/backlight/rpi_backlight/actual_brightness is the current brightness
  • /sys/class/backlight/rpi_backlight/brightness is how I set the brightness (echo 0 to echo 255 there)
  • /sys/class/backlight/rpi_backlight/bl_power is "0" by default, and writing any value other than zero sets the brightness to minimum, but not completely off. Not 100% sure how that file is supposed to behave...

Note: I have seen a lot of people who are not familiar with Unix/Linux in general and simply type filenames hoping the contents will magically be displayed, and that doesn't work. You have to use the small utility called "cat" to display files. For instance:

cat /sys/class/backlight/rpi_backlight/actual_brightness

Likewise, for the /sys/ virtual filesystem (everything is a file on a Unix system, even peripherals), you have to use "echo" and the ">" symbol to send the output of "echo" to the virtual file:

echo 127 > /sys/class/backlight/rpi_backlight/brightness


Hope this helps!
0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Edouard Lafargue commented ·

Thanks a lot! It's working for me too.

I had no idea how to get that into /etc/venus. Was thinking of symlink or something else. Not a linux expert. But your two lines makes it clear now.

                               
  1. echo "/sys/class/graphics/fb0/blank" > /etc/venus/blank_display_device
  2.  
  3. echo  "/sys/class/backlight/rpi_backlight" > /etc/venus/backlight_device

Should be enough for @Kevin Windrem to update the script.

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Edouard Lafargue commented ·

bl_power should turn off the display's backlight, not dim the screen. So it seems like Waveshare didn't implement things correctly.

My script installs the backlight overlay so your wget should not be necessary.

Hooking in /sys/class/graphics/fb0/blank to the venus screen saver logic as you've done may be a generic solution. It works on my RPI 7" touchscreen and an external HDMI display. Worst case for displays that don't have any backlight control, the screen would go black but the backlight would remain on.

I would remove /etc/venus/backlight_device to avoid the problems you are having with dimming

0 Likes 0 ·
Show more comments
ve7mmg avatar image ve7mmg Stefanie (Victron Energy Staff) ♦♦ commented ·

This comment is directed to who is still having issues getting their Waveshare 4.3 screen to go dark "blank" .

This is my first post and I hope it's posted in the correct area?

I am a super beginner when it comes to Rpi and spent 3 days solving this issue after upgrading to Kevin's

I have been reading and trying many of the suggestions with no luck until today where I changed the fb0 to fb1 and all is working as I liked it prior to the upgrade.

p.s. Thanks Kevin for the superb job on upgrating the display and ease to get updates.

  
                         
  • echo "/sys/class/graphics/fb0/blank" > /etc/venus/blank_display_device
0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem commented ·

I have updated my script based on discussions here.

It now asks the installer whether display brightness control should be installed rather than trying to guess.

I also switched to /sys/class/graphics/fb0/blank to control blanking (aka screen saver). The worst case is the display will switch to a black screen with backlight on. This happens if the display doesn't support backlight control (many HDMI displays).

These changes should support a wider range of displays.

A reboot may be required if installing the overlay or modifying config.txt but other changes only require a GUI restart.

To apply these changes, download the repo run setup again.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

Thanks Kevin, that was really quick. I'm not seeing brightness control in the GUI.

From the log:

2021-02-19 19:04:23.260879500 RpiDisplaySetup/setup: setting up brightness control

edit: and I think it does the same as yesterday when I installed the script again. Slightly dimmed after a couple of seconds and then does not go blank.

And looking further into your new script, I was not prompted for "Do you wish to install the dimming brightness control (y/n): "


0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

Oops. Forgot to move the current tag in the repo. You were running the old script.

Grab a new copy from the repo and try again.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

Yes, just figured out that it was still using the old script. I was thinking that uninstall will completely remove it or at least install again will overwrite. But that caused an error.

Now I got the prompt and display comes slightly dimmed and goes blanking after display off time though still not seeing the brightness control.

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

If you answer yes at the prompt for brightness control you should see the brightness slider in the Settings/Display... menu. If you answer no at the prompt, the slider won't be present. It doesn't even matter what's in the file to show the slider.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

Of course, I answered yes.

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

Do you get the message: "setting up brightness control"?

Also, heck to see if /etc/venus/backlight_device exists after running the install script

Here is how the script works:

Because the script is called to reinstall the package after a VenusOs update, options like brightness yes/no are kept in a file in the script's directory. So the prompt sets/clears that file and the install portion of the script checks for it's existence. When reinstalling, the U/I portion of the script is skipped and the option is read from the file.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

Yes.

Do you wish to install the dimming brightness control (y/n): y ++ Installing RPI display enhancements

setting up display blanking

setting up brightness control

restarting GUI

adding RpiDisplaySetup/setup to reinstallScriptsList

completed

/etc/venus/backlight_device exists.

I really don't want to bother you with this. Still happy with how it works now and I can manually adjust brightness by writing into /sys/class/backlight/rpi_backlight/brightness. On the other hand a working slider would be cool.

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

There has to be something wrong if you can change brightness by writing to /sys/...

Do you see the slider ?

If you see the slider but it doesn't work, it's possible the file's content is not correct. I wasn't checking the content, but just now added a check to make sure it was correct.

You can download a new copy of the script from GitHub that has that last test. Or you can run the script and uninstall then run it again and install.

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

There is no slider. Your last tweak to the script didn't change that. All I have is the Display off time setting.

/etc/venus/backlight_device updated correctly and contains the path to /sys/class/backlight/rpi_backlight (which is also existent), which is linked to /sys/devices/platform/rpi_backlight/backlight/rpi_backlight (does that seem right?).

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem Stefanie (Victron Energy Staff) ♦♦ commented ·

The only thing I've found to make the slider disappear with ANYTHING in /etc/venus/backlight_device is AutoBrightness

I don't see that selection showing up in the GUI but do see the parameter in Settings.

run dbus-spy from a command line

select com.victronenergy.settings

scroll down to Settings/Gui/AutoBrightness

It's value should be 0

If not, press enter and enter a 0 value.

You can also test the brightness adjustment with dbus-spy. The parameter is Settings/Gui/Brightness

0 Likes 0 ·
Stefanie (Victron Energy Staff) avatar image Stefanie (Victron Energy Staff) ♦♦ Kevin Windrem commented ·

The value was 1. I've set it now to 0 and the slider appears and is working. Nice!

bildschirmfoto-2021-02-20-um-194431.png

0 Likes 0 ·
Show more comments
rmaddy avatar image rmaddy commented ·

Thanks for the screen suggestion and the details on getting the brightness and screen blank to work.

But how are people mounting these Waveshare DSI screens to a wall with the RPi?

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem rmaddy commented ·

The Waveshare display I have has no mounting holes so I'd suggest Velcro for surface mounting.

You could cut a hole in the wall and build a support behind the display then cover it with a bezel.

There are other display options that may provide better mounting options.

0 Likes 0 ·
rmaddy avatar image rmaddy Kevin Windrem commented ·

I already have the 5" screen so I'm going to try to make it work. I just found a possible solution using https://www.amazon.com/gp/product/B07Z68R78S

I think that frame combined with a hole in the wall may work. I can glue hex nuts inside the hole that line up with the frame's screws to hold it in place. Velcro on the frame may work too.

BTW Kevin - thanks for your various scripts. Very helpful. I just wish there was reference documentation from Victron on some of the APIs available (besides dbus).

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem rmaddy commented ·

Here's what I did with my RPI Display:


Looks like this when all buttoned up.

img-0811.jpeg


With bezel removed

img-0810.jpeg


What's behind the curtain

img-0809.jpeg

The ugly hole is from previous work, initially from the RV factory and a PWM solar controller.

The metal frame is is a bar across the top and bottom. Two vertical bars are spaced back from the bar so the display mounts flush to the wall. The screws you see in the picture hold the frame in place while assembling everything. The screws that hold the bezel in place also hold the frame.

The bezel is 1/16" plastic.

0 Likes 0 ·
img-0811.jpeg (4.4 MiB)
img-0810.jpeg (4.9 MiB)
img-0809.jpeg (3.2 MiB)
rmaddy avatar image rmaddy Kevin Windrem commented ·

Looks good. Thanks for the pics.

0 Likes 0 ·
kurtinge avatar image kurtinge commented ·
Hi and thanks for the tip!


I have the RPi installed in a quite hidden place, near the batteries, and it is really working well. But I would like to have a screen installed near the chart table. As the distance is about 10m from the RPi I guess it will be quite problematic to extende the cable that far.

Anyone with a tip in this matter? Maybe installing a secondary RPi and open the console from there is the only choice? I was also thinkin of putting a old Iphone or tablet, but that will not be as nice

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem kurtinge commented ·
You could run a long HDMI and USB cable and use an HDMI touch display.

Running a tablet with a web browser and using the remote console via a LAN connection would also work. It doesn't need to be another Raspberry PI but that would probably work too. There are notes on this forum about setting up kiosk mode on various platforms that might make a web browser implementation more appropriate.

0 Likes 0 ·
2 Answers
alan avatar image
alan answered ·

Thanks, I grabbed a 5" one.

2 |3000

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

christophlaib avatar image
christophlaib answered ·

Waveshare 4.3 display off:
has anyone succeed to get backlit turned off after defined time " display-off time "
thx for sharing in advance !

2 |3000

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