DEV Community

Cover image for Installing Pi-hole with an LCD screen
Thomas Bnt
Thomas Bnt

Posted on • Updated on • Originally published at


Installing Pi-hole with an LCD screen

I had already made an article on Pi-hole a few years ago, this one adds the fact that there is an LCD screen.

In this article, we will discover how to install Pi-hole with an LCD screen.
The reference of the screen is XPT2046 Touch 3.5" RPI Display 480x320 16bit.


We will install Pi-hole on a Raspberry Pi 3B.

Pi-hole is used to block unwanted requests and URLs that you don't want to load on the network.
It protects you from trackers and optimizes your network traffic.


1. Prepare Raspbian

First, flash your SD drive from Etcher or another application.

Etcher, a software to flash your SD cards and USB sticks to make a bootable

Wait a few minutes until the disk is ready.

The end of the installation on the Etcher software

2. Update the dependencies

Connect to your Raspberry Pi and update the dependencies.

sudo apt-get update -y && sudo apt-get upgrade -y
Enter fullscreen mode Exit fullscreen mode

Wait a good few minutes... in the meantime, drink a good cappuccino. ☕

Install curl and git if this is not available on your small machine:

sudo apt-get install curl -y && sudo apt-get install git -y
Enter fullscreen mode Exit fullscreen mode

3. Install Pi-hole

Then, when everything is good, you can start installing Pi-hole.

You can clone from the Pi-hole repository or directly curl with this command:

curl -sSL | bash
Enter fullscreen mode Exit fullscreen mode

When asked if you want to install on your Raspberry and put in static IP, check yes, and remember the IP.

Installing Pi-hole

Then choose your preferred DNS. You can put more than one if you want. This is editable after installation.

Installing Pi-hole and its DNS

You can select block lists:

Installation of Pi-hole and its DNS part. 2

✨ I actually have a huge list with over 1,000,000 blocked domains/IPs. The repository of this list on GitHub. Feel free to add your own domains/IPs.

It will also ask you if you want a web panel.
I strongly recommend that you leave it enabled so that you can connect to the Raspberry Pi with a password and manage your DNS/blacklist and view your statistics.

4. Configuring the web panel

As soon as you have finished installing Pi-hole, it will give you the local host address and the generated password.

To change the password :

sudo pihole -a -p
Enter fullscreen mode Exit fullscreen mode

This is a preview of the panel when you are logged in 🎉

Web panel preview on Pi-hole

Setting up the LCD screen

The most complicated part is here!
There may be some things I've written that don't work for you, or that aren't essential to do.

1. Install the LCD screen on the Raspberry Pi

Simple part to do, just put the Display on the branches of the RPI.
I found a YouTube video that shows you how to position it.

2. Install PADD

PADD is a software that allows you to see the data transmitted by Pi-hole on your screen.

The project has been taken over by Pi-hole, and even if there are some errors, it is still usable.

To install it and make it executable :

cd ~
wget -N
sudo chmod +x
Enter fullscreen mode Exit fullscreen mode

Make PADD run when the RPI is launched:

# Run PADD
# If we're on the PiTFT screen (ssh is xterm)
if [ "$TERM" == "linux" ] ; then
  while :
    sleep 1
Enter fullscreen mode Exit fullscreen mode

If you wish, you can test the script and view it from your terminal:

Enter fullscreen mode Exit fullscreen mode

This gives:

PADD preview on a terminal

After you have done everything, you need to reboot your machine.

3. Make the screen turn off at night.

On the PADD wiki, they show you how to make the screen turn off at night. The script works with cron, to modify it, do sudo crontab -e :

# Turn off the PiTFT+ at midnight
00 00 * * * sh -c 'echo "0" > /sys/class/backlight/soc\:backlight/brightness'
# Turn on the PiTFT+ at 8:00 am
00 08 * * * sh -c 'echo "1" > /sys/class/backlight/soc\:backlight/brightness'
Enter fullscreen mode Exit fullscreen mode

Possible mistakes

During my installation, I had a few errors, including one where the screen would not turn on.
So I forced him to do it with Adafruit.

A. Installation of Adafruit

Let's already install the prerequisites:

sudo apt-get install python3-pip -y
Enter fullscreen mode Exit fullscreen mode

Then Adafruit from the GitHub repository :

cd ~
git clone
Enter fullscreen mode Exit fullscreen mode

And finally, we will install Adafruit :

cd Raspberry-Pi-Installer-Scripts
sudo python3 --display=35r --rotation=90 --install-type=console
Enter fullscreen mode Exit fullscreen mode

This script will modify /boot/config.txt to make adafruit-pitft run when the RPI is launched.

See how to do it manually
sudo nano /boot/config.txt

Insert at the end:


B. Invalid number" errors

If you get this kind of error on your screen:

/home/pi/ line 900: printf: 0,3: invalid number
/home/pi/ line 244: printf: 42,236: invalid number
/home/pi/ line 873: printf: 9,1: invalid number
/home/pi/ line 900: printf: 0,91: invalid number
Enter fullscreen mode Exit fullscreen mode

Leave the local of the Raspberry Pi on en_GB.UTF-8,
an issue is in progress and therefore displays errors on the Display. (View issue on GitHub)


Check my Twitter account. You can see many projects and updates. You can also support me on Buy Me a Coffee, Stripe or GitHub Sponsors. Thanks for read my post ! 🤩

Top comments (0)