Hi, this is a little how-to guide for the Pi-hole e-inkt stats screen. I tried to describe everything with a lot of details, so even beginners will be able to reproduce what I made! Anyways, please let me know what you think, feedback is always welcome!
I found an interesting Github page repository from BillyBunn, it is called pi-hole. (Don't confuse it with the original Pi-hole repository)
Because the project of BillyBunn had some bugs that wasn't fixed. I decided to fork the repo and focussed on fixing the few bugs. Make the graph working and add some more configuration options are on the todo-list.
Maybe in the future I can make it compatible with e-inkt screens from different vendors. But that is for later, let's get this one working first!
- Bram
1: Choose the operating systemThere are many diffrent types of OS (Operating System) that you can install for your Raspberry Pi. But because I want to run pihole and my display as a lowpower server, I searched for an OS that is lightweight as possible.
Upon the search to a OS that would fit my needs, I stumbled across DietPi.
DietPi is a lightweight OS for you SBC.
Highly optimised minimal Debian OS - DietPi is extremely lightweight at its core, our images start at 400MB in size (3x lighter than 'Raspbian Lite'). With features of low process/memory footprint and DietPi-RAMlog installed by default, DietPi allows you to get the maximum performance from your device. Quickly and easily install popular software thats "Ready to run" and optimised for your system. Gone are the days of reading 5+ page guides, DietPi does everything for you, giving you more time to enjoy the software you require.
Feel free to use choose another type of OS, but I love the simplicity about it.
2: Prepare the operating system for bootI downloaded DietPi OS from their website, and extracted the.ZIP file.
Launched Etcher, and burned the downloaded OS to a micro SD card.
After burning the OS, I wanted to acces the Raspberry Pi using WiFi. I opened the boot driver and changed in 2 files the following lines:
dietpi.txt
AUTO_SETUP_TIMEZONE=Europe/Amsterdam
AUTO_SETUP_NET_WIFI_ENABLED=1
AUTO_SETUP_NET_WIFI_COUNTRY_CODE=NL
dietpi-wifi.txt
# Entry 0
# - WiFi SSID: required, case sensitive
aWIFI_SSID[0]='RouterName'
# - WiFi key: If no key/open, leave this blank
aWIFI_KEY[0]='RouterPassword'
I ejected the SD card and put it in my Raspberry Pi, time for boot up! If you have a microUSB to Ethernet adapter, you don't have to perform these steps.
3: Setup DietPiBefore we can connect to the Raspberry Pi, you need to find out the IP adress that it has been assigned. You need to login to your ISP provided router, or use a third party tool to scan for ipadresses in your network. The tool I used was LanScan.
After finding out the assigned IP-adress for your Raspberry Pi, remember it and open the terminal: DietPi comes with the default username root and password dietpi. Use the following command to connect to your Raspberry Pi:
ssh root@<ip-adress>
>Note: If the terminal shows the message: "Are you sure you want to continue connection (yes/no/[fingerprint])?)" just type 'yes'
Enter now the default password: dietpi and press enter
After login Dietpi will show a few dialogs, here you can change the default password and hostname. I just leave them default for now and press enter. Eventually this menu will show up:
Using this menu we can easily install common tools and software. But let's keep it simple and start with a minimal Dietpi image. Use the arrow keys on your keyboard to navigate down to "Install" and press enter. A dialog will appear where about installing DietPi as a minimal image, select <Ok> and press enter.
DietPi will update to the latest version now, it took approx 5 min. This all depends on the type of SD card and you internet connection.
This project has a few dependencies, in order to save some issues I did install some manual beforehand:
- Git (id 17)
- Python Pip (id 130)
dietpi-software install 17
dietpi-software install 130
>Note:If you prefer to install the software using a GUI, run dietpi-software, navigate to Software Additional and select Git and Python Pip from the list (using spacebar). Confirm the selection press tab, and go to <Ok>. Press now enter, navigate to install, press enter and the installation will start.
We need to enable I2C, do this by navigating to advanced options in the dietpi-config menu
dietpi-config
When in the advanced options menu, navigate down to I2C state and turn it on by pressing enter. After this is enabled leave the menu. The system will reboot.
4: Setup Pi-hole (server)>Note:If you don't want to use the same Raspberry Pi as pi-hole server, skip this chapter.
Normally to install software, we can use the dietpi-software command, navigate to 'Software Optimized' and select it from the list.
In order to quickly install Pi-hole we can use the following command:
dietpi-software install 93
A few dependincies will be installed too: Lighttpd, PHP, SQLite and the Git Client. Depending on what is already installed and how fast your SD card is, the installation will take between 5 and 15 minutes.
As seen in the images above, a few dialogues will appear. Go trough them to finalize the installation of Pi-hole. Using the arrow keys you can navigate. Use the TAB key to switch to <Ok> and press the enter key.
- DNS provider: Cloudflare is my preference because of privacy related matters. But feel free to select another one or insert your own!
- Lists: Pi-hole blocks ads based on certain lists. If you don't wanna use one of the default ones you can deselect it right here.
- Protocols: I use only IPv4 adresses in my network. If you rely on IPv6 you should select it right here.
- StaticIP: make sure your Pi-hole server is always accessible using this standard IP adress. Make sure it is unique within your home network.
<TODO - write this part further down in configuring Pi-hole itself!>
5: Setup InkyPhatTo install Pimorini Inky, we need to issue the following command:
curl https://get.pimoroni.com/inky | bash
>Note: if you receive the error message that you need to login as a regular user with sudo rights, check out the errors and solutions section for a workaround.
The installation of the packages can take a while. You will get a few prompts, answer these by typing 'Y' and pressing the enter key.
This took around 45 minutes! To check if everything is installed navigate to the demo folder and run an example
cd /home/pi/Pimoroni/inky/examples
sudo python name-badge.py --type "phat" --colour "black" --name "Hi!"
If the folder doen't exists, something went wrong. Run the installation command again and make sure to answer everything with a 'Y'.
> I think the reason that this happens is because some package requires a reboot, so the script can't get fully executed the first time you run it.
6: Setup Pi-hole displayMake to be in the home folder again:
cd
Like I said earlier, I found a github repository from BillyBunn, unforenatly it had some bugs. I forked his project. made some bug fixes and made a pull request. Untill BillyBunn accepts the pullrequest, you can clone my github repository using the following command:
sudo git clone https://github.com/BramvdHoek/pi-hole_einkt.git
Go to the folder and list the files:
cd pi-hole_einkt
ls
Edit the display.py file
sudo nano display.py
Fill in the pihole_ip variable the ipadress of the pihole server.
#----------------------- Settings change me -------------------#
#ipadress of the pihole server
pihole_ip = "192.168.1.4"
#------------------------ Start Main Code ---------------------#
Press control + X, type 'Y', and press the enter key to save the changes.
To execute the script:
sudo python display.py
Now you can add the display.py to a cron job, so the script will run periodically.
I still work on the repo to change some settings, in the near feature I want to add the possibility to reorder/hide certain stats. And make the graph working on the e-inkt.
Errors and solutionsFingerprinterrorduring login
Use the following command if you can't connect to your Raspberry Pi because of Key Issues. Replacing <ip-adress> accordingly
ssh-keygen -R <ip-adress>
Running as root, please login as a regular user with sudo rights!
In order to work around this problem, we gonna make a new user (w/ sudo rights). First we create a new user.
sudo adduser <name>
Now we need to enter a password for the user. After approval DietPi will ask to enter some user information like Full Name, Room Number, Work Phone, Home Phone, and an Other field. I leave this fields default by pressing the enter key, and confirm this by typing 'y'.
We have created the new user now! But we need to give him sudo permissions, open the visudo config file:
sudo visudo
In this config file, find the # User privilege specification section. Add your newly created account.
Press control + X, type 'Y', and press the enter key to save the changes. Switch now to the newly created user using the following command:
su - <name>
From this point on, you can run the pimorini Inky bash script, continue at section 4. After the installment of these packages, switch back to the DietPi user:
su -
Comments