{"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":"
Have you ever wondered how long it will take to get an Uber at\u00a0your location? This project uses ThingSpeak<\/a> to log the ETA for an Uber service based on your latitude and longitude. We will use ThingSpeak’s MATLAB Analysis and TimeControl apps to track Uber’s\u00a0ETA over time.<\/p>\n 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 MATLAB Analysis Code<\/strong><\/p>\n 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 840700<\/a> to see the estimated times.<\/p>\n Step-by-step project details are available at Hackster.io<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" 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… 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}]}}
<\/a><\/p>\n% 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
<\/a><\/p>\n
<\/div>\n