As more and more I have started using public transportation for my daily commute to work internet connection has become a necessity during my travel. Good thing is that there is free WIFI on the train although quality of internet varies depending on location during ride, sometimes it is good and sometimes connection is slow or drops completely. I am not blaming bad service by transportation company, similar situation I am getting when using my personal hotspot.
I am curious enough so I have decided to measure these “black areas” and to do that I would need some way of determining signal strength and get exact location where signal is measured. The location is quite easy I have to log GPS coordinates and idea for signal strength came to me on its own. Apparently 4G router located on the train is assessing signal strength all the time and the values can be extracted with HTTP request.
Routers version of signal strength is only one feature for the connection which is measured in this case, better implementation would be doing quick speed tests to measure overall internet speed quality.
Getting signal strength value
After doing quick investigation on router home page, I have found that there are various router stats available like connection mode, connection strength, battery levels, this you can see in image below.
These statuses are refreshed at regular time intervals and web site is rendering these results. I have discovered, that by sending a simple request to available endpoint it is returning same information in neat, formatted XML string.
So now I have my signal strength value, next would be adding location dimension to the captured data.
To get GPS coordinates I was using “Bluetooth GPS Output” by Meowsbox application running on mobile device and when I connect laptop, location information is streamed through one of COM ports. Reading location was effortless using Python serial library. More details on how to connect mobile app to laptop or PC is available in the app, there are nice descriptions and YouTube videos as well.
Above you can see that mobile device is tracking location and streaming that to COM port.
Now I have both, signal strength value mapped to a geographical location. To log values I have made a python application that every 15 seconds sends HTTP requests to get signal strength value and captures GPS location data and then stores those values in CSV file for later analysis.
Just when I have boarded train I had to enable Bluetooth for all the devices, start up GPS coordinates streaming and start up Python application that is logging all the values, I was driving like that for a while till I got over thousand data points. Below is quick plot of signal strength values. From returned results I have identified 6 signal strength levels 1 is lowest and 6 is having high signal strength.
As point density is very large if I am not seeing all the points at once they are getting placed on top of each other and I think it is not giving accurate results. Better results would be achieved if I would have broken down line in smaller local regions for which the average value is calculated, for example region could have 100 meter radius with an average signal strength value there.
Only relying on Router data is not sufficient, because connection can have high value although the throughput for connection is bad. Better solution would be by doing speed tests measuring connection speeds and logging those values. Another variable that I might need to consider would be count of devices connected to that public WIFI network as data consumption from other devices can have considerable impact.
Thanks for reading, if you liked, disliked, have suggestions on what could be changed or upgraded let me know.