adafruit_products_padd-ladyada-desk.png

We already have a guide on using Pi-Hole with the Raspberry Pi Zero W to send advertisements on your network into a black hole.

But, the PiOLED is small and we want to monitor more statistics at a glance. While we could open the web console to monitor Pi-hole, we can't show that to friends easily. Plus, who doesn't want more shiny, blinky, networking hardware?

We're going to install PADD (Pi-hole Ad Detection Display) and Pi-Hole on the Adafruit 2.8" or 3.5" PiTFT Plus to display useful and fun statistics such as Amount of Pi-holed Advertisements, and the top offending domain attempting to serve pesky advertisements to your network.

 

What's Pi-hole? 

Temporarily unable to load embedded content:
https://www.youtube.com/watch?v=vKWjx1AQYgs

Pi-hole is an open-source project which let's your Pi act as a DNS (Domain Name Server). While you may have an ad-blocker installed on your browser, do you have one on your phone? What about blocking in-application advertisements in your mobile games? On your Smart TV? On your smart fridge? 

Pi-hole lets you block ads from any device configured to use it as a Domain Name Server. When an advertisement (i.e: ads.adserver.com) tries to resolve it's IP address, Pi-hole will return nothing back. You'll never connect to the advertisement server and the ad won't even load. This makes it quicker, faster, and use less data than conventional ad blockers. 

 

Parts

You'll need the following parts to get up-and-running with Pi-hole and PADD

You need a Raspberry Pi with built in wireless. The Raspberry Pi 3 line (3, 3 B, 3 B+) devices are wireless-ready without external configuration:

1 x Raspberry Pi 3
Model B+ - 1.4GHz Cortex-A53 with 1GB RAM
 

You'll also need a power supply for your Pi and a MicroSD card for holding the Pi's OS and it's applications:

1 x 5V 2.4A Power Supply
5V 2.4A Switching Power Supply with 20AWG MicroUSB Cable
 
1 x 8GB MicroSD Card
8GB Class 10 SD/MicroSD Memory Card - SD Adapter Included
 
 

PiTFT Display

To use the full version of PADD, you'll need a PiTFT supporting a resolution of at least 480x320.

If you're using a display smaller than 480x320, PADD will boot into a mini mode which displays way less statistics about the network. To view PADD, we suggest using the PiTFT Plus 3.5":

PiTFT Plus 480x320 3.5" TFT+Touchscreen for Raspberry Pi

PiTFT Plus 480x320 3.5" TFT+Touchscreen for Raspberry Pi

PRODUCT ID: 2441
Is this not the cutest, little display for the Raspberry Pi? It features a 3.5" display with 480x320 16-bit color pixels and a resistive touch overlay
$44.95
IN STOCK
 

If you happen to have one of our 2.8" or 2.4" PiTFT's, those will work too

PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen

PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen

PRODUCT ID: 2298
Is this not the cutest little display for the Raspberry Pi? It features a 2.8" display with 320x240 16-bit color pixels and a resistive touch overlay. The plate uses the high...
$34.95
IN STOCK
 
Adafruit PiTFT Plus 320x240 2.8" TFT + Capacitive Touchscreen

Adafruit PiTFT Plus 320x240 2.8" TFT + Capacitive Touchscreen

PRODUCT ID: 2423
Is this not the cutest little display for the Raspberry Pi? It features a 2.8" display with 320x240 16-bit color pixels and a capacitive touch overlay. That's right,...
$44.95
IN STOCK
 
Adafruit PiTFT 2.4" HAT Mini Kit - 320x240 TFT Touchscreen

Adafruit PiTFT 2.4" HAT Mini Kit - 320x240 TFT Touchscreen

PRODUCT ID: 2455
Is this not the cutest little display for the Raspberry Pi? It features a 2.4" display with 320x240 16-bit color pixels and a resistive touch overlay. The HAT uses the high speed...
$34.95
IN STOCK
 
 

