Saturday, February 14, 2015

OpenStreetMaps and OpenLayers vs Google Maps API

As noted in several previous blog posts here I wanted to try to get a OFFLINE mapping system working with the "Driveby System".  I believe now that I've found that mapping system in OpenStreetMaps using OpenLayers.

The reason it's nice to have a LIVE map while your driving with the "Driveby System" is mainly so that you can SEE how well the system has recorded the data while you're driving.  Being able to see the results of your live drive test is handy in knowing if you missed a street, or if you should drive a street more times to get a better, more dense results (perhaps you drove too fast the first time for example).  Driving too fast results in gaps in the map.  The idea with the system is to get as continuous/dense a heatmap result as possible. (e.g. without gaps, and WITH having smooth transitions from quiet to noisy areas).

The results are quit good!  The setup is NON-Trivial (meaning it takes following quiet a long setup of directions at least with Ubuntu 14.04).  I now feel the effort was worth the time spent (about 6 hours on my slow laptop) and about 4 hours experimenting with HTML and Javascript and my PHP code including the brief learning curve to read up on how to do a heatmap using OpenLayers.

I used the following URLs to get my system setup and running:

The results are almost as accurate as Google Maps API.  I say 'almost' because it appears at least in my area that OSM may have some outdated street detail.  For example, their map tiles show a street that continues past where it actually does.  Also some of the streets don't line up exactly where my GPS shows they actually are.  On my OSM heatmap using OpenLayers this shows my path that I drove slightly offset from the actual REAL street (according to my GPS, which seems to line up VERY well on Google Maps API).

These short comings are really kind of  'ok'.  I mean it's fairly obvious in the results where you actually where vs what was rendered in the Heatmap.  At certain zoom levels they look just fine.  However when you zoom in very tight, the path I drove with my GPS doesn't line up 100% with the road shown on the map.  

Lets not forget that we'll now have TWO mapping options!  OSM/OpenLayers while live drive testing, and Google Maps API later when you are back to a stable internet connection.   I don't plan on removing the Google Maps API work I've done from Driveby.  I'm simply adding more functionality to provide options.  OPTIONS In my humble opinion are ALWAYS a good thing :-)

I think the benefits outweigh any negative issues.  For example using OSM and OpenLayers means that no live internet connection is required.  Which is AWESOME, and was the primary goal of this exercise.  The map tiles are downloaded and stored locally on my laptop well before I go for a drive test and once installed remain there.  So there is no need at all to have any internet connection.  This is important for many reasons.  Cell Data access is expensive (for some folks).  Cell Data access is unreliable in some areas of the country especially when you are attempting to drive test an area that is remote which may end up being a common use area for a system like this.  Using a tethered Internet Connection (lets face it) can be a pain in the ass causing more frustration than ultimate usefulness!  Been there done that!

Another nice aspect of using OpenLayers is that it renders a much nicer looking heatmap than my experiences with Google Map API v3.

I plan on including config setup for use with OSM and OpenLayers in the Driveby System code which is now available on GIT HUB (minus the new OSM / OL stuff just yet, because I'm still working on it's inclusion into the Driveby Project.

Saturday, February 7, 2015

Driveby System - Work on open source mapping without need for live internet access

One of the biggest complaints I have about using my own "Driveby System" that maps the noise floor of various frequencies in order to locate sources of Power Line Noise is that currently it relies on Google Maps API.  This means that in order to view the maps from the collected data the system requires a live internet connection.  

This is fine in practice, because the data being collected is stored permanently on an attached SSD Drive.  Driveby has the ability to 'review' previous drive tests currently.  So when I return home and once again have an internet connection the mapping works just fine.


Also I have setup the networking to work both with a USB or Bluetooth connected internet connection via a smartphone or tablet capable of sharing it's internet connection.  However, in tests so far this has been problematic.  Loss of cellular internet connection seems to occur regularly (at least around here).  


This forces me to have to mentally remember all the streets I've drive tested in town.  And well....at 52 my memory isn't as good as it used to be.  


SOOOOO.....


I'm looking at trying to use a mapping system that allows the user to download locally the map-tiles that it requires.  Say within a 20 mile radius of the drive test area. (or more depending on the space available on the system).


I think that something like OpenStreetMap might be something I can use.  I've read that it's possible to save locally the map tiles.  


Another option is to use Google Earth (installed) and convert my map/noisefloor data to KML.


I'm still reviewing the best options at this point.  I like Google Earth, as I've done A LOT with KML in the past 10 years.  So that's fairly familiar.  There are also some nice features in GE that could be leveraged in the future.  However, because this is fairly bulky app to install and kind of hogs memory when it's running....I think it'd be a good idea to keep searching.


I've seen some really nice heatmap's done on OpenStreetMap but I've never used this system before so there's likely to be a learning curve there.  


Anyway, I just wanted to share some thoughts on what I'm thinking about doing AFTER the first release of the "Driveby System" code.



Update

So looks like so far that I can't get OSM to install properly on either the TK1 or the Odroid XU3.  SO most likely OpenStreetMap is 'out' as a candidate.

UGH....so now to try to get Google Earth using KML to work.  Trouble is I think GE is semi-tied to having internet access too...blah!


Update 2015-02-13



Today I was able to get a OSM tile server up and running locally on my laptop using this.

Now I'm looking further into how to use OSM with this new mapping tile server. (again this is setup so that mapping would be possible WITHOUT an Internet connection.


The Tile server serves up maps on a web-server that would be running locally on my laptop and I hope to be able to provide coordinates to it to get back a zoomed in map to within a few miles of my location similar to how I'm doing with Google Maps API at currently.


Then the next phase is to work on adding a layer that would be like the 'heatmap' API in Google Maps.



SUCCESS!  Using OSM and OpenLayers I have a completely standalone 'tile server' that can map for me without Internet Access to the outside world.


This process requires A LOT of patience working through the URL noted in the 2015-02-13 Update above.  However, IT DOES WORK, and it actually works WONDERFULLY for so far.

I am now working on setting up HEATMAPS with the OpenLayers v3 API Once all of this is completed, I'll also update the recently released GIT HUB code for the Driveby System. (see other posts about that on this blog).

This is going to be awesome!  I can already feel like this will work really really well.  The API and the setup noted above all seem to work as directed and specified in their respective documentation.  (a rare thing in this world!)


Monday, February 2, 2015

Focus Areas - Suspect PLN


Now I have the Driveby System, and portable yagi's for 144, 432 Mhz, as well as Ultrasonic 40 Khz sound detection as well as the trusty AM Radio in my truck (which is amazing for finding noise sources sometimes).

With the new power supply 12vdc regulator installed in the "Driveby System" I suspect it will be WAY more sensitive than it was before.  I've made some more tweaks on it today (Jan 24th, 2015) in software and intend to test that out later today or tomorrow in the areas I've noted in the maps below.

Last nights discovery of a noisy defunct street lamp was actually very easy using nothing but the AM Radio in my truck, and 50.1 Mhz on a small whip antenna.  Once I located the area, I stopped and used the small yagi antennas panning around various power poles which took about 45 seconds to locate with those and the street lamp noise took about 20 seconds to find using the Ultrasonic MFJ-5008 (which seems to work VERY well, much to my surprise and joy!).

SO these are the areas I'll be working in this week.  Using a combination of all the tools I now have available.  Hopefully I'll narrow things down to the component level on poles that are problematic.  Ameren UE so far as ignored my email requests (maybe they're busy doing something else LOL who knows).  This just gives me more time to locate more problem areas to hand them when I finally do reach them.

This is turning out to be a way bigger problem than I initially suspected.  I had hoped it would just be a few things nearby.  In 2011 Ameren came and resolved (it seems) all the issues I had on the street where the tower is.  I've been hunting those old problem poles and so far not a peep out of them.

So it looks like I'm working the next tier out from the 2011 group of problems.




Results 2015-01-24

Tweaks appear to be doing really well now.  The new 12vdc regulator is SUPER low noise from today's experience.  I heard nothing from the trucks electronics (and obviously there's not AC inverter which was probably a stupid idea to start with...glad that's gone).  All I hear on the HT monitor while I'm driving is white-noise or power line noise now.  I really think that's making a huge difference.

I also adjusted the gain on the RTL's to '-g 10' from -g 0.  I also adjusted the bandwidth to 15Khz instead of 300 Khz.  These adjustments seem to have made quite a difference in accuracy.  Although I think '-g 0' would still be fine.  The antenna I'm using is a discone antenna that's good from 25 Mhz to 1300 Mhz.  And it seems to hear quite well on the bands I'm using with are all (but one 44 Mhz) in the ham bands.


I found at least 5-6 poles today and several of them had significant issues.  I also reconfirmed the poles behind the nearby middle school are indeed a source of strong noise - ON WINDY DAYS.


I've always noticed the noise is worse on windy days, which is probably a sign that most of these issues found today are simply loose components like insulators.  The ones I spotted with the Ultrasonic sound (40 Khz) using the MFJ-5008 today were all insulators.  This MFJ-5008 appears to work REALLY WELL!  After several ventures out with it now I've really found this INEXPENSIVE TOOL invaluable.  IT REALLY WORKS!  I shit you not.  Pretty good compared to the next up option that's over 2x the expense, and the next up from that is about 20x as expensive.  I've very happy with the MFJ-5008.


Also the portable ARROW ANTENNA's I bought are EXCELLENT.  Built strong, and reasonably priced for the most part. 


So...on with what I found today....(sorry for all the back fill).




It doesn't take much wind to make some of these poles really sing!

One thing you may notice is that all of these maps tend to agree with each other, I think this is a good sign.  The first map is "ALL" frequencies summed noise levels over their respective noise floors.  Each frequency has a slightly different noise floor but all are more or less with -0.5 dbm of each other.  

(ALL combined)

(44 mhz)


(50 Mhz)


(144 mhz)


(222 mhz)


(432 mhz)

"AM 1710" is fairly quiet in this area 1.710 Mhz.  Except that it's an excellent HEADS UP while I'm driving around to watch the line charts "Driveby System" generates as I drive.  Listening to 1.710 Mhz and 432.100 Mhz AM listening for Power line noise is VERY helpful I've found.  This gives a heads up that somethings coming, and a heads up when I'm right on top of it.  

I'm thinking about adding an HF upconverter and using one of the 3 spare RTLs with that to graph "AM 1710" as well.

(click to see larger)

Photos to follow from each of the above noted locations

POLE 571647 [near fire station]

POLE 571646 [near fire station]

POLE 572794 [rear of school near steps]
(VERIFIED with Ultrasonic, also pole guy is very loose)
POLE 572794 [rear of school near steps]
(Loose guy closest to camera POLE 572795 in rear also noisy)

UPDATE (AFTER 20150421) NOTE new insulators



POLE 570076 [rear of red city water building]
(TOP CENTER insulator confirmed via Ultrasonic)

UPDATE (AFTER - 20150421) NOTE new insulators



POLE 570076 (zoomed out)

POLE 570076 (LEFT TOP)

POLE 570168 (open arrestor)

POLE 570168 (open arrestor)




Saturday, January 31, 2015

RTL R820T on RF Analyzer App and Galaxy S5

RF Analyzer app Galaxy S5

Ubuntu 14.04 LTS - Howto setup NTP working with GPS

http://www.catb.org/gpsd/gpsd-time-service-howto.html#_feeding_ntpd_from_gpsd

I've been wanting to rely less on having Internet access with the "Driveby System".  There's a long way to go on that front yet.  However, today I was able to leverage two things I already had installed to accomplish a simple task.  The two computers I used in this system do not use a battery backed-up on board clock.  Which has meant that I required internet access to global time servers in order to set the clocks accurately.  

"Driveby" requires that all systems use as close the same time as possible, because in my case the GPS lat/long's are being recorded on one server, while the RTL noise floor reading are being logged on another server.  In order to line them up properly (to know where a noise floor reading came from accurately) the two system clocks must be in sync.

So today I finally got this setup and working properly on the GPS connected server following the directions noted in the link above.

--------

The next task is to get the Odroid to use the TK1 (the one with the GPS/NTP setup now) as it's NTP server.  Thus keeping the two systems in time sync.

UPDATE this is completed, and working.  Both servers time are being kept in sync using NTP and the TK1 is getting it's time from the GPS.  Case close.  Whew...VERY cool!  And fairly simple.

SERVER (GPS attached) SIDE /etc/ntp.conf

pool us.pool.ntp.org iburst

driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 mask 255.255.255.0
restrict -6 ::1
restrict 10.0.1.0 mask 255.255.255.0 nomodify notrap

# GPS Serial data reference
server 127.127.28.0
fudge 127.127.28.0 time1 0.9999 refid GPS

# GPS PPS reference
server 127.127.28.1 prefer

fudge 127.127.28.1 refid PPS

CLIENT SIDE /etc/ntp/conf
(Similar to the installed version with one line change)

driftfile /var/lib/ntp/ntp.drift
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
# Use Ubuntu's ntp server as a fallback.
server 10.0.1.2
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1




Thursday, January 29, 2015

MFJ-5008 - Followup

The MFJ-5008 (purchase here) (view my photos here from a prvious post) has proven to be a solid bit of gear.  I had my suspicions when I bought it as to whether it would even work.  However, it works, and works very well!  I have used it while wearing a pair of Beats "Solo" headphones and seems to work well with them.

One of the things I'm trying to work out now is how to record the audio from a location to later analyze it.  I found an app that runs on my Android Smart Phone that should do the trick.  However, I also needed a USB sound card (dongle) that will plug into an OTG cable from the phone.  I bought on this week for about $7.00 on Amazon that is known to work with the app I'm going to try first.  The app cost almost $7.00 on google play.  SO for about $14.00 US I have a nice audio recorder (that also has a built in gps, and camera :-).

All very useful tools for recording the location of power line noise.

The idea is to setup the phone's app and the usb sound card, and connect the sound card to the audio output of the  MFJ-5008 to record the sound of noise.  

Once I have that recorded, I should be able to compare the noise signatures between what I'm hearing at home vs. what I recorded.  They won't be exactly alike...but should help in locating offending poles.

The important thing I'm trying to accomplish with all of this is to identify the noise sources I'm hearing from home and get ONLY those fixed.  That way my problem goes away, and the power company isn't chasing every single noisy bit on their system.  While they're not supposed to be creating this noise, I can't very well have them productively resolving MY ISSUES by fixing every single issue THEY HAVE.  I just need the ones I'm hearing fixed.

Anyway, I just wanted to post a bit about my next phase of plans with the MFJ-5008.

Now that I know most of the really noisy locations in town, I'd like to 'go out on rounds' and check them every day for say 2 wks and make recording of them...combined with weather data I believe that should prove to be quite useful and show more than due diligence on my part to getting this problem resolved.

I would like to mention also that so far it's been almost 2 weeks since I first sent my request to Ameren UE requesting a ticket and reply from them regarding what I knew about the local power line noise and so far I haven't had a single reply from them.  

I will try to call them on the phone in my next round of attempts.  If that fails to get a ticket number, I will send them registered (return receipt letters).  One way or another I'll get their attention.  There are a LOT more options if that doesn't succeed.

The last time I did with with Ameren they replied within 24 hours and had a truck out at my house.  This time seems different so far.  SO we'll see.

Friday, January 23, 2015

New Pole Found Ameren 570032

Found this pole buzzing on AM 1700 , as well as 50.1 144.2 and 432.1 mhz.
The street lamp is barely glowing and its dark out now for one hour.
Ultrasonic detector buzzes when spot on the street lamp.