This post is about my Adblock setup with an (overkill) RaspberryPI 4 and Pi-Hole, and since the pics tell the story more than words, so first pics, then words/specs/code.

Nothing special, but since I like the tech things that looking nice I tried to make the setup a bit nicer but it works also without the stand/display/etc… The Raspberry PI is a 4B 1.2 with 4Gb RAM, absolutely not needed for run Pi-Hole but I prefer to have it for other things and Gigabit ethernet, I think a FriendlyARM ZeroPI is perfect for run Pi-Hole only.

Building the Raspberry PI

The Router is a Netgear R7800 with DD-WRT firmware, the list of items about the Raspberry PI is:

First I assembled the heat sink/case with some Artic Silver 4 thermal paste, because it is better than the stock thermal pads, but the temps are not very different, the difference is when the CPU runs very hot, then the thermal paste will make the difference compared to the pads, but above 60C° (and in my setup I’ve never seen the CPU above 50/52C°)

Display and customizations

Then we need to install an OS on the Raspberry PI + Pi-Hole + Pimoroni drivers and I will not explain this steps because is full of tutorials on the web, in order to display the nice stats on the display we need PADD but it support only 480x320px displays, so at the first start the Pimoroni will look a waste of space because is 800x480px:

PS: this is the non touch HyperPixel 4”, after I switched to the touch version, not because I needed the touch but because the non touch hasn’t the bezels and there’s a lot of backlight leak that is terrible at night (pic). I left the non-touch drivers, it doesn’t make any differences if you don’t use the touch layer.

So I modified the PADD.sh bash script in order to fill the 800x480px, and you can find the code on my Gist here (updated to padd 3.5.1). Please consider I’m not a coder and the code is in alpha stage full of comments and refuses, but it works. If you want to improve it, is awaiting the pull on the official PADD repository.

In order to correctly display the font size you need to use these fonts and size in /etc/default/console-setup

  CODESET=”guess”
  FONTFACE=”guess”
  FONTSIZE=”8x18"

Consider that there’s a bug when it gets the router IP, sometimes it display an “ex” after the router IP in the DHCP section (I’m unable to understand why, looks like something related to display wrapping, I have no idea), so I manually entered my router IP address, you can change it or uncomment the line #370

dhcp_info=” Router: 192.168.1.2" #${DHCP_ROUTER}”

Replace the padd.sh file in your /home/pi or /home/whatever directory and it will start to display a bit nicer and useful.

If you want you can enable Unbound as your recursive DNS, in this way you have more privacy on your domains requests (because they’re resolved on your Pi-Hole and not from a third part service). Use this official guide if you want to enable it. I left almost untouched all the options, I only changed the num-threads: 4 but I don’t think it makes any differences in a small home network.

And your Pi-Hole setups is complete! Well, not complete because you need to choose a lot of things but this is not a tutorial on how to setup Pi-Hole, rather is how I configured my Raspberry PI if you want to take some inspirations/useful tips. A usefuel link is this for block ads via regex.

Another thing I’ve done is turn off the bright red LED of Raspberry PI with this command in crontab (sudo crontab -e)

@reboot echo none > /sys/class/leds/led1/trigger

After this you may want to turn on and off the Pimoroni display at some time or during the night, so in the same file add these lines, obviously you need to enter the hours you want (mine is off from 01AM to 7:30AM, and from 9:30AM to 12:30AM).

```# Turn off the HyperPixel 4 at 1:00 am 00 01 * * * sudo bash -c “echo 1 > /sys/class/backlight/rpi_backlight/bl_power”

# Turn on the HyperPixel 4 at 7:30 am
30 07 * * * sudo bash -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power"

# Turn off the HyperPixel 4 at 9:30 am
30 09 * * * sudo bash -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power"

# Turn on the HyperPixel 4 at 12:30 am
30 12 * * * sudo bash -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power"

And if you want to turn on/off your display whenever you want via ssh, these are the commands

#turn on
sudo bash -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power"

#turn off
sudo bash -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power"

A stupid tip in order to hold my display is to put a piece of toothpick between the heat sink and display, it’s invisible but makes your display firm and prevent you broke the pins of the connector in case you touch it or when you clean it with a cloth.