Install a fresh copy of Raspbian lite.

I like to use Raspberry Pi Imager

SSH is disabled by default so you need to enable it by adding a file called «ssh» in /boot.

Once the Pi is up you can SSH into it and continue with the next steps.

Enable the SPI interface

sudo raspi-config

Choose Interfacing Options -> SPI -> Yes

sudo reboot

Install BCM2835 libraries

tar zxvf bcm2835-1.60.tar.gz 
cd bcm2835-1.60/
sudo ./configure
sudo make
sudo make check
sudo make install

Install WiringPi libraries

sudo apt-get install wiringpi
sudo dpkg -i wiringpi-latest.deb
gpio -v

Install Python2 libraries

sudo apt-get update
sudo apt-get install python-pip python-pil python-numpy
sudo pip install RPi.GPIO
sudo pip install spidev

Install Python3 libraries

sudo apt-get update
sudo apt-get install python3-pip python3-pil python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install spidev

Install the speedtest-cli module

pip install speedtest-cli

Clone the project files:

sudo git clone

Test the python script:

sudo python


sudo python3

Add a cronjob to perform the test every 1 hour.

sudo crontab -e 

add the following line

0 * * * * /usr/bin/python /home/pi/

Leave a Reply