{"id":1641,"date":"2016-02-05T22:17:02","date_gmt":"2016-02-06T03:17:02","guid":{"rendered":"https:\/\/blogs.mathworks.com\/iot\/?p=1641"},"modified":"2016-02-11T21:59:43","modified_gmt":"2016-02-12T02:59:43","slug":"uber-ride-analysis-with-thingspeak-and-matlab","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/iot\/2016\/02\/05\/uber-ride-analysis-with-thingspeak-and-matlab\/","title":{"rendered":"Uber Ride Analysis with ThingSpeak and MATLAB"},"content":{"rendered":"<p>Have you ever wondered how long it will take to get an Uber at\u00a0your location? This project uses <a href=\"https:\/\/thingspeak.com\/\">ThingSpeak<\/a> to log the ETA for an Uber service based on your latitude and longitude. We will use ThingSpeak&#8217;s MATLAB Analysis and TimeControl apps to track Uber&#8217;s\u00a0ETA over time.<\/p>\n<p><a href=\"https:\/\/www.hackster.io\/nothans\/uber-ride-analysis-with-thingspeak-and-matlab-1715eb\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1642\" src=\"https:\/\/blogs.mathworks.com\/iot\/wp-content\/blogs.dir\/15\/files\/2016\/02\/Uber_Ride_Estimate.png\" alt=\"Uber Ride Estimate\" width=\"600\" height=\"381\" \/><\/a><\/p>\n<p>The Uber API allows you to pass a latitude and longitude to determine the estimated time of arrival for an Uber car. The API also allows you to schedule a car. I have made a button that requests an Uber car and also schedules an Uber at the right time.<\/p>\n<p><strong>MATLAB Analysis Code<\/strong><\/p>\n<pre class=\"prettyprint lang-matlab\">% Read the ThingHTTP for 'Uber Ride Estimate'\r\ndata = webread('https:\/\/api.thingspeak.com\/apps\/thinghttp\/send_request?api_key=XXX')\r\n\r\n% Convert the response to a number\r\neta = str2num(data);\r\n\r\n% Write the data to the 'Uber Ride Estimate Data' ThingSpeak Channel\r\nthingSpeakWrite(Channel_ID,eta,'WriteKey','XXX');<\/pre>\n<p>Each time the MATLAB Analysis code is executed, it will write the estimated time of arrival (ETA) for Uber to your ThingSpeak channel. To track the ETA over time, schedule the MATLAB code with TimeControl. I am running the code every 5 minutes to get an idea of when the peak times are for Uber to pick me up at my office in Natick, MA. Check out the ThingSpeak channel number <a href=\"https:\/\/thingspeak.com\/channels\/84070\" target=\"_blank\">840700<\/a> to see the estimated times.<\/p>\n<p><a href=\"https:\/\/www.hackster.io\/nothans\/uber-ride-analysis-with-thingspeak-and-matlab-1715eb\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1643\" src=\"https:\/\/blogs.mathworks.com\/iot\/wp-content\/blogs.dir\/15\/files\/2016\/02\/Uber_Ride_Estimate_Data.png\" alt=\"Uber_Ride_Estimate_Data\" width=\"486\" height=\"344\" \/><\/a><\/p>\n<p>Step-by-step project details are available at <a href=\"https:\/\/www.hackster.io\/nothans\/uber-ride-analysis-with-thingspeak-and-matlab-1715eb\" target=\"_blank\">Hackster.io<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/iot\/wp-content\/blogs.dir\/15\/files\/2016\/02\/Uber_Ride_Estimate.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Have you ever wondered how long it will take to get an Uber at\u00a0your location? This project uses ThingSpeak to log the ETA for an Uber service based on your latitude and longitude. We will use&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/iot\/2016\/02\/05\/uber-ride-analysis-with-thingspeak-and-matlab\/\">read more >><\/a><\/p>\n","protected":false},"author":148,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[223,209,239,188],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/1641"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/users\/148"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/comments?post=1641"}],"version-history":[{"count":14,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/1641\/revisions"}],"predecessor-version":[{"id":1723,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/1641\/revisions\/1723"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/media?parent=1641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/categories?post=1641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/tags?post=1641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}