Raspberry Pi Portable 3G/4G Network Quality Logger Project – Part 1

For the past week, I’ve been futzing about with a Rasperry Pi, trying to turn it into a portable network quality logger. I got kinda stuck, forgot about it for a few days and now I want to re-start work on it, so I’m writing this to get my brain back into gear.

Back when Vodafone’s LTE network launched in mid-June, I did a very rudimetnary bunch of tests around Melbourne, which comprised of simply carrying three iPhones and manually running Ookla’s Speedtest app over and over and over, in random locations. I’d then compile that information and find trends against each of the three carriers. This sort of testing is better than nothing, but it’s very time consuming and doesn’t log any other network quality metric besides downloading a file off Speedtest’s servers.

Vodafone were awesome and gave me three HTC One SV phones to play around with to do some more extensive testing, as I initally thought I could do this all automatically with an Android phone. Unfortunately the apps out there don’t quite do what I want. GNettrack is close, but it’s file download functionality can’t be automated, so it would require manual intervention and defeat the purpose.

I didn’t want to write my own Android app, so what I’m working on now is using a Raspberry Pi, that I can just leave in a backpack, hooked up to a big battery, to log constantly while I move around Melbourne. This is the gear I’m using to collect the information I need:


  • Raspberry Pi Model B – 512MB RAM
  • Globalsat ND-100S GPS Dongle
  • Huawei E3276s-150 LTE modem (Optus sells these for $129 – unlocked! Only Cat4 LTE modem in AU right now)
  • Mophie Juice Pack Powerstation Duo – 6000mAh battery

The info I want to compile into a nice CSV is:

  • date, e.g: 29-07-2013
  • time, e.g: 14:51:32
  • lat (latitude), e.g: -37.745561
  • long (longitude), e.g: 144.811365
  • ele (elevation in M – distance above sea level according to GPS), e.g: 71.078000
  • speed (in m/s, so I know if I was driving, walking, or sitting), e.g: 11.14
  • tech (EDGE, WCDMA, HSPA, LTE etc.), e.g: DC-HSPA+
  • rssi (receive signal strength indicator), e.g: -70 dBm
  • upload (average upload speed), e.g: 1.87 MB/s
  • download (average download speed), e.g: 2.29 MB/s
  • latency (ping a website return the latency), e.g: 24.547 ms

And this is where on the Raspberry Pi the info I want can be extracted from:

  • to get date: system date
  • to get time: system time
  • to get lat & long: gpsd
  • to get ele: gpsd
  • to get speed: gpsd
  • to get the tech: AT^SYSINFOEX
  • to get the rssi: AT+CSQ
  • to get the download speed: curl -w “%{speed_download}” -y 60 -Y 100000000000000 -s -o /dev/null “http://mirror.aarnet.edu.au/pub/TED-talks/AJJacobs_2011P-light.mp4″
  • to get the upload speed: lftp -u user,pass ftp.server.com -e ‘put AJJacobs_2011P-light.mp4; bye’
  • to get latency: ping news.com.au -i 5 -D

So I’d end up with a CSV file kinda like so

29-07-2013,14:51:32,-37.745561,144.811365,71.078000,11.14,DC-HSPA+,-70 dBm,1.17 MB/s,2.29 MB/s,24.547 ms

The aim is to have 3x Raspberry Pi’s (one for Optus, Voda and Telstra) and log for a week, wherever I go. Then with that info, I can hopefully see trends and compile averages (e.g: during the hours of 4PM and 7PM, the average latency on Voda was 32ms, Optus 39ms and Telstra 30ms). This information would give a picture of network quality that can then be compared say, every 3 months, to see if anything has changed for better or worse. It would be a totally independent, real-world measure of network quality. I think I can guess what the outcome will be already, but the gap between the carriers is probably closer than we think.

I’ve managed to get the Raspberry Pi up and running, talking to the USB modem and GPS dongle and operating off the battery fine. I can get the info I want manually and can script some parts of it (like the speed test info). The issue I’m facing is collecting that info from the Raspberry Pi into a single CSV file with as little manual intervention as possible. I’m not that profecient when it comes to scripting (hence why I’m such a shit sys admin), so right now I’m trying to cobble together a Python script that will grab all the info from the various parts of the Raspberry Pi and collate it into a single CSV. You know the mantra, spend more time to automate now and save way more time later?

Some excellent resources that have helped me so far:

And massive props to @LIV2 who has been answering heaps of my questions on Twitter! (I owe you a beer next time I’m in Sydney mate) and to QAVO for hooking me up with a Raspberry Pi on short notice (if I get this working properly, I’ll buy two more!).

It looks like all I need to do in Python is combine this GPSD script and this serial port communication example script, add in the curl & ping commands and format the output to CSV. Easier said than done if you’ve never touched Python before!

Comments are closed.


Get every new post delivered to your Inbox.