mzac Posted January 28, 2016 Posted January 28, 2016 Hey all, I'm looking to see if anyone knows of either an app for iOS or Android that would do the following: - Track current location with GPS - Run a ping to any IP or run a speed test with iPerf or something similar - Timestamp results - Export results in CSV or KML format I'm looking for this for two reasons. First, when I go to work on the train there is always a dead zone I go through and I want to show to my carrier the problem, I don't think they're going to take a ride on the train or lend me equipment to prove it. Second, for work I am working on a mobile LTE deployment in a vehicle and I need to verify the route the vehicle takes to make sure there are no dead zones. I am thinking that I could easily do this all on a Raspberry Pi, but if something already exists for this it would be great..! - mzac Quote
cooper Posted January 28, 2016 Posted January 28, 2016 I think the first reason is bogus. You can provide them with any sequence of bytes as proof, they're going to call you a liar while they sit back and continue to drink coffee. As an example, he's the network speeds I get on my way from A to B: A : 100% A+30m : 50% A+60m : 0% B-50m: 10% B-25m: 80% B : 100% What did I just prove, other than that I can pull statistics out of my ass? The second has the problem that I think you want to do this _as you're moving along the route_, which has a great likelihood of hiding any brief connection issues within the hardware. If that's within the operating parameters of your device, all fine and good. If you outright _require_ constant connectivity, you would ideally start an upload stream when you depart and measure its throughput as you go relative to time. Similarly, have something track your GPS coordinates relative to time. If your upload speed drops below a given minimum during the trip, you'll know you're in trouble. Repeat for the return route, again both ways but now doing just uploads and having completed this repeat all that both ways under varying atmospheric conditions since you've only just tested a single moment in time. And again, I know of no tool that combines these 2 things, but your method as you currently planned it I feel doesn't prove what you're setting it out to prove. Quote
barry99705 Posted January 28, 2016 Posted January 28, 2016 Taa Daa! https://play.google.com/store/apps/details?id=com.rootmetrics&hl=en Quote
cooper Posted January 28, 2016 Posted January 28, 2016 Barry99705: Making it look so easy since 2009. Quote
mzac Posted January 28, 2016 Author Posted January 28, 2016 (edited) Ok well I went ahead and wrote a linux bash script to do this... I've tested it with a stationary raspberry pi with a BU-353 USB GPS, I'll have to test it on the road. I made sure to make it as simple as possible and not depend on too many extra packages. You just need gpsd and iperf It writes to CSV format so you can massage the output into a kml I'll post this eventually on my github page so I can keep it up to date. Update: Here is my github link: https://github.com/mzac/iperf_gps #!/bin/bash # How many seconds to run the iperf test iperf_test_interval=5 # How many seconds to sleep between tests update_interval=10 # Location of iperf binary iperf_bin="/usr/bin/iperf" # Iperf server to connect to iperf_server="10.0.0.10" # How long to run the iperf test iperf_time=5 # Location of gpspipe binary gpspipe_bin="/usr/bin/gpspipe" # -------------------------------------------------------------------------------- # Do not change any settings below this line # Verify if iperf is installed if [ ! -x $iperf_bin ]; then echo -e "\niperf binary not found or is not executable!\n"; exit 1 fi # Verify if gpspipe is installed if [ ! -x $gpspipe_bin ]; then echo -e "\ngpspipe binary not found or is not executable!\n"; exit 1 fi # Verify that the base filename for output is specified if [ -z $1 ]; then echo -e "\nUsage:" echo -e "$0 <base_filename>\n" exit 1 fi export_file_timestamp=`date +%Y-%m-%dT%H:%M:%S%z` export_file_name="$1-$export_file_timestamp.csv" if [ ! -e "$export_file_name" ]; then touch "$export_file_name" fi if [ ! -w "$export_file_name" ]; then echo "Cannot write to $export_file_name" exit 1 fi echo "date,time,longitude,latitude,altitude,speed,track,iperf_server,iperf_test_interval,iperf_client_bytes,iperf_client_bps,iperf_server_bytes,iperf_server_bps" >> $export_file_name echo -e "\nAt any time, press CRTL-C to stop the script" echo -e "Writing to $export_file_name\n" echo -e "GPS Data: time,lon,lat,alt,spd,track\n" while true do tpv=$($gpspipe_bin -w -n 5 | grep -m 1 TPV | python -mjson.tool) lon=$(echo "$tpv" | grep "lon" | cut -d: -f2 | cut -d, -f1 | tr -d ' ') lat=$(echo "$tpv" | grep "lat" | cut -d: -f2 | cut -d, -f1 | tr -d ' ') alt=$(echo "$tpv" | grep "alt" | cut -d: -f2 | cut -d, -f1 | tr -d ' ' | awk '{print int($1)}') spd=$(echo "$tpv" | grep "speed" | cut -d: -f2 | cut -d, -f1 | tr -d ' ') track=$(echo "$tpv" | grep "track" | cut -d: -f2 | cut -d, -f1 | tr -d ' ' | awk '{print int($1)}') gps_date=$(echo "$tpv" | grep "time" | cut -d: -f2 | cut -dT -f1 | cut -d, -f1 | tr -d ' ' | tr -d '"') gps_time=$(echo "$tpv" | grep "time" | cut -dT -f2 | cut -d. -f1 | cut -d, -f1 | tr -d ' ') # Convert speed from meters per second to kilometers per hour spd=`echo $spd | awk '{print int($1 * 3.6)}'` # Check if lon and lat are set if [ ! -z "$lon" -a ! -z "$lat" ]; then if [ -z "$alt" ]; then echo "No alt - setting to 0" alt=0 fi if [ -z "$spd" ]; then echo "No speed - setting to 0" spd=0 fi if [ -z "$track" ]; then echo "No track - setting to 0" track=0 fi if [ $spd -le 1 ]; then echo "Not moving - setting track to 0" track=0 fi gps_result="$gps_date,$gps_time,$lon,$lat,$alt,$spd,$track" echo "GPS Data: $gps_result" echo "Running iperf test" iperf_result=`$iperf_bin -c $iperf_server -r -t $iperf_test_interval --reportstyle C` iperf_result_client=$(echo "$iperf_result" | head -1) iperf_result_server=$(echo "$iperf_result" | tail -1) iperf_result_client_bytes=$(echo "$iperf_result_client" | cut -d, -f8) iperf_result_server_bytes=$(echo "$iperf_result_server" | cut -d, -f8) iperf_result_client_bps=$(echo "$iperf_result_client" | cut -d, -f9) iperf_result_server_bps=$(echo "$iperf_result_server" | cut -d, -f9) echo "Writing results to file:" echo "$gps_date,$gps_time,$lon,$lat,$alt,$spd,$track,$iperf_server,$iperf_test_interval,$iperf_result_client_bytes,$iperf_result_client_bps,$iperf_result_server_bytes,$iperf_result_server_bps" | tee -a $export_file_name else echo "No GPS Fix!" echo $tpv fi echo -e "Sleeping for $update_interval seconds...\n" sleep $update_interval unset tpv unset lat unset lon unset alt unset spd unset track unset gps_date unset gps_time unset gps_result unset iperf_result unset iperf_result_server unset iperf_result_client_bytes unset iperf_result_server_bytes unset iperf_result_client_bps unset iperf_result_server_bps done Edited January 28, 2016 by mzac Quote
mzac Posted January 29, 2016 Author Posted January 29, 2016 (edited) I've updated the script a lot since yesterday, now includes ICMP tests for results as well as checking the server is alive before running the test. Also, I just realized that this tool could be very useful for outdoor wifi deployment testing! I should also test it on my wifi pineapple to see if it'll run... Take a look on the github repo and please give me any feedback. https://github.com/mzac/iperf_gps Thanks Edited January 29, 2016 by mzac Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.