If there’s one thing that’s the same about everyone’s broadband connection, it’s that it’s slow. Usually slower than it was advertised to be when you got it. But slow isn’t as irritating as sporadic, when you get constant drops and outages in your internet connection, it can drive you to frustration.

It drove one man in Washington D.C. to monitor his broadband connection with a Raspberry Pi, and automatically tweet Comcast when his connection drops to a fraction of advertised speed.

This is actually something I’ve been doing myself for a couple of years, also using a Raspberry Pi stuffed in a corner of my network closet. Well, not the bit where I tweet my broadband provider. Instead my script is a bit more direct: It automatically submits a trouble ticket into their support queue.

Over the time I’ve been doing this I’ve used various methods to measure the latency and speed of my broadband connection. Most recently I’ve switched to using speedtest-cli, a command line interface to the servers written in Python.

Not sure if Raspberry Pi is right for you? Make:’s interactive Board Guide lets you dial into the field to find the best board for your needs.

It’s really easy to install. Just open up a terminal window on your Raspberry Pi and type the following at the command line,

$ sudo apt-get install python-pip
$ sudo pip install speedtest-cli

this will install pip — a package management system for Python — if you don’t already have it installed, and then the speedtest-cli package from the pip repositories.

Once installed it’s rather easy to grab and measure your broadband speed.

$ speedtest-cli
Retrieving configuration...
Retrieving server list...
Testing from Acme Broadband Provider. (XXX.XXX.XXX.XXX)...
Selecting best server based on latency...
Hosted by Foo Limited (Metropolis) [2.52 km]: 35.27 ms
Testing download speed........................................
Download: 14.47 Mbit/s
Testing upload speed..................................................
Upload: 1.46 Mbit/s

Although I’ve disguised other details, that really is my average reported broadband speed. I have an ADSL2+ Annex M connection, unfortunately FTTC hasn’t quite made it to my parts of the world.

While this is my average speed, it’s well below what I’m paying for, which is 25 Mbit/s down and 2.5 Mbit/s up. However I’ve more or less given up on obtaining that… these days I’m just happy if it’s stable. Because, every so often, I go through patches where my latency rises to several hundred milliseconds, and my bandwidth drops to 1 or 2 Mbit/s. These periods can go on for days.

Which makes me rather jealous of our friend in Washington, who is complaining to Comcast when his 150Mbit/s connection drops to a low of 50Mbit/s.

In any case, now that we have our command line tool installed, we can run it automatically using cron, which allows you to schedule commands to run at specified times (every hour), and log the output to a file.

The easiest way to do this is to create a quick script, let’s call it, which will log the date and the output of the test to a file,

date >> /home/pi/speedtest.log
/usr/local/bin/speedtest --simple >> /home/pi/speedtest.log

Then go ahead and edit your crontab file, adding an entry to run the script test once an hour. You can do that by typing,

$ crontab -e

at the command line, and then adding the line,

0 * * * * /home/pi/

to the crontab file before saving it. This will run the test once an hour, at the top of the hour, appending the date-stamped output of the speedtest command to a log file.

$ cat speedtest.log 
Sun Jan 31 19:49:01 GMT 2016
Ping: 34.961 ms
Download: 14.44 Mbit/s
Upload: 1.41 Mbit/s

However the output of the speedtest-cli package, even in its “simple” mode, is pretty messy. We could go into the package and fix things so that the output is somewhat more useful, CSV format perhaps, or we could rewrite the whole thing in Perl. But since this is a quick hack, it’s probably easiest just to fix things with a bash script.

Which is exactly what the speedtest-cli-extras script does. It captures the output of the script, reformats it, and outputs it on a single line with time stamps and values separated by semicolons,

$ git clone
$ cd speedtest-cli-extras/bin
$ ./speedtest-csv 
2016-01-31 17:00:33;2016-01-31 17:01:27;Acme Broadband Provider;XXX.XXX.XXX.XXX;Foo Limited (Metropolis);2.52 km;34.768 ms;14.43 Mbit/s;1.31 Mbit/s;

again with names changed to protect the guilty. As you can see the output is much more useful, especially if we want to create graphs, than we had previously. Running this every hour from cron is going to start to pile up evidence in a nicely formatted data file, hopefully allowing us to have a satisfying argument with our broadband provider inside a few days.

Except that, while I’m on the road, I don’t want to have to SSH into the Raspberry Pi connected to my ADSL modem, grab the CSV file, and manually post the trouble ticket I’ve filed with my broadband provider.

