{"id":1486,"date":"2015-09-04T17:13:01","date_gmt":"2015-09-04T21:13:01","guid":{"rendered":"https:\/\/blogs.mathworks.com\/iot\/?p=1486"},"modified":"2018-12-07T15:38:01","modified_gmt":"2018-12-07T20:38:01","slug":"analyzing-cheerlights-with-matlab","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/iot\/2015\/09\/04\/analyzing-cheerlights-with-matlab\/","title":{"rendered":"Analyzing CheerLights with MATLAB"},"content":{"rendered":"<p><a href=\"http:\/\/www.cheerlights.com\" target=\"_blank\" rel=\"noopener\">CheerLights<\/a> is an <em>Internet of Things<\/em> project created by <a href=\"http:\/\/www.nothans.com\" target=\"_blank\" rel=\"noopener\">Hans Scharler<\/a> that allows people&#8217;s lights all across the world to synchronize to one color set by Twitter. This is a way to connect physical things with social networking experiences and spread cheer at the same time. When one light turns red, they all turn red.<\/p>\n<p style=\"text-align: center;\"><script type='text\/javascript'>  \nwindow.onload = document.write(\"<iframe width='560' height='345' marginwidth='0' marginheight='0' scrolling='no' frameborder='0'  src='http:\/\/www.youtube.com\/embed\/7eCgA4oEN6g?rel=0' ><\/iframe> \"); \n <\/script><\/p>\n<p>CheerLights uses <a href=\"https:\/\/thingspeak.com\" target=\"_blank\" rel=\"noopener\">ThingSpeak<\/a> to collect the latest color. We get the color value by following &#8220;CheerLights&#8221; on Twitter using the TweetControl app. When someone Tweets using &#8220;CheerLights&#8221; and a color name, the TweetControl app writes the color to the <a href=\"https:\/\/thingspeak.com\/channels\/1417\" target=\"_blank\" rel=\"noopener\">CheerLights Channel<\/a> on ThingSpeak. Other developers\u00a0wanting to join the CheerLights project read in the latest color value using\u00a0the <a href=\"http:\/\/api.thingspeak.com\/channels\/1417\/field\/1\/last.txt\" target=\"_blank\" rel=\"noopener\">ThingSpeak Channel API<\/a> and then set their light\u00a0color to the same one.<\/p>\n<p>With some <a href=\"httpss:\/\/thingspeak.com\/apps\" target=\"_blank\" rel=\"noopener\">MATLAB<\/a> Analysis and Visualizations, I know that currently red is the most popular color on CheerLights! I have recently taken advantage of the MATLAB integration with ThingSpeak. Under Apps -&gt; MATLAB Analysis, we have an example that will show you how to analyze the public CheerLights Channel on ThingSpeak to determine the most requested color. The MATLAB Analysis example is called, &#8220;Analyze text for the most common color&#8221;.<\/p>\n<p style=\"text-align: center;\"><script type='text\/javascript'>  \nwindow.onload = document.write(\"<iframe width='600' height='440' marginwidth='0' marginheight='0' scrolling='auto' frameborder='0'  src='https:\/\/thingspeak.com\/apps\/matlab_visualizations\/19889?width=auto' ><\/iframe> \"); \n <\/script><\/p>\n<p><strong>Example MATLAB Visualization Code<\/strong><\/p>\n<pre class=\"prettyprint lang-matlab\">lights = thingSpeakRead(1417,'OutputFormat','table','NumDays',30);\r\nhist(categorical(lights.LastCheerLightsCommand))\r\nset(gca,'XTickLabelRotation',45)<\/pre>\n<p><a href=\"https:\/\/thingspeak.com\/channels\/1417\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1505 size-full\" src=\"https:\/\/blogs.mathworks.com\/iot\/wp-content\/blogs.dir\/15\/files\/2015\/09\/CheerLights_MATLAB_Histogram.png\" alt=\"CheerLights MATLAB Histogram\" width=\"559\" height=\"419\" \/><\/a><\/p>\n<p>People all over the world have joined CheerLights\u00a0by making all kinds of light displays, apps, and browser plugins.\u00a0I recently created a CheerLights display for my parents using a <a href=\"http:\/\/nothans.com\/cheerlights-with-lifx-led-light-bulb\" target=\"_blank\" rel=\"noopener\">LIFX Wi-Fi Light Bulb<\/a>. If you want to control all of the lights, just send a Tweet using Twitter that mentions <a href=\"https:\/\/www.twitter.com\/cheerlights\" target=\"_blank\" rel=\"noopener\">@CheerLights<\/a> and a color.<\/p>\n<p style=\"text-align: center;\"><b>\u201c@CheerLights Let\u2019s go Blue!\u201d<\/b><\/p>\n<p>Check out <a href=\"http:\/\/www.cheerlights.com\" target=\"_blank\" rel=\"noopener\">CheerLights.com<\/a> for more detail and for\u00a0ideas on how to join the project. We are all connected!<\/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\/2015\/09\/CheerLights_MATLAB_Histogram.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>CheerLights is an Internet of Things project created by Hans Scharler that allows people&#8217;s lights all across the world to synchronize to one color set by Twitter. This is a way to connect&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/iot\/2015\/09\/04\/analyzing-cheerlights-with-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":[141,60,209,81,31,98],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/1486"}],"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=1486"}],"version-history":[{"count":14,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/1486\/revisions"}],"predecessor-version":[{"id":2568,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/1486\/revisions\/2568"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/media?parent=1486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/categories?post=1486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/tags?post=1486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}