Nerdy things made nicer: Raspberry PI 4B with Pi-Hole + Unbound and Pimoroni HyperPixel 4" display
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.
The Router is a Netgear R7800 with DD-WRT firmware, the list of items about the Raspberry PI is:
Pimoroni HyperPixel 4" display
First I assembled the heatsink/case with some Artic Silver 4 thermal paste, because 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°)
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
CHARMAP=”UTF-8"CODESET=”guess”FONTFACE=”guess”FONTSIZE=”8x18"
Cosider 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 becase 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/usefuel 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 am00 01 * * * sudo bash -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power"# Turn on the HyperPixel 4 at 7:30 am30 07 * * * sudo bash -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power"# Turn off the HyperPixel 4 at 9:30 am30 09 * * * sudo bash -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power"# Turn on the HyperPixel 4 at 12:30 am30 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 cutted toothpick between the heatsink 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.
I thinks is all at the moment, if you need more info or I wrote some absurdity, just tell me in a comment =)
UPDATE: I added some info about Unboun in my PADD script, you can find the detail here: Add Unbound stats to PADD for Pi-Hole.