In my opinion Pi-hole is one of the best things you can do with a Raspberry Pi, all you have to do is set it up once and sit back and enjoy ad-free web browsing. One thing I really like about Pi-hole is the Admin pager which is filled with all kinds of graphs, charts and stats for me to sit and geek out over for hours. I have wanted to somehow integrate some quick stats into my Raspberry Pi system without the need to remote in to it and go to the Pi-hole Admin Page. I have thought about adding Raspberry Pi Touchscreen Monitor to it but my Raspberry Pi running Pi-hole it’s in my mechanical room with the rest of my networking and automation gear, so the touchscreen really would have been a bit much. Well last week while scrolling through HACKADAY I came across an interesting article titled Visualizing Blocked Ads With the Pi Sense Hat. I just happened to have a Raspberry Pi Sense Hat kicking around doing nothing, so I figured that would be a good project.
Assuming you already have Pi-hole up and running on your Raspberry Pi setup of the Visualizer is pretty simple and you can reference the GitHub Repository for the project by simianAstronaut. Below I will take you through the setup of the visualizer starting with a Raspberry Pi that is already running Pi-hole.
- Connect Sense Hat to Raspberry PI GPIO
- From the Raspbian Desktop launch Terminal
- From Terminal you need to install the Raspberry Pi Sense Hat using the follow command,
- sudo apt-get install sense-hat
Downloading the Visualizer Code
- From Terminal you can download the Visualizer Code by running the following command,
- sudo git clone https://github.com/simianAstronaut/pi-hole-visualizer.git /home/pi/pi-hole-visualizer
Setting Up the Visualizer
- We need to check the dns_stats.service Unit File to ensure the path to our dns_stats.py file is correct. From Terminal run the following command
- sudo nano /home/pi/pi-hole-visualizer/dns_stats.service
- In this file check that the path in line 7 (starts with ExecStart) matches where you saved the files (if you used the exact command listed above this path will be correct.
- Type CTRL X
- Save the file
Convert the Script to a System Service
- Navigate to the folder where the script is saved:
- cd /home/pi/pi-hole-visualizer
- Make the script and unit file executable.
- sudo chmod +x dns_stats.py
- sudo chmod +x dns_stats.service
- Copy the unit file to the system directory
- sudo cp dns_stats.service /lib/systemd/system
- Enable the service to run at startup
- sudo systemctl enable dns_stats
- Reboot using sudo reboot
- Check that the service is running with sudo systemctl status dns_stats
That is it you should be up and running. The Pi-hole Visualizer using the Raspberry Pi Sense Hat is pretty simple to set up but it should be noted that is you are on a development branch of Pi-hole it will not work so if you read my blog post about the Pi-hole Beta and decided to join you will have to revert to the master branch if you want to use the Visualizer.
What are your thoughts on this project? Let me know in the comments below.
I am passionate about the IoT and connected devices. Using connectivity to automate our lives will empower civilization to achieve greatness.