Other Parts

We used a Pi 3 case to protect our Pi from aesthetics and to protect our Pi against scratches, bumps, and falls. The case also makes the Pi-hole look like a networking appliance.

Adafruit Raspberry Pi B+ / Pi 2 / Pi 3 Case - Smoke Base

Adafruit Raspberry Pi B+ / Pi 2 / Pi 3 Case - Smoke Base

PRODUCT ID: 2258
It took awhile to perfect - but that's okay since we can now safely say that the Adafruit case for Raspberry Pi Model B+ / Pi 2 / Pi 3 is The...
$7.95
IN STOCK
 

If you don't have a way to burn the OS image onto a micro sd card from your computer, we suggest picking up a USB MicroSD reader/writer.

USB MicroSD Card Reader/Writer - microSD / microSDHC / microSDXC

USB MicroSD Card Reader/Writer - microSD / microSDHC / microSDXC

PRODUCT ID: 939
This is the cutest little microSD card reader/writer - but don't be fooled by its adorableness! It's wicked fast and supports up to 64 GB SDXC cards! Simply slide the card into...
 
OUT OF STOCK
 

Raspberry Pi Setup

adafruit_products_pi3b.jpg

We'll need to set up the Pi with an operating system (OS), WiFi, and secure login (SSH) support before we install Pi Hole.

We have a guide on how to set up your Pi Zero W 'headless' which is how we recommend you get started. The Pi 3 (and up) and the Pi Zero W both have built in WiFi, so our guide can be used for both platforms:

Make sure you are using Raspbian LITE and not stretch for the OS setup.

Here's the quick-start for people with some experience:

  1. Download the latest 'Lite' Raspbian to your computer
  2. Burn the Lite Raspbian to your MicroSD card using your computer
  3. Re-plug the SD card into your computer (don't use your Pi yet!) and set up your wifi connection by editing supplicant.conf
  4. Activate SSH support
  5. Plug the SD card into the Pi 3
  6. If you have an HDMI monitor we recommend connecting it so you can see that the Pi is booting OK
  7. Plug in power to the Pi 3 - you will see the green LED flicker a little. The Pi 3 will reboot while it sets up so wait a good 10 minutes
  8. If you are running Windows on your computer, install Bonjour support so you can use .local names, you'll need to reboot Windows after installation
  9. You can then ssh into raspberrypi.local

Install Pi Hole

Temporarily unable to load embedded content:
https://www.youtube.com/watch?v=vKWjx1AQYgs
 

Pre-Check

OK once you have set your Pi up and the WiFi is connecting to your home or office network, and your can ssh into it, continue with these easy steps! If you cannot connect via ssh yet, go back and read some of our guides until  you are able to log into your Pi.

raspberry_pi_ssh.png
 

Change Hostname

I like to do this first so I dont get confused between all the different Pi's in the house

Edit the hostname with sudo nano /etc/hostname and put something else on that first line, like pi-hole

raspberry_pi_hostname.png

Also change it in the hosts file with sudo nano /etc/hosts to match the same name. It's probably the last line:

adafruit_products_Screenshot_from_2019-03-27_16-09-58.png

Reboot and when you ssh in again, use pi-hole.local

Now's also a good time to change the Pi's password with passwd

 

Run Pi Hole Installer

There's more information on how installation at https://pi-hole.net/ - as of the writing of this guide, its easier to just run:

 Download: file
  1. curl -sSL https://install.pi-hole.net | bash

It will take quite a while to install, and may seem to 'hang' at points. Just let it do its thing for about 20 minutes!

raspberry_pi_root.png
raspberry_pi_pkgs.png
raspberry_pi_installer.png
 

Configuration

 
  • raspberry_pi_dnspick.png

Pick who will be the upstream DNS (for non-ad blocked sites) - Google is fine and will probably be up all the time

 
  • raspberry_pi_ipv4.png

99% of people will use IPv4 - if you need IPv6 you'd know!

 
  • raspberry_pi_ipaddr.png

The installer will automatically try to set the dynamic IP address it got from your router to be fixed. This works well enough, if you have an advanced network set up, you can configure a custom IP address

 
  • raspberry_pi_admin.png

The Web Interface is kinda cool, and is password protected. We'll be showing most of the stats on the little OLED but we still need the API to be running so keep this on

It will keep installing! Just hold tight...

raspberry_pi_moreinstall.png

When its done you'll get this final config screen! Copy & paste the password into another window for now

raspberry_pi_admin.png
 

Test Admin Page

On your desktop computer or tablet, visit http://pi-hole.local/admin/ And you should see an administration panel!

raspberry_pi_admin.png
 

Test Blocking

On your tablet, phone, computer, etc - Set up your DNS server in the network settings to be the IP address of the Pi

raspberry_pi_djs.png

You may need to restart your network or browser to have it kick in, also there may be some cached ads so don't worry if not everything is blocked. Visit your favorite site with ads (not adafruit.com cuz we don't have any! :) and see the difference!

Now that you've got that done, lets continue and install the display!

PiTFT Configuration

 

Assembly

If you are using a case like the Adafruit Raspberry Pi Case, snap-fit the Pi into the case:

Leave the clear top off, we'll need to access the GPIO header for the PiTFT. 

The PiTFT's four mounting ears can be used to attach the display to a bezel. But, we'll be snapping them off with pliers (they're perforated) for a flush-fit with the case/ 

adafruit_products_pitft-snap-headers.jpg

Position the PiTFT over the 2x20 GPIO connector and press downwards. Make sure the PiTFT's header is flush against the GPIO header.

adafruit_products_pressdown.png

Now that our PiTFT is assembled, let's configure the display to work with our Pi.

 

PiTFT Configuration

adafruit_products_2441-18.jpg

You'll need to perform some configuration to get the PiTFT up and running. We'll do this through the PiTFT installer script.

This script will do all the work for you, and install both device tree overlay support as well as configure rotation and any HDMI mirroring. PiTFT no longer needs any custom kernels or modules, so you can continue to update/upgrade your Pi and it will work with the most recent releases.

Here's the commands to run. Make sure your Pi has network access, it needs to download the software!

 Download: file
  1. cd ~
  2. wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
  3. chmod +x adafruit-pitft.sh
  4. sudo ./adafruit-pitft.sh
adafruit_products_downloadscript.png

Once ./adafruit-pitft.sh is run, we'll be presented with menus. Since we're using the 3.5" PiTFt, we'll select #4

adafruit_products_tftconfig1.png
If you're not using the 3.5" PiTFT, pick the number that corresponds to the display you are using. For example, for the 2.8" PiTFT with resistive touchscreen select #1

We'll also need to select a rotation of 270 degrees (#3) so the PiTFT + case can sit on your desk when the USB cable is plugged in.

adafruit_products_pitft2.png

We're going to want to use the PiTFT as a text console for PADD, type Yes to the question Would you like the console to appear on the PiTFT display

adafruit_products_2__pi_pi-hole_____ssh_2.png

Then, reboot the Pi. You'll see the console appear on the Pi. Don't worry if the Pi-hole doesn't display, we're going to configure that next.

Install PADD

adafruit_products_padd.png

Next we're going to install PADD, the Pi-hole Ad Detection Display. This application displays statistics about advertisements, your Pi's status, network configuration and system statistics on your PiTFT.

It is written and maintained by Jim McKenna who did an awesome job!

In the SSH session with your Pi, navigate to your home directory:

 Download: file
  1. cd ~

Grab a copy of PADD:

 Download: file
  1. wget -N https://raw.githubusercontent.com/jpmck/PADD/master/padd.sh

Make PADD executable by running:

 Download: file
  1. sudo chmod +x padd.sh
 

Open PADD at Pi Bootup

Next, we're going to set PADD to open automatically on your PiTFT when we start our Pi.

Open ~/.bashrc:

 Download: file
  1. nano ~/.bashrc

Navigate to the end of the file (by pressing the down arrow key) and add the following text:

 Download: file
  1. # Run PADD
  2. # If we're on the PiTFT screen (ssh is xterm)
  3. if [ "$TERM" == "linux" ] ; then
  4. while :
  5. do
  6. ./padd.sh
  7. sleep 1
  8. done
  9. fi

Save (control+O) the configuration and exit (control+X) nano to be brought back to the terminal.

 

Turn off the PiTFT at Night

The PiTFT is bright and doesn't need to be powered-on at night, so let's put it to sleep until we wake up.

Edit cron as root:

 Download: file
  1. sudo crontab -e

Select nano as an editor by pressing the key. 

adafruit_products_crontab.png

Scroll beneath the commented text (#) and enter the following:

 Download: file
  1. # PADD Sleep
  2. # Turn off the PiTFT+ at midnight
  3. 00 00 * * * sh -c 'echo "0" > /sys/class/backlight/soc\:backlight/brightness'
  4. # Turn on the PiTFT+ at 8:00 am
  5. 00 08 * * * sh -c 'echo "1" > /sys/class/backlight/soc\:backlight/brightness'
adafruit_products_crontab2.png

Save (control+O) the configuration and exit (control+X) nano to be brought back to the terminal.

Reboot the Pi to apply the new changes by running:

 Download: file
  1. sudo reboot

When your Pi reboots, the TFT should boot into PADD:

adafruit_products_padd-ladyada-desk.png

After PADD starts, it should go into display mode. If your PADD is displaying statistics about your network, congrats! We're all set up and ready to test our advertisement-blocking-pi.

adafruit_products_IMG_4263.jpg
 

Smaller Pi Displays

You can also use this guide with smaller displays, like the PiTFT 2.8". The full PADD display is unsupported by this screen - but don't worry - it'll automatically display a smaller, mini PADD interface. 

adafruit_products_paddmini.png

Using PADD and Pi Hole

 

Configure and Test Ad Blocking

PADD will display the Pi-hole's IP address underneath its Network tab:

adafruit_products_padd-highlight-ip.png

On your tablet, phone, computer, etc - Set up your DNS server in the network settings to be the IP address of the Pi:

You may need to restart your network or browser to have it kick in, also there may be some cached ads so don't worry if not everything is blocked. 

Not sure if your Pi-hole is configured properly? Visit blockads.fivefilters.org from the device you're configuring to test Pi-hole functionality. 

adafruit_products_Screenshot-2018-04-01-13.10.36.png

You can also visit some of your favorite sites or load a mobile application which would normally have in-application advertisements to test your Pi-hole.

 

Router Configuration for Pi-Hole

adafruit_products_Screenshot-2017-02-23-20.23.07.png
src: https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245

Don't want to configure each device on your network separately? Have a device that doesn't allow you to enter DNS settings? You can configure your router's DHCP options to force clients to use Pi-hole as their DNS server.

Want to switch back to a terminal? Hit CTRL+C

 

Updating PADD

If your PADD displays Update avail., you'll need to update it. PADD only uses stable builds of Pi-hole and FTLDNS, so you can rest assured that your internet won't break.

We can do this easily by SSH'ing into our Pi-Hole:

 Download: file
  1. ssh This email address is being protected from spambots. You need JavaScript enabled to view it.

Log in. Then, navigate to our home directory:

 Download: file
  1. cd ~

And update the version of PADD on your Pi by running:

 Download: file
  1. wget -N https://raw.githubusercontent.com/jpmck/PADD/master/padd.sh

After the update completes, restart your Pi by running:

 Download: file
  1. sudo reboot

Once restarted, PADD should display "Pi-hole is up-to-date".