How to setup raspberry pi 3B+ for 4K screen

for adv screen


Install raspbian linux.

Edit config.txt and add these rows:

arm_freq=800
core_freq=250
gpu_mem=320
hdmi_group=2
hdmi_mode=87
hdmi_cvt 3840 2160 24
max_framebuffer_width=3840
max_framebuffer_height=2160
hdmi_pixel_freq_limit=400000000

Connect raspberry to 4K tv screen.

Setup raspberry to kiosk mode.
How to: https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/


Setting up the Pi

Install default raspbian with desktop and recommand apps.

I’m assuming if you are following this then you already have a Pi setup with Raspbian. If you dont head over to www.raspbian.org/ and follow the instructions there to load Raspbian onto an SD card.

Once this is done boot your Raspberry Pi and open up a terminal window. Type in

sudo apt-get update && sudo apt-get upgrade -y

These commands will update the package list and upgrade any packages on your device.
Next we install the chromium browser, x11 server utilities and unclutter(removes the cursor from the screen).
To do this type in

sudo apt-get install x11-xserver-utils unclutter

Raspberry Pi Kisok - Install Chromium

The chromium browser includes a kiosk mode which displays the browser full screen wihout any taskbars or icons which works perfectly for a kiosk style screen.

Now that we have everything we need we can setup SSH to allow us remote access to the unit and get rid of the keyboard and mouse.

Setting up SSH

First we want to setup a static IP address for our Pi on the network. Make sure your pi is connected to your network and in a terminal window type
ifConfig
Note down the gateway and broadcast address and any other address settings you think you may need for your current connection.

Now in terminal we are going to edit your network settings and setup the static address. To do this type

sudo nano /etc/network/interfaces

This will open up your network interfaces file, start by changing the line that says
iface eth0 inet dhcp
to
iface eth0 inet static

Now you’ll need to add 3 lines straight after if they aren’t already there.

address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx

Raspberry PI Kiosk - Network Settings

Adding in the static address you would like to use next to the address line and then your gateway address which you noted down earlier into gateway. Gateway is usually the address of your router so if you forgot to write it down you can work it out that way. Remember to use an address that isn’t in the DHCP pool for your router to avoid any conflicts later on with other users on your network. Now hit ctrl-O to write the file and then ctrl+X to get yourself back to your terminal screen.

Now that you have a static address set you can enable SSH on the pi. We’ll use the wizard that comes with raspbian to do this.
In terminal type

sudo raspi-config

First step should be to change your user password which should be option 2. The default username is pi and the default password is raspberry.

Raspberry Pi Kiosk - Raspi-Config

Once you’ve changed your password head to option 8 – Advanced Options and then option A4 – SSH and just hit enabled.

SSH is now enabled, lets test it out. Head to another computer on the same network, if you are on a mac/linux computer you can do this next step from the terminal if you are a PC user however you will need to install a SSH program, my favourite being putty.

I’ll explain the steps for using a terminal window, if you are using Putty then you can just pick the information out and fill in the correct boxes with putty to set up. It’s very straight forward.

Raspberry SSH

So still on the 2nd computer open up a terminal window and type

ssh pi@xxx.xxx.xxx.xxx

Where the X’s represent the static address you gave your Pi in the previous part. If it’s worked you should be asked for your password. Enter the password you chose for your Pi and cross your fingers!

Now you should be greeted with a pi@xxx command prompt, this means you are now logged in and directly controlling your Pi.

Raspberry PI SSH logged in

Great, now you can put your Pi wherever it is going to live and never touch it again! We can now get on to setting up kiosk mode.

Setting up Kiosk mode

Before we start displaying anything on the screen we need to go through a few steps to setup and disable a few settings.

Firstly we should disable the screensaver and any energy saving settings as we don’t want our screen to go to sleep at all when it’s in use, wouldn’t be very useful if it went blank every 5 minutes.

While connected to your pi over SSH type

sudo nano /etc/xdg/lxsession/LXDE/autostart

Please note, some of my commenters have mentioned that if you’re using NOOBs you may need to use the LXDE-pi folder which would mean you need to use the following instead.

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

As you can probably guess this is a file that runs when your pi boots.
To disable the screensaver add a # to the beginning of the line, this comments the line out.

@xscreensaver -no-splash

Next add these lines underneath the screensaver line

@xset s off
@xset -dpms
@xset s noblank

This disables power management settings and stops the screen blanking after a period of inactivity.

Now that is done we should prevent any error messages displaying on the screen in the instance that someone accidentally power cycles the pi without going through the shutdown procedure. To do this we add the following line underneath the lines you just added.

@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences

Finally we need to tell chromium to start and which page to load once it boots without error dialogs and in Kiosk mode. To do this add the following line to the bottom of this autostart file.

@chromium --noerrdialogs --kiosk http://www.page-to.display

Thanks to a comment from Rikard Eriksson below it seems you may now need to add the incognito flag to ensure no warnings are displayed if you pull the power without first shutting down see below.


@chromium --noerrdialogs --kiosk http://www.page-to.display --incognito

Obviously replace page-to.display with whatever page you want to load. In my case I’m just connecting to the webserver I’ve setup on our network which has our database and my backup system.

Raspberry Pi Kisok - LXDE config

Hit ctrl-O and then ctrl-X again to write out and exit the file and now type

sudo reboot

Keep an eye on the display from your Pi now and once the unit boots again it should automatically load chromium in kiosk mode and display the page you’d chosen.

Raspberry PI Kiosk - Reception Screen

Sorry for the absolutely shocking picture quality there had to get a quick snap to get this tutorial out, I’ll hopefully replace it soon with a better photo but for now you get the idea and also maybe an idea about what you’d like to display on the screen.

Now it’s up to you to display what you’d like or to create a webpage to be displayed.




/etc/xdg/lxsession/LXDE-pi/autostart

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank
point-rpi
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences
@sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
@chromium-browser --noerrdialogs --restore-last-session --kiosk http://192.168.0.235/mm_website_advscreen/screen2 --incognito