This is where IFTTT‘s Maker Channel, introduced towards the middle of last year, comes in handy. I went ahead and created a recipe on IFTTT to take the data passed to a Maker Channel event called “speedtest” and automatically fill a Google Sheet with the output of speedtest-cli script.

Screenshot 2016-01-31 16.33.31

The easiest way to get the data from our Raspberry Pi to IFTTT at this point is to modify the speedtest-cli-extras script. Instead of printing out the output to a log file, we’ll make a POST web request with the event name and our secret key — the key is assigned when you connect the channel — of the form,{secret_key}

with a JSON body consisting of  three values — the latency, download, and upload speeds — to be passed on to the action in the recipe.

After you download it you should go ahead and substitute your own SECRET_KEY before testing it out by running the modified script manually at the command line. If all goes well you should see something like this,

$ ./ 
Congratulations! You've fired the speedtest event

Go ahead and check your Google Drive, there should be a new Sheet called “Speedtest.”

Screenshot 2016-01-31 22.39.14

This Sheet should have a single row with four columns populated. The first is the date stamp on the IFTTT Maker Channel event, the second is the ping time in ms (latency of the connection), the third the download speed in Mbit/s, with the final column being the upload speed in Mbit/s.

January 26, 2016 at 02:49AM 34.039 12.56 1.32

If that’s worked, all we have to do is modify our script to run our new script when it’s called at the top of the hour by cron,

date >> /home/pi/speedtest.log
/home/pi/ >> /home/pi/speedtest.log
echo "" >> /home/pi/speedtest.log

and each hour we’ll now add another row to the Google Sheet.

Screenshot 2016-01-31 22.02.04

At this point you now have a Raspberry Pi-based monitoring system in place to measure your broadband speed once an hour, and automatically log it to the cloud. This should hopefully give you enough evidence to wave at your broadband provider when things are, let’s say, less than optimal with your connection.

In my own case if I have three low (<2Mbit/s) download speed measurements in a row, the script also goes on to make a second HTTP POST request to my broadband provider’s helpdesk system, and files an automated trouble ticket — containing a pointer to my Google Sheet — to tell them my connection is having problems. But, since your broadband provider almost certainly uses an entirely different helpdesk system than mine, we’ll leave that as an exercise for the reader.

Alasdair Allan

Alasdair Allan

