Raspberry Pi as a DNS ad blocker with pi-hole and LCD screen for stats

What is it? questionmark

For almost a year now, I’m running Pi-hole on a Raspberry Pi 1 (yup, the first version) to block all ads and malicious domains completely.
Installing and running Pi-hole doesn’t need any explanation, setup a Raspberry Pi and run the command as mentioned on https://pi-hole.net

Setting up the Raspberry Pi and enabling SPI
My Pi-hole has static ip 10.0.0.8, so I configured my router’s DHCP settings accordingly

With the SPI enabled, I was able to get the 4×20 character LCD working (documentation).
The LCD can be controlled via the bw_tool (git).

Next I configured udev to change permissions on startup
End result of the information on the LCD

Python code questionmark

A simple python script handles the http request and writes text to the LCD display.
It can be found on my github: https://github.com/timdows/PiHoleLCDStats/blob/master/statsScreen.py

Debug output of the python script
Making sure it runs upon a reboot of the Pi

[code lang=”bash”]@reboot /usr/bin/python /home/pi/statsScreen.py &[/code]

End result questionmark

The admin page shows some statistics
The same statistics are shown on the LCD while devving

TODO questionmark

  1. Connect the 5V and GND from the LCD directly to the powersupply;
  2. Make a case around this and combine the case with my openvpn Raspberry Pi server

Project costs in € or $ questionmark

Object Price
Raspberry Pi model B (512MB) € 21
4 x 20 lines SPI display € 23.95
Other materials € 2.50
Total $ 47.45

What could be better questionmark

  1. Note to self: learn python or just keep hating it forever (read: having to google every command)

Comments are closed.