Did you ever wanted to know what the current usage of your internet connection is?
I was interested in checking whether the internet service or my internet connection was the bottleneck. After a couple of days, I now know that some services I use like the PlayStation network or the Nintendo Network are not always using the full bandwidth.
Now I am always satisfied seeing the usage off my network connection fully used when I am downloading some apps or files 🙂
Hopefully this will satisfy you the same.
This application only works with routers using the TR064 protocol. Most of the AVM Fr!tzBoxes do. Other routers may not provide this service. They may only support the SNMP protocol.
Keep track of the changes on the GitHub repo. Maybe this will be added in the future.
Inspired through this project: https://github.com/reischle/fritzmeter
Get the Python application from GitHub: https://github.com/iEduard/FritzMeter_RaspberryPi
Here is my list of the Hardware
- Raspberry Pi (Zero with header)
- Some jumper wires
- An old IKEA wooden flowerpot
- Two analog gauges 0-5V (https://www.pollin.de/messtechnik/einbauinstrumente-zaehler/analoge-einbauinstrumente/)
- Two digital analog converters: https://learn.adafruit.com/mcp4725-12-bit-dac-tutorial
- Micro USB power supply (From an old phone. Enough energy for the Raspberry Pi Zero)
But you can use any Raspberry Pi you like. There is not much to do, so u can also use an old Raspberry Pi 1. If you are ordering new analog gauges, you can also consider buying 3.3V DC gauges. In This case, just set the Voltage of the Digital to analog converters to the 3.3V of the Raspberry Pi.
Step 1: Set Up the FritzBox
By default, the TR064 Protocol is active. But check the settings will do no harm. So log in to your Fritzbox and Enable the Advanced view.
After that, go to: “Home Network / Network / Network Settings” and check the option “Allow access for applications”
Step 2: Put the Electric Together
Wire up the Raspberry Pi with the digital analog converters and the gauges. You can use a breadboard with some breadboard jumper wires.
Step 3: Create the Gauge Background
In order to not constantly converting the gauges labels from volt to Mpbs we will create a background with the right labels.
In the GitHub Repository, you will find the CreateGaugesBackground.py file. (GitHub Link) Here you can set the Max Values of your Network connection for the up and download. After running the python script, you will get two .svg files.
In order to use the python code, you need to install some dependencies. The code is using cairo in order to draw the svg files.
To install pycairo we also need the dependencies of the C Headers. Here is the explanation, depending on which OS the script should run. Link
Add the Python library with
$ pip install pycairo
Set up the gauge parameters
On top of the Python file, you can adjust the background to fit your requests
MAX_DOWNLOAD_SPEED = 200 #Set the max download speed here MAX_UPLOAD_SPEED = 30 #Set the max upload speed here BACKGROUND_SIZE_X = 650 #Fixed background settings. Do not change these. BACKGROUND_SIZE_Y = 400 #Fixed background settings. Do not change these. #Define the style of the gauges FONT_LABEL = "Helvetica" #Font of the labels FONT_LABEL_SIZE = 40 #Font size of the labels FONT_DESCRIPTION = "Helvetica" #Font of the description FONT_DESCRIPTION_SIZE = 48 #Font size of the description UPLOAD_AXIS_DEVISION = 6 #Divisions of the upload gauges labels DOWNLOAD_AXIS_DEVISION = 4 #Divisions of the upload gauges labels
Run the script with
The output will show the file path of the two generated .svg files.
Upload File saved here:/Users/esc/Git/FritzMeter_RaspberryPi/Hardware/upload.svg Download File saved here:/Users/esc/Git/FritzMeter_RaspberryPi/Hardware/download.svg Done
Import those two files to your preferred text editor (Word, Pages, OpenOffice Writer) and set the width of the two backgrounds matching to your gauges.
Print them and put them on your gauges.
Most of the gauges can be opened by two screws. Afterwords, there are another two screws holding the measurement equipment and the background. Open these two as well and glue the cut-outs on the metal plates.
Step 4: Set Up the Raspberry Pi
Get the current Raspberry Pi image
Download from https:\\raspberrypi.org
Create the image with the Raspberry Pi imager
Press the shortcut SHIFT + CTRL + X to get the option’s menu of the application.
- Set up your Wi-Fi
- Turn on ssh and SPI
Update the Raspberry Pi
$ sudo apt-get update
$ sudo apt-get upgrade
Install the requested dependencies
$ pip install fritzconnection adafruit-circuitpython-mcp4725 netifaces
Get the repository
Clone the repository in the home directory.
$ cd $ git clone https://github.com/iEduard/FritzMeter_RaspberryPi.git
In order to start the python application with every start of the Raspberry Pi we will create a service and start it.
Copy the service from the Repository to the system path
$ cd FritzMeter_RaspberryPi/Software $ sudo cp Fritzmeter.service /lib/systemd/system/fritzmeter.service
Change the service rights
$ sudo chmod 644 /lib/systemd/system/fritzmeter.service
Restart the service daemon and start the created service.
$ sudo systemctl daemon-reload $ sudo systemctl start fritzmeter.service
Set the service to start with the boot of the Raspberry Pi
$ sudo systemctl enable fritzmeter.service