Test Your Internet Speed Using a Raspberry Pi

Use your Raspberry Pi to measure any Internet connection speed with Ubidots

Similar projects worth following
Use your Raspberry Pi to measure any internet connection speed with Ubidots.

Raspberry Pi has become a widely used device not only for prototyping and educational purposes, but also for industrial production projects within businesses.

Besides the Pi's size, low cost, and fully operational Linux OS, it can also interact with other peripherals through GPIO pins (General Purpose Input/Ourput Pins) allowing you to code pretty robust hardware applications without having to be an expert in embedded electronics.

Following this article you'll learn how to measure your internet speed using a Raspberry Pi and send the parameters to the Ubidots cloud to create the alerts for monitoring your internet's connection throughout the day!

  • 1

    This guide assumes your Raspberry Pi has been configured and is already connected to the Internet. If not configured you can quickly do so using this quick start guide from the Raspberry Pi Foundation.

    NOTE: If you’re using a WiFi dongle, we suggest using Wicd to manage your WiFi connection.

  • 2
    Connecting the NanoPi to Ubidots using Python

    With your Raspberry Pi connected to the Internet, verify the IP address assigned to the board access using ssh in your computers terminal:

    ssh pi@{IP_Address_assigned}
    • User Name: pi
    • Password: raspberry

    As you can see the image below, your access was successful, and the user now is pi@raspberrypi:

    Now let's upgrade some packages and install pip, Python's packet manager:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install python-pip python-dev build-essential 

    Install the below libraries:

    • requests: to make HTTP requests from Python to Ubidots
    pip install requests pyspeedtest

    Pro Tip: FAQs and Troubleshooting - If you get a permission issue when installing the packages required, change the user mode to root using the following command: 

    sudo su

  • 3
    Now it is time to code!

    Create a Python script in your computer's terminal:


    And copy this code into it:

    import pyspeedtest
    import requests
    st = pyspeedtest.SpeedTest()
    payload = {'Download': round(,2) , 'Upload': round(st.upload()/1000000, 2), 'Ping': round(,2)}
    r ='', data=payload)

    Make sure to replace your Ubidots account token in the request URL. If you don't know how to get your Ubidots Token, please see the article below:

    Now let's test the script:


    If working properly you will see a new device in your Ubidots account with three variables: Download, Upload, and Ping:

View all 7 instructions

Enjoy this project?



faizytmst wrote 05/01/2023 at 18:03 point

Amazing!! This is really awesome. Can I use it for my webpage ? If yes, then please guide me from scratch.

Any help will be appreciated!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates