{"id":777,"date":"2015-08-17T16:08:16","date_gmt":"2015-08-17T23:08:16","guid":{"rendered":"http:\/\/internetofhomethings.com\/homethings\/?p=777"},"modified":"2015-09-16T07:35:46","modified_gmt":"2015-09-16T14:35:46","slug":"mobile-web-sensors-using-esp8266-phase-3-google-map-and-excel-visualizations","status":"publish","type":"post","link":"https:\/\/internetofhomethings.com\/homethings\/?p=777","title":{"rendered":"Mobile Web Sensors Using ESP8266 &#8211; Phase 3: Google Map Visualizations"},"content":{"rendered":"<p>This is a continuation of the &#8220;Mobile Web Sensors Using ESP8266&#8221; series.<\/p>\n<p><a href=\"http:\/\/wp.me\/p5NRQ8-b9\" target=\"_blank\">Mobile Web Sensors Using ESP8266 &#8211; Phase 1<\/a><br \/>\n<a href=\"http:\/\/wp.me\/p5NRQ8-cf\" target=\"_blank\">Mobile Web Sensors Using ESP8266 &#8211; Phase\u00a02<\/a><\/p>\n<h3 style=\"text-align: center;\"><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/bicycling_1439836975.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-785\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/bicycling_1439836975.jpg\" alt=\"\" width=\"640\" height=\"457\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/bicycling_1439836975.jpg 640w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/bicycling_1439836975-300x214.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/h3>\n<h3 style=\"text-align: center;\"><strong>Google Map and Excel Visualizations<\/strong><\/h3>\n<p>This is where things get interesting. I just got back from a yoga class. This was a simple 4 mile bicycle trek across town; a perfect opportunity to collect some data using the Mobile Sensor System.<\/p>\n<p>For this test run. a USB battery was used to power the ESP8266-12 based device. I simply plugged a USB cable in to powered it up, stuffed it into a fanny pack, connected my Android phone to the device&#8217;s\u00a0WIFI signal and started the App.<\/p>\n<p>I could tell it was working by observing the UTC time change rapidly on the phone app&#8217;s GUI. Another look at the display upon arrival at my destination confirmed that the data collection was still \u00a0running. Success!<\/p>\n<p>But the raw data file was not in a very human readable form:<\/p>\n<pre>timestamp,lat,lon,spd,alt,btmp,dtmp,bp,dh,syst,sysh,syslp\r\n1439830613611,34.2943768,-118.8439855,null,null,80.6,57.79,29.23,50.70,120,30840,37\r\n1439830614632,34.2943768,-118.8439855,null,null,80.6,57.90,29.23,50.59,121,30840,38\r\n1439830615646,34.2943715,-118.8439865,null,null,80.24,57.90,29.23,50.59,122,31280,39\r\n1439830618611,34.2945713,-118.8441038,0,180,80.24,57.90,29.23,50.50,125,30832,42\r\n1439830619607,34.2945664,-118.8441046,0,180,80.24,57.90,29.23,50.50,126,31280,43\r\n1439830621616,34.2945921,-118.8441143,0,181,80.42,57.90,29.24,50.50,128,30840,45\r\n1439830625549,34.2945638,-118.8440880,0,175,80.42,57.90,29.23,50.40,132,30840,49\r\n1439830625649,34.2945638,-118.8440880,0,175,80.42,57.90,29.23,50.40,132,30840,49\r\n1439830627653,34.2945510,-118.8440810,0,175,80.60,57.90,29.23,50.40,134,31280,51\r\n1439830630563,34.2945510,-118.8440807,0,175,80.60,58.0,29.23,50.79,136,31280,53\r\n1439830631631,34.2945508,-118.8440805,0,175,80.60,58.0,29.23,50.70,138,29112,55\r\n<\/pre>\n<p>Collecting this sensor data and saving it to a file\u00a0was an important step. And now, the next thing to do was\u00a0to present the data in a visually useful format. I had intended to import the CSV file containing the data into Excel. However, while creating custom Excel spreadsheet charts and graphs was\u00a0a\u00a0quick and simple method of visualizing the data, my first approach was to seek out possible\u00a0on-line tools already available\u00a0for this purpose.<\/p>\n<p>So the search began. It did not take long to find a way to import the spreadsheet into google maps. But would it be simple? would I have to crop out the latitude and longitude values from my data file for the mapping program to use it?<\/p>\n<p>I was\u00a0surprised at how easy it was&#8230;<\/p>\n<p>The web site was\u00a0<a href=\"http:\/\/www.gpsvisualizer.com\/\" target=\"_blank\">www.gpsvisualizer.com<\/a>.<\/p>\n<p>After opening a web browser to that site, you simply click on &#8220;Choose File&#8221; and select the csv file created from the Android App.<\/p>\n<p>Then, just click on &#8220;Go&#8221; and a satellite map with the tracks from the data appears.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-779\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2.jpg\" alt=\"Googlemap2\" width=\"432\" height=\"388\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2.jpg 432w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-300x269.jpg 300w\" sizes=\"auto, (max-width: 432px) 100vw, 432px\" \/><\/a><\/p>\n<p>No changes to the csv file were needed. What a great tool! It figured out the appropriate data fields for lat &amp; long and overlay-ed them on the map with a red trace.<\/p>\n<p>Okay, what other options are available with this &#8220;GPS Visualizer&#8221;?<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/gpsvisualizer1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-788\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/gpsvisualizer1.jpg\" alt=\"gpsvisualizer1\" width=\"755\" height=\"208\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/gpsvisualizer1.jpg 755w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/gpsvisualizer1-300x83.jpg 300w\" sizes=\"auto, (max-width: 755px) 100vw, 755px\" \/><\/a><\/p>\n<p>The &#8220;Choose an output format&#8221; revealed several image options as well as an elevation profile. The elevation profile looked like it might be interesting&#8230;<\/p>\n<p>But I noticed the default units were meters. Being a US resident, feet are preferred. These units, along with many other options, were select-able by clicking on the link &#8220;Profiles (elevation,etc.)&#8221;.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-790\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-3.jpg\" alt=\"Googlemap2-3\" width=\"492\" height=\"454\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-3.jpg 492w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-3-300x277.jpg 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/a><\/p>\n<p>Here, you could set the X and Y Axis plots to any of the fields shown above. I was stoked to see the list included &#8220;Heart rate&#8221;. My Heart rate sensor will be added to this project at some point soon. Plotting it against elevation change should present some interesting results.<\/p>\n<p>I created a test plot of elevation over distance traveled along this 4-mile route. While any field could be selected, this sample plot colorizes the speed. Again, the plot shows the speed to generally stay below 20 mph, typical for city street bicycling.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-791\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-4.jpg\" alt=\"Googlemap2-4\" width=\"769\" height=\"512\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-4.jpg 769w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-4-300x200.jpg 300w\" sizes=\"auto, (max-width: 769px) 100vw, 769px\" \/><\/a><\/p>\n<p>That steep slope (and slow speed&#8211;red plot color) at about the 3.5 mile distance correlates with the only significant hill climb along the route. Nice to confirm that the data collected makes sense!<\/p>\n<p>But then it hit me. Nice to see that this &#8220;GPS Visualizer&#8221; can portray the GPS data in charts&#8230;but what about the customized sensors? Like temperature, barometric pressure, and the relative humidity? Could this tool also support these unique fields in the plots?<\/p>\n<p>I was pleased to discover that the answer is&#8230;<\/p>\n<p>YES!<\/p>\n<p>Note that the last field in the drop-down above is &#8220;custom&#8221;. Selecting this option allows you to enter any field name. Those are the field names in the first row of the CSV file of the data captured with our mobile sensor system. I selected &#8220;humidity&#8221; for the y-axis as a test case with a colorization of the speed.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-5.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-793\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-5.jpg\" alt=\"Googlemap2-5\" width=\"763\" height=\"515\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-5.jpg 763w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/Googlemap2-5-300x202.jpg 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/a><br \/>\nI was surprised to see the drop in relative humidity from the start to the finish of the ride. It was probably due to the sensor drying out someone with motion. It had been in the controlled, air conditioned environment of the yoga studio at the start and was then exposed to our dry Southern California air.<\/p>\n<p>Looks like this &#8220;GPS Visualizer&#8221; tool will come in handy to produce quick charts from the sensor data.<\/p>\n<p style=\"text-align: center;\"><strong>Visualizations Using Excel<\/strong><\/p>\n<p style=\"text-align: left;\">While most everyone if familiar with excel, this discussion would not be complete without a few chart example produced from the raw CSV file.<\/p>\n<p style=\"text-align: left;\">But when the CSV file was opened using Excel, a couple of issues had to be addressed first before plotting the data.<\/p>\n<ol>\n<li style=\"text-align: left;\">The timestamp field was shown in scientific format. this was corrected by changing the format from &#8220;General&#8221; to &#8220;Number&#8221; with 0 decimal places.<\/li>\n<li style=\"text-align: left;\">The first 3 entries for the spd and alt fields were &#8220;null&#8221;. These were changed to the value of the 4th entry, the first one with valid values. Note: these values came from the GPS API in the Android code. Neither one accurately represents the actual speed and altitude. Yet the google plots were accurate.\u00a0This problem was due to assuming the parameter units incorrectly:\n<ol>\n<li style=\"text-align: left;\">The <strong>altitude<\/strong> was reported in meters. Since we were looking for feet, it must be converted using the scale factor<br \/>\nof\u00a03.28084 feet\/meter. This has now been corrected in the Android App code.<\/li>\n<li style=\"text-align: left;\">The <strong>speed<\/strong> is reported in meters per second.\u00a0Since we were looking for MPH, it must be converted using the scale factor\u00a0of 2.23694 miles\/hour per meter\/second. This has now been corrected in the Android App code.<\/li>\n<li style=\"text-align: left;\">For the evaluation of the data collected in excel, two columns were added to perform the conversion: MPH and altitude.Problem with the speed, however, is that many of the samples returned 0 meters\/sec as the speed. To solve this, I may introduce a new speed algorithm to the mobile app code to convert two GPS coordinates to distance. This distance, along with the change in timestamp values would be used to\u00a0calculate speed.<\/li>\n<\/ol>\n<\/li>\n<li style=\"text-align: left;\">The &#8220;dtmp&#8221; values (temperature as read by the humidity sensor) are incorrect. The temperature starts at 57.79 degrees while the temperature read by the barometric sensor starts at 80.6. It looked to me like the conversion is missing the &#8220;plus 32&#8221; in the ESP8266 code. But a review of the code did not reveal any problems. The conversion did include the required &#8220;plus 32). I would like to hear from anyone else using the DH22 to see if they are all off in temperature or it is just my sensor that is incorrect. For now, the DH22 temperature reading will be discarded as invalid.<\/li>\n<\/ol>\n<p>The first thing I tried was to plot the coordinates over the ESP system time(seconds since reset).<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/excel11.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-803\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/excel11.jpg\" alt=\"excel1\" width=\"475\" height=\"284\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/excel11.jpg 475w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/excel11-300x179.jpg 300w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/a><\/p>\n<p>Problem with this plot is the relatively small change in latitude and longitude. It essentially looks like a straight line. This was easily rectified by plotting the\u00a0latitude and longitude separately.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce2.2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-806\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce2.2.jpg\" alt=\"exce2.\" width=\"460\" height=\"378\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce2.2.jpg 460w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce2.2-300x247.jpg 300w\" sizes=\"auto, (max-width: 460px) 100vw, 460px\" \/><\/a><br \/>\nOkay, and now let&#8217;s plot the elevation again, like we did with the GPS visualizer.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-807\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce3.jpg\" alt=\"exce3\" width=\"469\" height=\"216\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce3.jpg 469w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/08\/exce3-300x138.jpg 300w\" sizes=\"auto, (max-width: 469px) 100vw, 469px\" \/><\/a><br \/>\nYes, this does look the same as the GPS Visualizer. Except colorizing the plot with a 3rd parameter is not an option. Even with just these few sample plots, I am definitely liking the visualizer of standard Excel charts.<\/p>\n<h3 style=\"text-align: center;\"><strong>Conclusion<\/strong><\/h3>\n<p>As you can see, there is more than one option available to visually represent data collected with IoT sensors. And it is worthwhile to investigate tools that may be readily available before attempting to build your own charts, from scratch. Here we just explored a fraction of what is available for this purpose.<\/p>\n<p>Phase 4: Mobile App Gadgets is next. In that post,\u00a0I am going to add some visualizations to the Android application. This will add a real-time visual element to the crude data windows created in phase 1.<\/p>\n<p>I hope you find this information useful&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a continuation of the &#8220;Mobile Web Sensors Using ESP8266&#8221; series. Mobile Web Sensors Using ESP8266 &#8211; Phase 1 Mobile Web Sensors Using ESP8266 &#8211; Phase\u00a02 Google Map and &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10,19],"tags":[58],"class_list":["post-777","post","type-post","status-publish","format-standard","hentry","category-alltheposts","category-esp8266","category-internet-of-things","tag-iot-data-visualizations"],"_links":{"self":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/777","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=777"}],"version-history":[{"count":31,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/777\/revisions"}],"predecessor-version":[{"id":925,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/777\/revisions\/925"}],"wp:attachment":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}