<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Madhan Sundaram on Medium]]></title>
        <description><![CDATA[Stories by Madhan Sundaram on Medium]]></description>
        <link>https://medium.com/@madhan5000?source=rss-10416c0001bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wJy7nPkve_Ny4oEB.jpg</url>
            <title>Stories by Madhan Sundaram on Medium</title>
            <link>https://medium.com/@madhan5000?source=rss-10416c0001bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 08:58:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@madhan5000/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[“Hey Google Turn on Front light” — set up and code]]></title>
            <link>https://medium.com/@madhan5000/hey-google-turn-on-front-light-set-up-and-code-54e184271168?source=rss-10416c0001bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/54e184271168</guid>
            <category><![CDATA[node-red]]></category>
            <category><![CDATA[google-home]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Madhan Sundaram]]></dc:creator>
            <pubDate>Fri, 08 Sep 2017 19:42:29 GMT</pubDate>
            <atom:updated>2017-09-08T19:42:29.590Z</atom:updated>
            <content:encoded><![CDATA[<p>Google home plays well with IFTTT service. As mentioned in my <a href="https://medium.com/@madhan5000/hey-google-turn-on-front-light-42df9f02b2e4">previous article</a>, my set up looks like this</p><p>Google Home -&gt; IFTTT -&gt;Dataplicity -&gt; Local RPi <strong>(Nginx)</strong>-&gt; NodeRED -&gt; MQTT -&gt; Slampher -&gt; Light bulb</p><p><strong>Bridging Dataplicity and NodeRED:</strong></p><p>First get nginx server installed with</p><blockquote>sudo apt-get install nginx</blockquote><p>Once nginx is installed, you can access the configuration at</p><blockquote>/etc/nginx/sites-enabled/default</blockquote><p>you can modify to look like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e70361acbc31b2c49b1f1dbd5ea22c6b/href">https://medium.com/media/e70361acbc31b2c49b1f1dbd5ea22c6b/href</a></iframe><p>Restart nginx</p><blockquote>sudo service restart nginx</blockquote><p>Now your RPI accessible via the internet. Try hitting</p><blockquote>https://&lt;wormholeurl&gt;.dataplicity.io/</blockquote><p>You should get default Nginx welcome screen.</p><p><strong>Bridging Node-Red and MQTT :</strong></p><p>There are many ways to do it. The basic principle is to convert web request to MQTT command to control your device. Here is one way of doing it.</p><p>First, we need to configure node-red to accept HTTP requests. In this case I am going to use</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*NSmLY7DTLppwhPGmDPe_yA.png" /></figure><p>configure “http” palette this way. Select POST from the dropdown and choose any word for URL and any word for Name. They don’t have to match. Remember the URL, it needs to match with the Nginx conf (mentioned above). In this case I am using the word “incoming”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*oVeOS9VukhhbNbvlppRBrg.png" /></figure><p>Node-red by default is configured to accept MIME-Type “application-json” playload. Here is the JSON payload that will be sent to our Node-Red server from IFTTT service.</p><blockquote>{“topic”:”sensor/LIGHT_1/command”,”payload”:”ON”}</blockquote><p>Any client doing HTTP request needs acknowledgement from the HTTP server. Normally known as 200 response. Node-red’s “http-response” sends a 200 by default. So add that to your flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*SXjROuIB2D6O6pd_5UyqQg.png" /></figure><p>Now, here is the part where you need to adapt to your MQTT configuration.</p><p>I used a function block to convert the incoming HTTP request to MQTT command. Here is the code to do that.</p><blockquote>var ret = {topic:msg.payload.<strong>topic</strong>,payload:msg.payload.<strong>payload</strong>}<br>return ret;</blockquote><p>It might be little confusing as I am using the same terminology topic and payload in my JSON. You can choose any word and make appropriate changes in the function block. For example,</p><blockquote>{“<strong>X</strong>”:”sensor/LIGHT_1/command”,”<strong>Y</strong>”:”ON”}</blockquote><blockquote>var ret = {topic:msg.payload.<strong>X</strong>,payload:msg.payload.<strong>Y</strong>}<br>return ret;</blockquote><p>here is what it looks like. The transformed JSON is now sent to MQTT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*YU7TcxAqZlhtgUYO5je61w.png" /></figure><p>So the above flow acts like a pass through. As you can tell I have a channel in my MQTT device</p><blockquote>sensor/LIGHT_1/command</blockquote><p>My code on the device is watching this channel to get its commands. In this case my command is</p><blockquote>ON</blockquote><p>Deploy your flow and you can send commands to your device via PostMan chrome extension. or Curl command if you like command line.</p><p><strong>Bridging IFTTT and LocalRPI via Dataplicity :</strong></p><p>IFTTT is the final piece in the puzzle, IFTTT’s Goolge assistant Applet lets you connect with your Google Home. IFTTT’s webhooks can invoke any URL with a GET or a POST request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*zS4rKX8Y0TyoaLTJThDVOQ.png" /></figure><p>The cool thing is, it works from your phone too !! with Google Assistant of course.</p><p><strong>Bonus : Accessing node-red admin remotely</strong></p><p>Edit nginx configuration</p><blockquote>/etc/nginx/sites-enabled/default</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce4b24af320bad280afe35865d9a7384/href">https://medium.com/media/ce4b24af320bad280afe35865d9a7384/href</a></iframe><p>now restart nginx</p><blockquote>sudo service restart nginx</blockquote><p>make sure you secure your node-red with a strong password first</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/748956b38f35b962434be5bc6a1b20c1/href">https://medium.com/media/748956b38f35b962434be5bc6a1b20c1/href</a></iframe><p>now try to hit your dataplicity.io url</p><blockquote>https://&lt;wormholeurl&gt;.dataplicity.io/admin</blockquote><p>I hope you find this useful. Happy IOTing until next time !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54e184271168" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Raspberry PI + Google TV (Logitech Revue) keyboard (Logitech K700)]]></title>
            <link>https://medium.com/@madhan5000/raspberry-pi-google-tv-logitech-revue-keyboard-logitech-k700-569bc4d43e9b?source=rss-10416c0001bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/569bc4d43e9b</guid>
            <category><![CDATA[logitech]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Madhan Sundaram]]></dc:creator>
            <pubDate>Sat, 22 Jul 2017 02:55:24 GMT</pubDate>
            <atom:updated>2017-07-22T02:55:24.178Z</atom:updated>
            <content:encoded><![CDATA[<p>I was one of those who got excited about Google TV (Logitech Revue) bought one to find out in less than a year Google discontinued its support and came out with Chromecast. When I got the chromecast my google tv started collecting dust. Since then I have been wanting to use the keyboard (Logitech K700) that came with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*18VqTbEKqXmuAVor64H3ww.jpeg" /></figure><p>recently I discovered that it works with Logitech’s unifying receiver but I hadn’t thought of using it with Raspberry Pi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*QtJZLdrGxMiMog9Po3e6mw.jpeg" /><figcaption>Logitech Unifying Receiver</figcaption></figure><p>I was also not sure if it would work with it. I bit the bullet and bought one recently on Amazon. I had read online people having great success without requiring any additional software. So I was eager to try it.</p><p>As soon as it arrived I plugged it to RPi but it didn’t work initially. There was no light on the receiver either to indicate any type of communication. Then I plugged in to my Mac, had to install software (found on logitech website) it instantly paired with K700.</p><p>At this point I was googling to see what folks had done for it to work with RPI. I found a comment on this thread <a href="https://plus.google.com/+AlexandreRoman/posts/aPu7G9F7ekb">https://plus.google.com/+AlexandreRoman/posts/aPu7G9F7ekb</a></p><blockquote>Pair the keyboard and reciever first on another computer first if you have not already. I have my logitech revue keyboard working nicely with a logitech unifying receiver on the pi</blockquote><p>Well that is what I just did !!. Now came moment of truth. I plugged it in to RPI and Viola ! it worked. I hope some one will find this tip useful !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=569bc4d43e9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Home + IFTTT + Dataplicity + Local RPi + NodeRED + MQTT + Slampher + Light bulb = “Hey…]]></title>
            <link>https://medium.com/@madhan5000/hey-google-turn-on-front-light-42df9f02b2e4?source=rss-10416c0001bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/42df9f02b2e4</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[dataplicity]]></category>
            <category><![CDATA[google-home]]></category>
            <category><![CDATA[ifttt]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Madhan Sundaram]]></dc:creator>
            <pubDate>Tue, 10 Jan 2017 04:01:20 GMT</pubDate>
            <atom:updated>2017-09-09T14:11:43.894Z</atom:updated>
            <content:encoded><![CDATA[<h3>Google Home + IFTTT + Dataplicity + Local RPi + NodeRED + MQTT + Slampher + Light bulb = “Hey Google, Turn on my front light”</h3><p>Ever since I bought my <a href="https://madeby.google.com/home/">Google home</a> I have been wanting to control my devices at home using voice commands. I am an IOT enthusiast I have been playing with <a href="https://en.wikipedia.org/wiki/ESP8266">ESP8266</a> wifi chip for few months now. I connected my garage to wifi and I was able to open and close my garage using my phone. There are many examples and implementations out there. Most of them use a cloud service (<a href="https://github.com/mqtt/mqtt.github.io/wiki/public_brokers">Free</a>/<a href="https://www.cloudmqtt.com/">Paid</a> MQTT services) and an app like <a href="https://www.wemustbegeeks.com/esp8266-nodemcu-relay-wifi-garage-door-opener/">Blynk</a>. Some have their local Raspberry pi exposed via Dynamic DNS service.</p><p>I am not a big fan of using a cloud service for this purpose. Most of the free services I used either did not support MQTTs or it was hard to configure or worse not reliable. I was leaning more toward the local Raspberry Pi solution as I was running MQTT service on my RPi but I didn’t want to deal with installing SSL certs or exposing my RPi via Dynamic DNS service.</p><p>The main reason I wanted my RPi to be accessible via internet is to be able to send commands via my Google home. Google home has great integration with IFTTT service. More about it later.</p><p>I recently stumbled up on a very cool service <a href="https://dataplicity.io/">Dataplicity.io</a> via <a href="http://lifehacker.com/dataplicity-drastically-simplifies-remote-management-of-1790053204">Lifehacker</a> and I wrote about it <a href="https://medium.com/@madhan5000/raspberry-pi-dataplicity-io-mqtt-9493cca0d296#.8tee07qxh">here</a>. Dataplicity simplified the part I dreaded the most. SSL certificates and placing my RPi securely on the internet.</p><p>So here is how I achieved my goal of Turning ON and OFF my front light via voice command. First I had to connect my light bulb to Wifi. There are few <a href="http://www.lifx.com/products/lifx?variant=30732331715">commercial</a> solutions out there which costs around $40 (USD). Being a fan of ESP8266 I found a cheap light holder called <a href="https://www.itead.cc/slampher.html">Slampher</a>. I figured I could achieve the same result with just $8.50 (at the time of writing) than spend $40. There are couple of <a href="https://www.youtube.com/watch?v=obDE0J5AiVU">youtube videos</a> and <a href="http://tech.scargill.net/tag/slampher-and-sonoff-from-itead/">blog posts</a> out there on how to hack Slampher and connect it to local network.</p><p>Once I had Slampher with custom firmware and talking MQTT on my local Wifi then I had to figure how to send commands via Google home. Google home works well with IFTTT. You can configure <a href="https://ifttt.com/google_assistant">Google assistant applets</a> and connect it to <a href="https://ifttt.com/maker">Maker channel</a> in IFTTT. The missing link was IFTTT maker channel is capable of making HTTPs POST requests to an URL you provide but my devices talk MQTT not HTTP. I knew I could run a webserver on my RPi and using Dataplicity’s <a href="https://docs.dataplicity.com/docs/host-a-website-from-your-pi">wormhole</a> to create a secure end point. I needed a way to convert HTTP request to MQTT.</p><p>At first, I thought I would use Mosquitto service’s <a href="https://blog.benjamin-cabe.com/2015/10/01/how-to-run-your-web-server-and-mqtt-websockets-broker-on-the-same-port">HTTP mode</a> but I also wanted general automation and be able to configure other services as well. I had previously played with <a href="https://home-assistant.io/">HomeAssistant</a>. But I found HomeAssistant’s YAML based configuration counter intuitive. While searching for a reliable cloud MQTT service I had stumbled up on IBM’s <a href="http://nodered.org/">NodeRED</a>. I played with a little bit and really liked its simplicity. I was convinced it was the way to go and it could act as the missing link.</p><p>Here is how it looks today. Google Home -&gt; IFTTT -&gt;Dataplicity -&gt; Local RPi -&gt; NodeRED -&gt; MQTT -&gt; Slampher -&gt; Light bulb. I was also able to automate so the light turns ON at a certain time and OFF at a certain time. I will share my code samples in my next post ! Until then Happy IOTing !</p><p>Update : Much promised code here in my next article</p><p><a href="https://medium.com/@madhan5000/hey-google-turn-on-front-light-set-up-and-code-54e184271168">“Hey Google Turn on Front light” — set up and code</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42df9f02b2e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Raspberry PI + Dataplicity.io + MQTT]]></title>
            <link>https://medium.com/@madhan5000/raspberry-pi-dataplicity-io-mqtt-9493cca0d296?source=rss-10416c0001bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/9493cca0d296</guid>
            <category><![CDATA[dataplicity]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[mqtt]]></category>
            <dc:creator><![CDATA[Madhan Sundaram]]></dc:creator>
            <pubDate>Mon, 19 Dec 2016 20:30:51 GMT</pubDate>
            <atom:updated>2016-12-19T20:43:06.772Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently stumbled up on a very cool service <a href="https://dataplicity.io/">Dataplicity.io</a> via <a href="http://lifehacker.com/dataplicity-drastically-simplifies-remote-management-of-1790053204">Lifehacker</a>. I quickly signed up and I was able to access my Raspberry Pi in minutes. One feature that caught my eye was <a href="https://docs.dataplicity.com/docs/host-a-website-from-your-pi">Wormwhole</a> ! I immediately thought about accessing my MQTT server running on RPi over the web without the hassle of opening a port on the router and Dynamic Dns configurations.</p><p>I reached out to folks at Dataplicity via their nifty chat. Elliot and Radoslaw responded very quickly and pointed me in right direction. They told me</p><blockquote>Anything that can be encapsulated in a websocket can be (potentially) transmitted over wormhole.</blockquote><p>I did bit of Googling to find out if folks have already done such this. There are few good articles out there. I tried few suggestions and nothing seemed to work. Finally, I stumbled up on this <a href="http://stackoverflow.com/questions/36521858/nginx-reverse-proxying-wss-client-sent-invalid-method-while-reading-client-req">stack-overflow</a> post. With a bit of trial and error I got it to work.</p><p>Here is the gist for ngnix.conf</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b5fd22e13c9497e9794af1b2f32c2cb/href">https://medium.com/media/7b5fd22e13c9497e9794af1b2f32c2cb/href</a></iframe><p>make sure your Mosquitto server has websockets enabled</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0556a13d61b7100fd11a83ff6cde01f9/href">https://medium.com/media/0556a13d61b7100fd11a83ff6cde01f9/href</a></iframe><p>here comes the fun part. After restarting ngnix and mosquitto (after config changes) came the testing part. Again, I Googled for potential webclients and found<a href="https://gist.github.com/matbor/9825309"> this gist</a>. I modified it a little bit and here is the final version that worked.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b251023d5c58f62ef203f2f9383f857/href">https://medium.com/media/2b251023d5c58f62ef203f2f9383f857/href</a></iframe><p>The cool part is, I didn’t have to mess with ca-certs for mosquitto either. It is my understanding that the connection till local ngnix server on your RPi is secure (Thanks to Datapilicity). Then local nginix forwards traffic to local mosquitto installation.</p><p>Now that I have done this, I am going to mess with IFTTT maker channel to send commands to my MQTT on local RPi. Happy IOTing !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9493cca0d296" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Puzzle Hack !]]></title>
            <link>https://medium.com/@madhan5000/the-puzzle-hack-9389786f5d4c?source=rss-10416c0001bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/9389786f5d4c</guid>
            <category><![CDATA[kids]]></category>
            <category><![CDATA[puzzle]]></category>
            <category><![CDATA[family]]></category>
            <dc:creator><![CDATA[Madhan Sundaram]]></dc:creator>
            <pubDate>Mon, 08 Feb 2016 17:14:03 GMT</pubDate>
            <atom:updated>2016-02-08T17:14:03.356Z</atom:updated>
            <content:encoded><![CDATA[<p>Sunday Mornings are “puzzle day” at our home. My daughter (5 yrs) decided to do “Minne and Daizy”. We as a family have done this together many times. The skill level required is intermediate (IMHO). When my wife: who wanted to see how well my daughter does it on her own said, “We have done this puzzle many times, why don’t you do it yourself?”.</p><p>My daughter enthusiastically agreed but in few mins called out “Mom, I need help!”. My wife was patient and said “You can figure this out yourself” only to hear “Mom, I can’t figure this out, can you please help?”. Then she sat down with my daughter and said, “Ok pick up all the corner pieces and they have a flat edge” and my daughter picked one and that’s it. She seemed to find it difficult to find the next corner piece. I could sense the tension escalating. I was thinking of quick way to solve this but did not want to intervene. (We have a policy at home not to intervene when one parent is engaging the child).</p><p>I had an idea, I shared with my wife and she readily agreed to try it out. We swapped places and I realized my daughter was getting confused with the pile of puzzle pieces. My wife and I agreed she needed a methodical way but we didn’t know what that method was. I suggested instead of a pile we need to put it in a stack and ask her to pick one by one and also make it easier to identify a corner and edge piece first. I was thinking of a stencil and my wife suggested “why don’t you make your own”. So I took a paper and pen and drew out a corner and edge piece on a paper.</p><p>So now we had a stencil, a stack of puzzle pieces. I asked my daughter to pick one by one from the top of the stack and compare it to the stencil. Vola, she loved the idea !!. One by one she took the puzzle piece and she was able to say out loud which was a corner piece and which were middle and edge piece. We used the completed picture as a reference to make sure each piece went in approximate locations first and then joined them later.</p><p>We were all happy at this point. I realized we had essentially hacked our way to find an optimal solution which worked for all of us. I had one big question in my head. Is this process repeatable ? I often think a problem is completely solved only if doesn’t resurface again. If the problem resurfaces after some time we need to think of a better solution or combination of solutions.</p><p>We repeated the same method to another puzzle and couple of weeks later and here are few pictures from that session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EoBfF3W90PutBFs3ruckAw.jpeg" /><figcaption>Stencil</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mxMhTwN_c0p5G0eGbDA8Ug.jpeg" /><figcaption>The Stack !!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MwR7FknBKRws-VnPVk3loQ.jpeg" /><figcaption>Edge pieces</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o3SMttQulSRB1Srmwj0C4w.jpeg" /><figcaption>Corner pieces</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D2cw-2abDbyXl5jA4NXZxw.jpeg" /><figcaption>The reference</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K60s_qjDK173tFOkofQo8g.jpeg" /><figcaption>Completed Puzzle !!</figcaption></figure><p>I would love to hear your “Hack” !!. What hack works (worked) for your family?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9389786f5d4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>