Alasdair Allan is a scientist, author, hacker and tinkerer, who is spending a lot of his time thinking about the Internet of Things. In the past he has mesh networked the Moscone Center, caused a U.S. Senate hearing, and contributed to the detection of what was—at the time—the most distant object yet discovered.

  • The real question is, when you submit your trouble tickets does Comcast actually do anything?

    • obriencj

      Right? You can have all the monitoring on your side that you want, graphs, data out the ears, and they’re still going to tell you to connect your Windows machine directly to the router and also have you tried rebooting. Then they’ll blame wifi interference.

      • obriencj

        That said, I really like the addition of the logging, just for personal use. I’m going to have to look into copying that into my own setup.

        • Victoriacfisher1

          6❝my neighbor’s mate is getting 98$. HOURLY. on the internet❞….A few days ago new McLaren F1 subsequent after earning 18,512$,,,this was my previous month’s paycheck ,and-a little over, 17k$ Last month ..3-5 h/r of work a day ..with extra open doors & weekly. paychecks.. it’s realy the easiest work I have ever Do.. I Joined This 7 months ago and now making over 87$, p/h.Learn More right Here➤➤➤➤➤ http://GlobalSuperEmploymentVacanciesReportsJobs/GetPaid/98$hourly .❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦,❦.❦,❦vf……..

    • Gregg Levine

      Comcast? Probably not. If you’re not a Comcast for business customer then no. I know one chap, he’s got the fastest connection ever, and when there ar problems, he’s got them on it, at what seems to be faster then light speeds.

  • Pingback: Use Raspberry Pi to Measure Broadband Speeds, Dropouts to Hold Your ISP Accountable | 懒得折腾()

  • Chip Warden

    If the bandwidth you’re paying for is more than 100Mbps, how does a RPi measure it? Don’t get me wrong, I love this idea, but the RPi is always going to be see the bandwidth capped at 100Mbps or less.

    • If you have broadband with >100Mbps throughput, I don’t think you have much to complain about in the first place?

      • FeMaven

        Or you could run the script on a linux box that’s running a 1gE.

  • Pingback: DIY ISP Network Speed Monitor | DIYGadgets()

  • I used a Raspberry Pi to send the data to Loggly: you just need a two line script then!

    • Nice!

    • Joel P

      Thanks for that. I followed your instructions and it’s working like a charm!

  • Emiliano Sturniolo

    HI guys.
    I made exactly the same a few months ago.
    The only difference is that the error report goes to your ISP Twitter Account to put a ticket, using IFTTT.

    May be is useful for someone:

    It’s not finish and has bugs, but is usable.

  • jbmachelp

    I would want to use the Perl script because I’ve heard that the Python compiler allows things it shouldn’t, which often causes Python programs to be faulty. As much as people might complain about Java’s security, the compiler is rather strict and will at least point you to the line which has faulty code if it can’t give you a description of the problem.

  • jbmachelp

    Is the script somehow able to determine when a computer, mobile device, or set-top box is downloading something, so as to prevent a false readout? If it can’t, this script could be reporting that the Internet access speed is lower than it should be when it can’t get an accurate measurement as a result of a large file being downloaded on the network?

    • No. But unless you’re saturating the available bandwidth the throughput, i.e. the broadband speed measurement, shouldn’t drop by that much. It’ll drop, but not significantly unless you have a really bad piece of copper.

      • az_r2d1

        In that case you don’t even need the higher bandwidth? I know if I download something big the bandwidth won’t be anywhere near where it should be. It should detect if there is any significant downloads going on. Someone running netflix will surely throw the measurements off.

        • People often talk about bandwidth and throughput as if they’re the same thing, they aren’t. That said, yes. A for a lot of home broadband connections, having HD video streaming simultaneously will through the speed (throughput) measurements off quite a bit.

      • jbmachelp

        My concern is that if you tell the script that you’re supposed to be getting 15 megabits/second, the moment you start watching a YouTube video, or upload a photo to Flickr, your Internet speed will go down, and then the Raspberry Pi will end up falsely notifying your ISP of a drop in service.

  • Carlos

    Hi to all, i want to make this, but im lost on the secret key…. where can i see my secret key?
    thanks in advanced for some replies
    best regards

  • Carlos

    Hi to all , i have a strange problem when i run ./ it works and spreadsheet get populated with correct info but at top of the hour all fields are empty only with date stamp, someone know whats possible is wrong?
    thanks in advanced

    • Sounds like you have a path problem with the script called from cron and, while the script is running you’re not actually doing the speed test. Check the path to the speedtest-cli program in you script is correct. It’s possible that on your system it’s not installed in /usr/local/bin.

      • Carlos

        Hi Alasdair, first thanks for the support, really appreciated, afther checked seems to me the path is correct , but the log file is populated only with ; “Congratulations! You’ve fired the speedtest event” every time the script run … really i dont know what is wrong , any more help is really appreciated.
        thanks in advanced

        • Carlos

          so… i have pick up the problem ….. my was only with : query speedtest: speedtest-cli

          no i add /usr/bin/speedtest-cli and all works fine
          thanks for help and for great post.


          • Erik Sundell

            That worked for me as well, thanks.

          • I was linking to an older version of the gist. I’ve now updated the link in the text to point to the latest version.

      • HondaMinecrafts

        I was having this same issue. It’s because the download for the that you have linked above is missing the full path. The code you have above includes the correct path. So basically, anyone that downloads the file you linked is going to have this problem.

        • Thanks. Was linking to an older version of the gist, now fixed.

    • Erik Sundell

      I have the same problem. When I run the ./ it runs and populates the sheet just fine. But when the cron job runs only the time stamp populates.

      • Erik Sundell

        Well I guess you answered this already but I didn’t quite think that was the reason and I was wrong. I had the script in the home/pi folder. So I think I’ll go good now.

  • Ashley (+$24.08)

    ITT: youre paying for 25 megabytes not bits and they just blame the advertising

    • Patrick Holt

      8 bits to a byte: megabytes > megabits paying for megabits likely, not megabytes

  • Pingback: Monitor the Consistency of Your Broadband Speeds with a Raspberry Pi and IFTTT | Parallel Feed()

  • Steve Hawks

    FYI.. Line 54 of the “download” is incorrect compared to the line above (the line above works fine). It’s missing the full path.

    • Thanks. The download link was to an older version of the gist. Now fixed.

  • Ty

    Maybe a noob question (maybe not) but couldnt this be done on a normal PC? I have one that runs 24/7 and would be interested to check how my speeds fluctuate during the course of a day. If anything from the above changes when doing this on a PC, could anyone point it out?

    • blacksmith_tb

      Are you running a Linux distro? I don’t have much experience with IronPython (it does support pip I think), but I assume you could get speedtest-cli to run on Windows, scheduling the task without cron is going to look different, though.

    • Rui Silva

      If you have Linux then it’s pretty much the same steps

  • Geoffrey Lewis

    Do you need the full raspberry Pi for this, or would a zero be capable, been considering jumping into the pool, and this project might just be the push I need …

    • blacksmith_tb

      A Zero would have plenty of horsepower for this, but you’d need to get a micro-usb ethernet adapter for it, they are around $10, or a micro-usb-OTG adapter and a usb wifi adapter, < $15 together.

  • Pingback: Monitor the Consistency of Your Broadband Speeds with a Raspberry Pi and IFTTT | ..:: Frog in the box ::.. | ..:: Frog in the box ::..()

  • Jason Hunter

    This was a fun little project on a snowy day. My ping times are much higher than running from the DL and UL speeds are close but latency is like 900ms on cli and 20-30ms on web…just curious if anyone else had that too. Haven’t figured it out just yet.

    • There are several reasons why you might be getting different results. The servers have been migrated to using pure socket tests instead of HTTP based tests, different version of Python will execute thing slightly differently, and CPU, memory capacity, and speed (or other machines and how your network is connected together) can affect the result.

      That said a difference of 20-30ms and 900ms is pretty extreme. You’re not using powerline Ethernet by any chance are you? I’ve seen this sort of problem happen when that gets disrupted by a spike from a washer-dryer or some other high current device.

      • Jason Hunter

        Thanks for the reply! I am not using powerline ethernet and consider the infrastructure pretty simple with modem>router>switch>endpoints (wifi and ethernet). My guess is its just that old gen1 raspberry pi and even with it headless and no usb devices connected that the bus is just slow. I am gonna build a quick linux box and set up speedtest-cli to compare. My gut says its at the Pi level tho.

        • Could be, I was using a Pi 2. Wouldn’t have thought it’d make a difference, would be surprised in fact, but I could be wrong.

  • Bill B

    Interesting. I’m going to have to look into this one. I think I want to be sure I can control the test server. I don’t want it to be owned by my ISP (comcast). I get consistently faster results when I get with them. It seems less realistic to me.

    • You can force the server choice with a command line option on speedtest-cli. Run it from the command line with “speedtest-cli –help” for a full list of options.

  • Rui Silva

    Great mini-project you have here :D I have two questions:
    1- how hard is to make some sort of live graphic with that info?
    2- sometimes the upload field returns somehow a date. a few minutes ago I saw a log with “2016/01/20” in it. What is the cause of this?

    • Create a header row in the Google Sheet by inserting one at the top of the sheet and grabbing and dropping the separator and dragging it down to make it a header rather than a normal cell row. Then select the entire C and D column by clicking on C and shift-clicking D. Then insert a graph using the menu bar item. Since the entire column is selected the graph will update each time another row is appended to the sheet.

      • Bjørn Heipt

        How did you get this to work since you use . and not , as decimal?
        I cannot get the . to work and have to manually change it to , to get the graph.
        Is there somewhere in the script I can get it to type it with a , instead?

    • No idea about the date issue. Haven’t seen that.

    • Alberto Victor

      I have something like this, but I send data to an Emoncms server (using Mqtt protocol). Than Emoncms does live graphics and I can also use this data into my Openhab “home automator”. I send also Raspberry informations. This is not so hard to do. If you want something easy to do, you can take a look at the following project. It gets connection data, but also some modem data.

    • Peta

      I had the same problem with the date. I found out that google sheet formats automatically the numbers. For example, for me, it changed 1.01 to 01/01/2016. You can change that bym not formatting automatically number. (format/number/…)

      Hope it helps

    • Michael F

      If you have a Windows machine that could access the file you could have a scheduled task to run a PowerShell scrip that calls a macro in Excel to build a chart from the file export it as a PNG file and upload it to a webserver. I know Libre Office supports Python scripting, but I’m not sure of it’s capabilities to do the same. This will all get quite a bit easier in July when “all” of Ubuntu userland is added to Windows 10 Redstone.

  • Tyler Cochran

    I’ve created the script and set the cron job (running every minute for troubleshooting purposes) but it seems that it’s throwing an error about permissions. The output mail from the mail handler says “/bin/sh: 1: /home/pi/ Permission denied” What did I miss? (I did just update file permissions on the .log file, but that wasn’t the solution)

    • Check the ownership of the script. It’s possible that you copied it in as root and cron running as the pi user can’t access it?

      • Tyler Cochran

        Thanks – it wasn’t ownership, it was permissions – not executable. I’m logging to the .log file, onto the next step!

  • Matthew Medeiros

    I am trying to get this to work except when I run the speedtest-csv executable, it completes and tells me congrats and all that. However, It never runs the recipe on IFTTT. I replaced the SECRET_KEY on the line “secret_key=”SECRET_KEY”” with “secret_key=”key_I_got_from_maker_site””.

    Any ideas?

    • Matthew Medeiros

      dis-regard. When I setup the recipe I named it “Speedtest” and the script is trying to run “speedtest”. FYI Capitalization matters :)

  • wooac

    When I run, it runs correctly and reports that I’ve fired the spreadsheet event, but I don’t have a new spreadsheet in my Google Drive. Any suggestions?

    • Have you copied the IFTTT recipe into your account, and activated on the remote end? Both ends need to be set up for things to work.

    • You have to name the Event in IFTTT as “speedtest”, notice the lowercase

  • Pingback: Monitor the Consistency of Your Broadband Speeds with a Raspberry Pi and IFTTT – Iconic Moment()

  • François Berland

    Just done a comparative test using the command line and web site on the same Ubuntu machine. On the website I got a latency of 2ms, DL 269.13 Mbps and UL 306.44 Mbps and then, using the command line, latency 12.943 ms, DL 155 Mbps and UL 94.18 Mbps.
    Not sure that command line tool is working very well?!

    • There are several reasons why you might be getting different results. The servers have been migrated to using pure socket tests instead of HTTP based tests, different version of Python will execute thing slightly differently, and CPU and memory capacity and speed (or other machines and how your network is connected together) can affect the result. If you want really accurate results, this isn’t the way to do it. You should be using iperf to your ISP’s servers (if they allow that).

      • Diogo Serra

        Do exist any script of iperf to ifttt ?

  • Pingback: Liquidmatrix Security Digest Podcast - Episode 63 | Liquidmatrix Security Digest()

  • zadikim

    This can only work with a PI? anyway to run such a scriot on a windows server?

    • The bulk of the code is in Python, so provisionally yes. But this tutorial makes use of a lot of the Linux features — a bunch of Unix command line tools, bash, cron — which would be harder to replicate on Windows. But not impossible.

  • Chris Houghton

    Hi, this is a great tutorial. I can get the IFTTT to trigger manually but I’m having issues with the script. When I check my log file I get an error message that there is no MTA available – however, my understanding is that the echo statement should instruct the cron process to output to a log file rather than via mail?

    • Sorry. Haven’t come across that one. Try adding a “> /dev/null 2>&1” at the end of the cron entry line. That should send the cron output, rather than the file output to /dev/null and not trigger the mailer.

      • Chris Houghton

        Hi Alasdair – thanks for the reply. Turned out the issue was that I didn’t have a MTA installed (e.g. Postfix) which was causing the error message in the log. However the script didn’t fire because I didn’t make the .sh file executable – typical rookie mistake! Thanks again for the great tutorial

  • Anthony DeFallo


    I am running into a problem when I go to post. What is going wrong when I have this error output:
    Cannot POST /trigger/speedtest/with/key/
    I have re-connected my maker channel, updated the key, checked my logs and everything. I cannot figure it out. Anyone able to help?

  • Anthony DeFallo

    Ok, it seems to be running two tests at a time, which is giving me incorrect results. What can I do about that to prevent it from happening? I’m getting two outputs into my spreadsheet on Google

    • Sorry. Not seen that happen before. Maybe investigate the script you’re using for the cron task?

  • kiteboy

    This is great – however is there a way to specify a specific server?? The ones it seems to be picking out automatically only give around 90Mb for me. Tried one manually (physically closest) on the site and Im getting the full speed of 200Mb. Good work though! This isnt on a Pi too just an ubuntu box on gig ethernet

    • kiteboy

      Looks like my switch was running at 100Mb – that would be it!

  • Trenton Kakazu

    Is there a way to change/force what server that it uses to check the speed on? I want it to check one in SF vs one in Honolulu Hawaii, to get my “true” speed… vs my local bs one.

  • Pingback: Traquer le débit de votre connexion internet avec un Raspberry Pi | L'actualité de la High Tech()

  • Robert L.

    What image are you using? I am getting errors at “$ git clone“. -bash: git: command not found. Any ideas thanks

    • mattgrimley

      Try this:
      On cloning the Ifttt recipe, the event name is lost. This needs to be “speedtest”.

      • Stefan van Aalst

        Done this, still no luck in creating Google Spreadsheet.

  • mattgrimley

    Hey, nice project here! I’m having some issues getting iftt to process the post though.. I get as far as “Congratulations! You’ve fired the speedtest event” on the Pi console, but on the recipe log page on it displayes a “Maker Trigger Error” without any further troubleshooting info.. I dropped some “echo” commands into the script on the pi and it seems to be collecting info that looks right..

    The json variable for example shows {“value1″:”1800000.0″,”value2″:”46.61″,”value3″:”22.49”}

    Any thoughts on how i can troubleshoot it further?

    • mattgrimley

      solved my own problem. On cloning the Ifttt recipe, the event name is lost. This needs to be “speedtest”. (I also copy and pasted the code above over the top of my git cloned code as it’s different in multiple places).

      Now working fine! Thanks! :)

      • Yup when you clone the IFTTT recipe it looses the event name, this probably doesn’t matter much with a lot of recipes. But for this one it makes a big difference.

  • Feste


    I have problem with scipt “speedtest-ifttt” when running from terminal it’s add all data to spreadsheet, when using by cron with speedtest-cron, to the spreedsheet is adding only date of running script.

    • rduggan

      In speedtest-csv look for the Comment # Query Speedtest
      where speedtest-cli is called and add the full path. should look like :
      #Query Speedtest
      /usr/local/bin/speedtest-cli –share > $log

      • Feste

        thanks! Now it’s working perfect.

  • Bill Steiner

    This is very cool, I really want to get my new Pi to run this but I have limited skills and really need help. I get to the stage where I need to setup a Cron script that I think I did correctly. I did an exact copy of the box on the webpage showing the script and placed the script in /home/pi. But when I run crontab –e I don’t see anything listing “entry to run the script test once an hour”, is that part of the script file I created prior to this step? Is the crontab file for hourly runs in another location that I should be pointing to?

    I really would like to get this running, please help.


    • Add the line “0 * * * * /home/pi/” to the crontab file that “crontab -e” opens in the editor. Then save the file. That’s it.

      • Bill Steiner

        Did that and nothing, still does not run at all. Will run when I issue the command “speedtest-cli” using the command line but does not create a file with the data. What am I doing wrong? Thanks

      • Bill Steiner

        What operating system are you running on your Pi?

      • Bill Steiner

        I have wiped my card and reinstalled everything, then started fresh and still can’t get this to work. I don’t know how to or I don’t understand the following:

        “The easiest way to do this is to create a quick script, let’s call it, which will log the date and the output of the test to a file,


        date >> /home/pi/speedtest.log
        /usr/local/bin/speedtest –simple >> /home/pi/speedtest.log

        How do I create the script, is the information in the script the lines above, is the script file created and stored in a specific directory? I am really a noob at this so is there anyway you can walk me through it?

  • Joe Garner

    Getting an error when running the speedtest-cron script that there is no .log file. everything else runs fine.

  • Jeremy Curcio

    For whatever reason my results aren’t saving to my log file using the basic cron (/usr/local/bin/speedtest –simple >> /home/pi/speedtest.log). The date does save to the log file though, and if I run the command in my crontab manually it does save the data. Any thoughts?

    • dRu

      Same thing here.

    • Jonathan Ransom

      Same here as well. When running on cron job it posts to Google Sheets but all I get is a date. Run it manually and it works fine and posts all data to Sheets.

  • Matt Smith

    Great tutorial, very useful. However, I can see the spreadsheet getting very large over time. Is there a way that I could get the spreadsheet to remove entries after, say, 90 days, just to keep things manageable?

  • Pingback: Monitor The Consistency Of Your Broadband Speeds With A Raspberry Pi And IFTTT | Lifehacker Australia()

  • Pingback: Issue #24 - Dev Diner()

  • Olivier Gandou

    Hello, this is a great article, thanks! I’m having issues though (I’m a complete newbie with this, sorry). I setup the basic cron job, and I can tell in the syslog that it’s running every hour, however there is nothing in speedtest.log. The syslog says “no MTA installed discarding output”… am I missing something? Thanks.

  • Andrew M

    I am missing something most likely very obvious.

    When I run ./speedtest-ifttt I am getting a “No such file or directory” message.
    “speedtest-ifttt” is in the same exact location as “speedtest-csv” and that runs just fine.


  • Tab Snyder

    I keep getting a “line 87: curl: command not found” error.

  • Pingback: Raspberry Pi monitors Broadband speeds | Top Gadget Gifts()

  • Ed

    Ive had my pi running something similar for over a month. When my speed drops to 50% of what I pay for it tweets at my ISP the speeds and asks why its so low.

    I store my data in a csv and ftp to the pi to collect the data when i want a look. Im happy to share my python script if people are interested.

  • Really cool article. I’ve followed all the steps and working like a charm!

  • Pingback: Internet Speedtest mit dem Raspberry Pi und IFTTT()

  • Tyson Steele

    I’m confused when we get to the point with ifttt. I linked everything with drive. What do I do when he says to “download it”? Not sure if it’s just me not understanding the instructions or not but could someone please clarify the end part where we post our results to drive?

  • Stefan van Aalst

    Please, some help required.

    I reached the step:

    $ ./
    Congratulations! You’ve fired the speedtest event

    I verified that the json has values. No errors are thrown (first I had a mistake in the secret key and it threw an error). So Congratulations, however, no Google spreadsheet.

    Please advise.

  • Tom

    I can get the to log onto google drive if I run the script myself, but I am having trouble getting the file to log automatically, nothing is being sent to ifttt nor google drive, I have tried setting crontab to 5/10/30 minutes or every hour just to speed up testing. I have changed the location in the cron file to where the ifttt file is but still nothing is happening.
    Should I see anything happen on the pi when it is supposed to run the file? Is there a log file of what I am doing somewhere that will tell me what is/isn’t happening?

    Thanks for any help

    • Ant

      I have the same problem. Did you figure it out?

      • Tom

        No luck, I haven’t tried again since posting that comment, I;m going to try again now with a fresh install and see what happens.

      • Tom

        Okay, I just added: ” 0 * * * * /home/pi/ ” to crontab and it seems to be working.

        when i tested it I put */1 * * * * /home/pi/ to make the file go off every min so that I could see if it was working.
        Try this and see if it works.

        you can also check what crontab is doing by using:

        grep CRON /var/log/syslog

        I also installed postfix, which is something to do with cron trying to mail the output. I’m not sure if it is needed but I saw a error in Cron saying about MTA.

        sudo apt-get install postfix

        use that to install postfix.

        • Ant

          Thanks for your replies. Yes I had 0****/home/pi/ but no luck. I have also tried a few variations without success. After my post I realised that I can’t actually get $. / to work, however if I run $. /speedtest-csv it will display the results in the terminal and will also log the values on a new line in google drive. I also couldn’t get the command log to run $cat speedtest.log

          • Ant

            Got it working! It was a permissions setting on the files, they weren’t executable. I am very new to all of this, there seems to be so much assumed knowledge!

          • Tom

            Yeah this was my first project with the Pi and linux, took a lot of googling to work out what was going on at points. that is awesome that you got it to work!

  • Cameron Steel

    Just implemented this on my home server logging to a local copy of SparkFun’s Phant. Works like a charm. Now I just need some internet speeds worth monitoring. Ahh Australian politics is a wonderful thing.

  • Brian Minh Ton

    How do I download the modified speedtest-cli-extras script?

  • Mark

    Being a noob, I found some areas difficult, like setting up a script from scratch plus file permissions and ownership, but a bit of searching all is good.

    I want to choose a server closer to me (UK) but the –list command doesnt show any UK servers. Can anyone help??

  • Kris Swanson

    I have tried running this on a B+ and my ping rate is through the roof compared to running the same test on my PC via pointed to the same server… andy ideas?

    Last test via PI says:

    ping 56.584 download 50.79 upload 7.48

    Yet via on my PC I get 9ms ping 85.15 download and 10.03 upload

  • Pingback: iiNet SpeedTest Results | I am the BFG()

  • Pingback: Link dump 2016/8: Open science, books on a ship, waves in the Alps, maker projects –

  • Jimmy Long

    Has anyone built this with an Arduino?

    • Michael F

      I don’t think it would be practical. Arduino really aren’t meant to handle network communication, you’d be better off with a Beaglebone or Raspberry Pi.

  • Pingback: Automating and sending data to web services –

  • Peter Smith

    ‘Hold your ISP accountable’… ROFL!
    I like this guy! He’s funny :D

  • Would be great to somehow get the results to automatically display in the Google search results when someone is looking for internet providers, similar to someone searching for a Stock Market Quote and seeing a chart with info.

  • Pingback: How To Build a Broadband Speed Monitor with Raspberry Pi | Digital Trends()

  • Pingback: Use Raspberry Pi to Measure Broadband Speeds to Hold Your ISP Accountable - GLOBAL SCOOP NEWS WIKI()

  • Pingback: Use Raspberry Pi to Measure Broadband Speeds to Hold Your ISP Accountable - THE LONDON WORLDWIDE JOURNAL()

  • Pingback: Rpi Printing |

  • Awac

    I’m following your tutorial but I don’t understand how to get a secret key. Could you help me please .

  • Awac


    I’m following your tutorial, I got the key, I changed it in the file linked in the hyperlink “download”, put it on my rasp, chmod 777 but got the answer “no such file or directory” when I run it instead of “Congratulations! You’ve fired the speedtest event”.

    Could you help me please ?

  • jonbenson

    Finally a nice little project for my languishing Pi-Zero. Bravo.

  • Shounteal Steward

    Hope someone is still checking this :) – Im still new to RPi/Linux, but was mostly able to follow this article. Where I run into an issue is with the Not sure where or how to get this to work. What I ended up doing was going to my speedtest-cli-extras/bin directory, then sudo nano, and pasting the information from above into it, and saving it. But when I try [code]sudo ./[/code] it returns [code]sudo: ./ command not found[/code]. I did use my own secret key in both places. What am I doing wrong?

    • Shounteal Steward

      sudo chmod 777 fixed it.

  • Richard Thompson

    For those that received “Congrats” but no spreadsheet, ensure the event name in the recipe is ‘spreadsheet’ not ‘Spreadsheet’

    Changed from S to s and ran perfectly.

  • CK

    Hi. Thanks for this guide, i am a newbie to arduino & rpi, after few hours work trial and error finally I managed to get it worked. Test result was sent to my google sheet hourly but somehow at some hours the data came back with just the date and time but no data for ping, dowload and upload. May i know what could be wrong? I am using my asus router usb port as power source for my rpi3. Could that be the problem?

    Another question is how do i set it to other time interval? example every 15mins, 30 mins or few hours?

    Hope someone can advice me here. Thanks.

    • Alex Fagan

      Hey mate. I am in the same boat. (asus router aswell)

      Did you find out what was causing it?

      • CK

        Hi mate. Just leave it as it is. After a day or so it will run smoothly and you will get update every hour. I get total of 9 missing data on the first day. And then didn’t miss a single update until yesterday i get one missing data again. But at least it’s working almost all the time. I am fine with that few missing data

        • Alex Fagan

          Hmm.. I’d like to know if this is the raspberry pi at fault or the ISP though. As i graph the result as 0 when it fails like this as I assume there is not internet connectivity at that time.

  • Pingback: Isp Speedtest |

  • Sebastián Beeche

    Great project Alasdair!!!
    I have 2 questions:
    1.- sometimes the script runs perfect and write everything on the spreadsheet, but sometimes writes just the date. It’s a random beheaviour with the cron. Running by hand, always work.
    2.- just 3 fields in the spreadsheet? can add more like the Speedtest Server and the URL of the image of the test?

    • Roger Crowther

      I started to have the same problem when the script was run from cron, and the behavior seemed to be getting worse with time. Running the script from the command line always worked. A big difference is that cron always ran at the top of the hour, while running from the command line was never at the top of the hour. I think perhaps IFTTT sometimes gets overwhelmed with data on the hour and data does not get processed correctly. I edited cron so that the script would run after the top of the hour, and since then everything has posted correctly to google drive.

      • Sebastián Beeche

        Roger, i’ve never realize that, what an a good idea to move the cron… maybe just 5 minutes is all what is needed.

  • alexsmithlp

    make sure this is the only thing using the connection, modem is capable and locked to all available channels, testing device can handle the max speed, otherwise a junk log.

  • Matthew

    I love this article! Thanks for your help. I guess the next step is how do to apply the data to change the terms of the conversation from holding [U.S.] ISPs accountable to ditching them completely by compelling cities to municipalize them as is done with infrastructure and publici utilities the way that they did in Lafayette, Louisiana. While I’m sure other countries have their share of local internet woes, as explained by Susan Crawford and Lawrence Lessig, it’s no secret that the US consumer is getting considerably more ripped off for internet than their international counterparts. Even the rates charged by Google Fiber are nowhere near competitive to the rates charged outside the U.S. This is scary considering the amount of red tape that even a well-moneyed giant like Google has to go through to break through the barriers of entry erected by the established telecom companies.

    Hong Kong consumers apparently can pay ~25USD/month for 500Mbps/500Mbps where I’m paying AT&T for Uverse in L.A. $50 + tax for 3Mbps/0.7Mbps. This is bananas!

  • alexsmithlp

    removing comments great