<?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[IMONT Technologies - Medium]]></title>
        <description><![CDATA[Developers of the IMONT SDK — A next-generation tool for device connectivity. https://www.imont.io - Medium]]></description>
        <link>https://medium.com/imont?source=rss----aee62808540a---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>IMONT Technologies - Medium</title>
            <link>https://medium.com/imont?source=rss----aee62808540a---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:44:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/imont" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[IoT: approaching the edge]]></title>
            <link>https://medium.com/imont/iot-approaching-the-edge-e15cee3a4cbf?source=rss----aee62808540a---4</link>
            <guid isPermaLink="false">https://medium.com/p/e15cee3a4cbf</guid>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[edge-computing]]></category>
            <dc:creator><![CDATA[Nigel Pugh]]></dc:creator>
            <pubDate>Sat, 29 Jul 2017 10:10:18 GMT</pubDate>
            <atom:updated>2017-07-29T10:10:17.935Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oPoAkLJhWrnU9PCMPes1Og.jpeg" /></figure><p>Today’s IoT is dominated by the big cloud providers.</p><p>They have amazing infrastructure, hugely complex and efficient management processes, and they process mind-boggling amounts of data every second to keep all our devices talking securely to each other via their servers. IoT would not be here today without them, and of course they are hugely influential within the industry, with products such as the Amazon Echo and Google Home.</p><p>Periodically concerns about privacy of our data in the cloud are raised, but largely we’ve been willing to relinquish a certain amount of our personal data to the cloud in return for the convenience and new experiences it offers us. The cloud giants clearly hope this is a trend that will continue, and for now at least it shows no sign of diminishing.</p><p>If your business has ambitions in the IoT area, it certainly helps if you’re one of those companies who happens to already own a large cloud infrastructure, but what if you don’t? Would those companies really price their cloud services so that you could compete with them by basing a rival service on their cloud infrastructure? IoT is expected to be big business, and the race to dominate the space is well and truly started.</p><p>Most connected ecosystems make heavy use of the cloud as an “always-on” resource that will respond to devices instantly, brokering complex communications over often intermittent infrastructure. The cloud is the one thing you can rely on always being there, right? Well that’s true when its hosting services… but in the IoT the role is reversed. The services are hosted on the devices and the cloud is the “client”. In this case its the device itself where the reliability counts, and, despite best efforts to make the cloud provide a reflection of the current state of the service, its clear that no amount of reliability in the cloud fixes the fundamental role reversal. That reflection may always be there, but is it always up to date?</p><h3>Cloudy skies ahead?</h3><p>Using the cloud to “reflect” the state of remote services has unexpected implications for building out large scale systems containing many millions of devices. It means the cloud has to host an awful lot of “reflections” and has to maintain constant connectivity with the actual devices (services) to ensure they are always up to date. Big providers like AWS and Azure provide out-of-the-box implementations of this to help you scale your system, but at a cost. Of course cloud costs are on a general downward trend, but anyone who has done the calculations knows that today the costs for larger deployments are significant, and of course grow rapidly the more successful you are. Thats good news for cloud owners’ bottom line.</p><p>Another hot topic in IoT is how to secure everything. One downside of “reflecting” everything in the cloud is that a single compromise of the cloud service can potentially offer up control of all the devices connected to it, or at the very least all the data delivered from those services. Of course there are other potential points of compromise, but the cloud service is an obvious one. It’s an always-on point of attack and requires considerable expertise to secure with confidence.</p><p>The concept of ‘edge computing’ — optimizing cloud computing systems by performing data processing at the edge of the network — could provide answers. Today, smartphones and IoT gateways/hubs are remarkably capable compute devices, and the proliferation of these has parallels with the previous slow decline of the mainframe computer in favour of the PC. As this quiet trend progresses there are opportunities to move some processing out of the cloud to “the edge”. This can significantly change the cloud-based cost model, and make the cloud less attractive as a central point to attack.</p><h3>Are the leading cloud providers becoming “edgy”?</h3><p>One telling development is the recent rise of “edge add-ons” from the cloud service providers. These make bold claims about allowing seamless transitioning of cloud code onto edge devices, again, at a price. These are relatively new, and in some cases still in the pre-release phase, so the extent to which these really enhance the related cloud offerings is still being evaluated by the market. The pricing models are still being solidified in some cases too, but it seems clear already that there will be a cost associated with running your cloud code at the edge under these systems.</p><h3>Finding a balance</h3><p>There are many innovative types of connected services and devices emerging on a daily basis. The optimum balance between cloud-centric and edge computing is different for each one, and its highly likely that both types of system, and hybrids of both will exist side by side. Those businesses which go on to succeed in this area will likely be those that pay attention to the underlying cost model and achieve the right balance for their application.</p><p><em>Image courtesy of </em><a href="http://pixabay.com/"><em>Pixabay.com</em></a><em> (</em><a href="https://pixabay.com/en/service/license/"><em>CC0 1.0</em></a><em>)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e15cee3a4cbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/imont/iot-approaching-the-edge-e15cee3a4cbf">IoT: approaching the edge</a> was originally published in <a href="https://medium.com/imont">IMONT Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IMONT SDK and the TI SensorTag: a step-by-step guide]]></title>
            <link>https://medium.com/imont/imont-sdk-and-the-ti-sensortag-a-step-by-step-guide-b081241d03e5?source=rss----aee62808540a---4</link>
            <guid isPermaLink="false">https://medium.com/p/b081241d03e5</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[edge-computing]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[peer-to-peer]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Romanas Sonkinas]]></dc:creator>
            <pubDate>Tue, 30 May 2017 10:55:42 GMT</pubDate>
            <atom:updated>2017-05-30T10:55:41.809Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wLN3V8_uzGqfCacA-DhkdA.png" /></figure><p>We’re going to explore, step-by-step, how to integrate one of the most popular prototyping devices out there — the <a href="http://www.ti.com/ww/en/wireless_connectivity/sensortag/">Texas Instruments CC2650 SensorTag</a> with the IMONT SDK. We’re going to use the Bluetooth Low Energy (BLE) connectivity on the SensorTag to connect it to a Raspberry Pi 3, which will be running an instance of the SDK, and we’ll show you how to connect that to an Android phone running another instance — and how the two will exchange information directly without any intermediaries.</p><h4>Pre-Requisites</h4><p>This article assumes you have a working knowledge of Java and the development ecosystem around it — specifically, how to use Gradle/Maven to manage a project and it’s dependencies. Basic JavaScript is useful to work on the SensorTag device driver.</p><h4>Step 1: Prepare your Pi</h4><p>Install Java8 — either OpenJDK or OracleJDK will work:</p><pre>$ sudo apt-get install oracle-java8-jdk</pre><p>Now we need to get the latest version of Bluez — Linux’ Bluetooth library. The one bundled with Raspbian tends to be fairly out of date (5.23 at the time of writing) and does not support BLE very well, so we’ll want to get the latest and greatest — which (again, at the time of writing) is 5.45. Bluez can be downloaded from the official site <a href="http://www.bluez.org/download/">here</a>. Full instructions on setting up BlueZ can be found in this <a href="https://learn.adafruit.com/install-bluez-on-the-raspberry-pi/installation">nice article from Adafruit</a>, but in a nutshell:</p><pre>$ wget <a href="http://www.kernel.org/pub/linux/bluetooth/bluez-5.45.tar.xz">http://www.kernel.org/pub/linux/bluetooth/bluez-5.45.tar.xz</a><br>$ tar Jxf <a href="http://www.kernel.org/pub/linux/bluetooth/bluez-5.45.tar.xz">bluez-5.45.tar.xz</a> &amp;&amp; cd bluez-5.45/<br>$ sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev<br>$ ./configure<br>$ make<br>$ sudo make install<br>$ sudo reboot</pre><p>To simplify things and avoid the need for running the app as root, add the default pi user to the ‘bluetooth’ group, which can be done like this:</p><pre>sudo usermod -a -G bluetooth pi</pre><p>Then edit the D-Bus configuration file <em>/etc/dbus-1/system.d/bluetooth.conf </em>and add the following policy to allow the bluetooth group to access BlueZ:</p><pre>&lt;policy group=<strong>&quot;bluetooth&quot;</strong>&gt;<br>    &lt;allow send_destination=<strong>&quot;org.bluez&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.Agent1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.MediaEndpoint1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.MediaPlayer1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.ThermometerWatcher1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.AlertAgent1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.Profile1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.HeartRateWatcher1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.CyclingSpeedWatcher1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.GattCharacteristic1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.bluez.GattDescriptor1&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.freedesktop.DBus.ObjectManager&quot;</strong>/&gt;<br>    &lt;allow send_interface=<strong>&quot;org.freedesktop.DBus.Properties&quot;</strong>/&gt;<br>&lt;<strong>/</strong>policy<strong>&gt;</strong></pre><h4>Step 2: Get the SDK</h4><p>Go to <a href="https://sdk.imont.io/">https://sdk.imont.io</a>, register with your favourite identity provider and you’ll be able to access the SDK. The SDK is not an application in itself, but a set of libraries — it’s up to you to build the app that would start it. Don’t worry — we provide an example. Follow the instructions on the SDK site to set up Gradle (or Maven if you prefer).</p><h4>Step 3: Get the example Command Line app</h4><p>Available on GitHub: <a href="https://github.com/imont/sdk-example-cli-app">https://github.com/imont/sdk-example-cli-app</a>. The app comes pre-configured for Bluetooth on the Pi and the SensorTag driver pre-loaded.</p><p>The basic dependencies that the app declares are on the SDK, the Bluetooth/BlueZ Network layer and logback for logging:</p><pre>dependencies {<br>    compile <strong>&#39;io.imont.lion:lion-client:0.7.1&#39;<br>    </strong>compile &#39;<strong>io.imont.bluetooth:bluetooth-bluez-integration:0.4&#39;<br>    </strong>compile <strong>&#39;ch.qos.logback:logback-classic:1.1.7&#39;<br></strong>}</pre><p>Now just build the project with Gradle:</p><pre>./gradlew clean build</pre><p>And copy <em>build/distributions/sdk-example-cli-app-0.1-SNAPSHOT.zip</em> to your pi. After unzipping it, you should be able to run the app by typing.</p><pre>./bin/sdk-example-cli-app</pre><p>Provided there were no errors, you are ready to go to the next step.</p><h4>Step 4: Pairing an Android app with the Raspberry Pi</h4><p>Available on GitHub: <a href="https://github.com/imont/sdk-example-android-app">https://github.com/imont/sdk-example-android-app</a></p><p>Now that the CLI app is running on the Pi, we are ready to start our phone app and pair the two SDK instances together. Open the app in Android Studio and install it to your phone (Note: using an emulator which is effectively behind a NAT, will prevent the two instances from seeing each other). After starting the example Android app, you will be greeted with a simple screen that shows two options: either creating a new network, or joining an existing one. Since we are starting from scratch, we’ll want to create a new one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*2McBVoOA5GzIvlvqbgkLhw.png" /></figure><p>We’ll be greeted with a screen showing the instance of the SDK running on the Pi:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Pnq6G0jmzXgIEcSaFC7n2Q.png" /></figure><p>If we click on the discovered instance, the phone and the Pi will pair, and you should now see a new screen showing the two devices in your network (drag down to refresh if the Pi does not appear):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Pjx2PgV9M_aHoUr_toJpyQ.png" /></figure><h4>Step 5: Adding the SensorTag as a bridged device</h4><p>Since the SensorTag is an embedded device and is thus unable to run an instance of the IMONT SDK, we’ll need to add it as a bridged device — and we want the Raspberry Pi to do the bridging. Fortunately we’ve already set everything up on the Pi, so all we need to do is click on the Pi in the app, and then select “Find Bridged Device”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*j8BQ6-sQdKg9EFWcRg_6ig.png" /></figure><p>The SDK on the Pi will now scan the surrounding Bluetooth spectrum and see what devices we’ve got available — you’ll most likely find quite a few here. Once the SensorTag is discovered, click “Acquire” and the Pi will connect to the device for you and pair (this might take up to 15s, you’ll be notified when it’s done).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*1hu0lR7ZuhGZVn1xbrt4tQ.png" /></figure><p>Click “Finish” once that is done, and you will see the Sensor Tag as a bridged device in the main device list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*ar4ZfC4wQSf82aDXf1H2fw.png" /></figure><p>If you click on the SensorTag device now, you’ll be taken to a screen showing all of the available sensors and their current state, including things like temperature, atmospheric pressure and light intensity. By default, the driver re-reads all the values every two minutes, but you can configure that to be done at a higher interval in the driver itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*yF5MWUUPipdEwuhKjGeIEg.png" /></figure><p>Leave the device running for some time and observe how those values change.</p><h4>Appendix: The actual JavaScript driver</h4><p>The default driver for the SensorTag is bundled together with the example CLI application that you have used previously. It can be found in <em>src/main/resources/drivers/ti-cc2650-sensortag.js</em>. Let’s take a look at some of the basic features that are used in the driver, and how that can be adopted for other Bluetooth Low Energy devices.</p><p>First, any driver in the SDK must declare some metadata, telling the SDK what sort of device it is meant for. The metadata for the SensorTag is fairly simple:</p><pre><strong>function </strong>metadata() {<br>    <strong>return </strong>{<br>        <strong>&quot;network&quot;</strong>: <strong>&quot;BLE&quot;</strong>,<br>        <strong>&quot;manufacturer&quot;</strong>: <strong>&quot;Texas Instruments&quot;</strong>,<br>        <strong>&quot;model&quot;</strong>: <strong>&quot;CC2650 SensorTag&quot;</strong>,<br>        <strong>&quot;hardwareVersion&quot;</strong>: <strong>&quot;PCB 1.2/1.3&quot;</strong>,<br>        <strong>&quot;primaryFeature&quot;</strong>: <strong>&#39;TEMPERATURE&#39; // arbitrary<br>    </strong>}<br>}</pre><p>When a device is added to the SDK, the first thing that happens is the <em>onLoad</em> function is called. In our case, we set up callbacks to report the various sensor values every once in a while, depending on how often the value is likely to change — feel free to experiment on the exact timings. More frequent polling = higher battery usage and a larger database in the SDK.</p><pre><strong>function </strong>onLoad() {<br>    reportIO(); // Report the status of the LED<em><br>    </em>context.scheduler.callback(<strong>&quot;readLux&quot;</strong>, 0, 120000); <em><br>    </em>context.scheduler.callback(<strong>&quot;readTemperature&quot;</strong>, 0, 300000); <em><br>    </em>context.scheduler.callback(<strong>&quot;readHumidity&quot;</strong>, 0, 300000); <em><br>    </em>context.scheduler.callback(<strong>&quot;readBarometer&quot;</strong>, 0, 300000); <em><br>    </em>context.scheduler.callback(<strong>&quot;readBattery&quot;</strong>, 0, 3600000 ); <em><br></em>}</pre><p>By default, none of the sensors are actually switched on, so we make sure they are whenever we do the polling.</p><p>When those readings are taken, they are written to the internal database within the SDK — called Mole — which handles replication of data between the various peer instances in our network (the Android app in this case). In the driver, this is done in the <em>reportIfChanged</em> function, which, as the name implies, only saves new readings if it differs from the previous one:</p><pre>reportIfChanged = <strong>function</strong>(id, key, value, metadata) {<br>    <strong>var </strong>currentValue = context.cache.get(key);<br>    <strong>if </strong>(currentValue != value) {<br>        framework.db.raiseEvent(id, key, value, metadata);<br>        context.cache.put(key, value);<br>    }<br>}</pre><p>To do the actual reading from Bluetooth, we rely on the bluetooth network layer, and the various primitives that it provides. To anyone who has worked with Bluetooth Low Energy before, they should be the quite familiar concepts of <em>readAttribute</em> and <em>writeAttribute, </em>which are provided in the <em>framework.ble</em> namespace, i.e.:</p><pre><strong>var </strong>rawLux = framework.ble.readCharacteristic(<br>                    context.id, <br>                    luxometer_service_uuid, <br>                    luxometer_data_uuid<br>             );</pre><p>The SensorTag also has a buzzer and a couple of LEDs which we can control — that is done in <em>onRequestEvent</em> which is invoked automatically by the SDK whenever one of the peers raises a request event — read more about those in the SDK docs. In the simple implementation given in this driver, we just write a characteristic to the sensor tag whenever we receive such an event:</p><pre><strong>function </strong>onRequestEvent(evt) {<br>    <strong>if </strong>(evt.key == <strong>&#39;ON_OFF&gt;ON_OFF&#39;</strong>) {<br>        <strong>if </strong>(evt.value == 1) {<br>            <strong>var </strong>data = 7<em><br>        </em>} <strong>else if </strong>(evt.value == 0) {<br>            <strong>var </strong>data = 0<br>        } <strong>else </strong>{<br>            <strong>return</strong>;<br>        }<br>        switchOnIOActuator();<br>        framework.ble.writeCharacteristic(context.id, io_service_uuid, io_data_uuid, [ data ]);<br>        framework.db.raiseEvent(context.id, <strong>&#39;ON_OFF&gt;ON_OFF&#39;</strong>, <strong>&quot;&quot; </strong>+ evt.value, <strong>null</strong>);<br>    }<br>}</pre><p>You can view this in action in the app, by clicking on the <em>ON_OFF&gt;ON_OFF</em> attribute in the SensorTag device view.</p><h4>Resources</h4><p>IMONT SDK: <a href="https://sdk.imont.io/">https://sdk.imont.io</a><br>TI SensorTag: <a href="http://www.ti.com/ww/en/wireless_connectivity/sensortag/">http://www.ti.com/ww/en/wireless_connectivity/sensortag/</a><br>Example Raspberry Pi app: <a href="https://github.com/imont/sdk-example-cli-app">https://github.com/imont/sdk-example-cli-app</a><br>Example Android app: <a href="https://github.com/imont/sdk-example-android-app">https://github.com/imont/sdk-example-android-app</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b081241d03e5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/imont/imont-sdk-and-the-ti-sensortag-a-step-by-step-guide-b081241d03e5">IMONT SDK and the TI SensorTag: a step-by-step guide</a> was originally published in <a href="https://medium.com/imont">IMONT Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How the cloud is killing IoT]]></title>
            <link>https://medium.com/imont/how-the-cloud-is-killing-iot-8c6deefd7a71?source=rss----aee62808540a---4</link>
            <guid isPermaLink="false">https://medium.com/p/8c6deefd7a71</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[edge-computing]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Romanas Sonkinas]]></dc:creator>
            <pubDate>Mon, 22 May 2017 10:50:10 GMT</pubDate>
            <atom:updated>2017-05-22T10:50:09.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*dO7tqEP8bOpbie0hgWeraQ.png" /></figure><p>A while back, a bunch of very clever people designed something truly amazing — a decentralised network of computers that were capable of exchanging arbitrary information on a massive scale. We all know that story: the internet’s been around for so long we in fact have forgotten it ever being some other way. However, one thing that we don’t seem to realise is how much of the initial design goal of being “decentralised” has been lost, or the term was broadly misused.</p><p>A lot of that centralisation happened as a consequence of business needs — it’s much easier to make sense of vast amounts of data when it’s in one location, not scattered around. This has been the model that the tech giants of our age employ — gather as much information in one place as you can, then make sense of it, and monetise the results. Google, Facebook, Twitter, Amazon et al — all share a roughly similar business model that has been around for the past 15–20 years.</p><p>It then comes as no surprise that those same giants, when confronted with the emergence of the Internet of Things, had a bit of a lightbulb moment and thought — <em>Hey, that’s just more data for us!</em></p><h4>The not-so-connected things</h4><p>The term <em>Internet of Things</em> is a bit of a misnomer in itself — it suggests that all we need to do is add some internet connectivity to otherwise mundane <em>things,</em> and they will suddenly become magically useful by virtue of that alone. In fact, it led to the exact opposite — things like the <a href="http://www.mysmalt.com/">Bluetooth Salt Shaker</a> (no, seriously) or the ill-fated <em>Juicero</em> have contributed to the emergence of another term — <em>The Internet of Shit</em>.</p><p>We’ve forgotten that first and foremost, IoT is about improving everyday products by enabling features that make our lives easier in some meaningful way. In the vast majority of cases, that means that <strong><em>things </em>need to be connected to</strong> <strong><em>you</em></strong>, and preferably in the most direct way possible.</p><p>Where we’ve completely missed the point is <em>how</em> we’re enabling this connectivity.</p><p>Let’s talk about smart homes as a case-in-point. We’ve got plenty of solutions out there: from NEST to Hive to Apple HomeKit to Google Home and the plethora of wannabes and also-rans. What almost all of them share is an old-school business model of hoovering up your data, centralising it somewhere and making money out of that information. That’s the only way of operation those companies know. Not only does this lead to dramatic privacy issues (looking at you here, Alexa) but makes you and your home completely beholden to the provider you’ve signed up for and their ability to actually provide a reliable and secure service.</p><blockquote>Oh you want to turn on a smart bulb? Sorry, our servers are currently experiencing technical difficulties. But you’re cool in the dark there, right?</blockquote><p>Even though they all notionally connect the <em>things</em> to <em>you</em>, they also make sure that the only way for you to be connected is via them as a provider. Is this the future we’ve dreamed of?</p><h4>Is there a better way?</h4><p>The internet is supposed to be about inter-connected, but otherwise autonomous <em>things</em>. We need to stop ignoring that design and start embracing it instead. Connectivity is great, but usually all you need is for your <em>things</em> to be connected with other <em>things </em>(and you!)<em> </em>in a small, private <strong><em>personal area network:</em></strong> a home, an office, a factory, a car. Heck, even the human body — a pacemaker sure as hell doesn’t need an IP address and push notification support to be made <em>“smart”</em>.</p><p>Our perception is slowly changing for the better — Andreessen Horowitz recently published an <a href="http://a16z.com/2016/12/16/the-end-of-cloud-computing/">amazing presentation</a> about how the world is moving away from the <em>cloud</em> and into the <em>edge</em> — meaning more processing and more analysis is done locally, as opposed to offloading to a bunch of servers someplace. As with many things, this change has only been born out of necessity where the current model didn’t work any more — i.e. in the world of connected cars. You don’t have a fibre-optic connection running from your self-driving car and can’t rely on the cloud being readily available to process the gigabytes of data that the various cameras and LiDARs are generating. And in any case, why would you put gigahertz upon gigahertz of processing power into a car and then not use it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*9gImha13NbG8hEPZM63-CA.png" /></figure><p>The <strong><em>Cloud</em></strong> is great and gives us an unparalleled way of <em>sharing</em> things: one can scarcely imagine a world without Twitter, Facebook or Amazon. But it’s not a panacea or an endgame — and we sure shouldn’t make our connected products beholden to it. There are things that the cloud will always be a good place for — analysing huge chunks of data being one of them. But in the IoT world, that should be a secondary consideration — a side channel that’s independent from the main feature.</p><p>Here at <a href="https://www.imont.io/">IMONT Technologies</a>, we’re working on a next-gen SDK for the connected world, that emphasises local connectivity and local control. We would like to see a world of many billions of <em>things</em> talking to each other in the way the internet was designed in the first place — in an ad-hoc, peer-to-peer kind of way.</p><p><em>Images courtesy of </em><a href="http://www.freepik.com/"><em>Freepik</em></a><em> from </em><a href="http://www.flaticon.com/"><em>Flaticon</em></a><em> (CC BY 3.0)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c6deefd7a71" width="1" height="1" alt=""><hr><p><a href="https://medium.com/imont/how-the-cloud-is-killing-iot-8c6deefd7a71">How the cloud is killing IoT</a> was originally published in <a href="https://medium.com/imont">IMONT Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Self-Updating IoT apps on the Raspberry Pi using Docker]]></title>
            <link>https://medium.com/imont/self-updating-iot-apps-on-the-raspberry-pi-using-docker-a0b223fd4eeb?source=rss----aee62808540a---4</link>
            <guid isPermaLink="false">https://medium.com/p/a0b223fd4eeb</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Romanas Sonkinas]]></dc:creator>
            <pubDate>Mon, 15 May 2017 08:48:47 GMT</pubDate>
            <atom:updated>2017-05-15T08:48:47.406Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6MtVE9HXB8yDglp8i4ZfBQ.png" /></figure><p>Here at <a href="https://www.imont.io/">IMONT Technologies</a> we’ve been working on a problem that pains so many IoT solutions everywhere — how to easily update your software when it is out in the field. Imagine a situation — you have a bunch of Raspberry Pi-style micro computers deployed that run your software, and you want to release updates to it. One option is to get it into the official Raspbian repositories, but that would be time consuming and you’d be beholden to Raspbian’s release cycle — not to mention you’d need to somehow make sure all of those PIs would actually pull updates in a timely fashion.</p><p>Since we were already using Docker for many things here at IMONT, we figured it would be great to be able to deploy our in-the-field (read: not in the cloud) software the same way you’d expect to roll out software updates to some cloud app. Fortunately the Raspberry Pi (among others) has now received official Docker support, which means that it’s relatively straightforward to use the same techniques to deploy apps to PIs as you would use when deploying them to the cloud.</p><p>Let’s start with the basics…</p><h4>Installing Docker on the Pi</h4><p>Assuming you already have an up-to-date version of Raspbian, it is actually as easy as following the official Docker installation instructions, i.e.:</p><pre>pi@raspberrypi:~ $ curl -sSL https://get.docker.com/ | sh</pre><p>After following some prompts, you should have Docker up-and-running. You can verify your installation by doing running <em>“docker ps”:</em></p><pre>pi@raspberrypi:~ $ sudo docker ps<br>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES</pre><p>If you get this or similar output, Docker is successfully installed. One useful thing is to add the “pi” user to the docker group, which will allow invoking docker commands without sudo:</p><pre>pi@raspberrypi:~ $ sudo usermod -G docker pi</pre><h4>Installing Watchtower</h4><p><a href="https://github.com/v2tec/watchtower">Watchtower</a> is a pretty simple and cool Docker app that monitors your running containers for any changes — i.e. it would detect that a newer version is installed into the local or remote repo and automatically upgrade your running app. Although by default it is configured to pull changes from a remote repository, we’ll disable that and make it work in “offline” mode. The reason for that is we want to be in full control of when upgrades are happening, and to which version we upgrade, as opposed to it always pulling the latest one from Docker Hub.</p><p>We’ll be using <em>systemd</em> to configure automatic startup of watchtower by creating a config file like this:</p><pre>[Unit]<br>Description=Watchtower container<br>Requires=network-online.target docker.service<br>After=docker.service</pre><pre>[Service]<br>Restart=never<br>ExecStartPre=-/usr/bin/docker rm -f watchtower<br>ExecStart=/usr/bin/docker run --name watchtower --rm  -v /var/run/docker.sock:/var/run/docker.sock   v2tec/watchtower:armhf-latest --no-pull -i 30 --cleanup<br>ExecStop=/usr/bin/docker stop -t 2 watchtower</pre><pre>[Install]<br>WantedBy=default.target</pre><p>Now all we need to do is put it in <em>/etc/systemd/system/watchtower.service</em> and enable it like this:</p><pre>pi@raspberrypi:~ $ sudo systemctl enable watchtower.service<br>pi@raspberrypi:~ $ sudo systemctl start watchtower.service</pre><p>After which you should see it in the list of running containers:</p><pre><strong>pi@raspberrypi</strong>:<strong>~ $</strong> docker ps</pre><pre>CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS               NAMES</pre><pre>cef8390df0e0        v2tec/watchtower:armhf-latest   &quot;/watchtower --no-...&quot;   3 minutes ago       Up 3 minutes                            watchtower</pre><h4>Configuring our app</h4><p>Now for the cool part — how to enable our app to upgrade itself when we <em>push</em> some new software out to it. The push mechanism itself is out of scope for this article — at IMONT we maintain a secured peer-2-peer connection to our running container and are able to send it commands that way, but you might have a channel open to, say, Amazon IoT or some bespoke solution and issue commands via that.</p><p>The important thing is to allow our app (running in a Docker container) access to Docker itself. We do that in exactly the same way we did with wachtower — by mounting the Docker socket into it. Here’s a sample <em>systemd</em> config file, which you can adapt as required:</p><pre>[Unit]<br>Description=My App<br>Requires=network-online.target docker.service<br>After=docker.service</pre><pre>[Service]<br># Don&#39;t restart, conflicts with Watchtower<br>Restart=never<br>ExecStartPre=-/usr/bin/docker rm -f my-app<br>ExecStart=/usr/bin/docker run --name my-app -v /var/run/docker.sock:/var/run/docker.sock -t my-app-container-name<br>ExecStop=/usr/bin/docker stop -t 2 my-app</pre><pre>[Install]<br>WantedBy=default.target</pre><blockquote>Note that unless your container is hosted on Docker hub, you’ll need to install it into the local Docker repo manually for the first time (i.e. docker load -i &lt;my-app.tar&gt;</blockquote><h4>The self-updating app code</h4><p>Once we’ve started our application and it has access to the Docker socket (via /var/run/docker.sock), it’s simply a matter picking a Docker client library for the language you use and writing some code to download and install a container. We do it with Java, but the code for any other language would be pretty much equivalent. We use <a href="https://github.com/docker-java/docker-java">docker-java</a>. Here’s some sample code to download a Docker image from a URL location and install into the local repo:</p><blockquote>We use RxJava for all our code — which I highly recommend!</blockquote><pre>// docker-java requires no configuration<br>dockerClient = DockerClientBuilder.<em>getInstance</em>().build();</pre><pre><strong>private </strong>Observable&lt;File&gt; download(<strong>final </strong>URL url) {<br>    <strong>return </strong>Observable.<em>fromCallable</em>(() -&gt; {<br>        ReadableByteChannel rbc = Channels.<em>newChannel</em>(url.openStream());<br>        File outFile = File.<em>createTempFile</em>(<strong>&quot;docker&quot;</strong>, <strong>&quot;download&quot;</strong>);<br>        outFile.deleteOnExit();<br><br>        FileOutputStream fos = <strong>new </strong>FileOutputStream(outFile);<br>        fos.getChannel().transferFrom(rbc, 0, Long.<strong><em>MAX_VALUE</em></strong>);<br><br>        <strong>return </strong>outFile;<br>    });<br>}</pre><pre><strong>private </strong>Observable&lt;Boolean&gt; install(<strong>final </strong>File file) {<br>    <strong>return </strong>Observable.<em>fromCallable</em>(() -&gt; {<br>        <strong>try </strong>(FileInputStream fs = <strong>new </strong>FileInputStream(file)) {<br>            <strong>dockerClient</strong>.loadImageCmd(fs).exec();<br>        }<br>        <strong>return true</strong>;<br>    });<br>}</pre><pre>// And all together now<br>download(someUrl).flatMap(<strong>this</strong>::install).subscribe(result -&gt; {<br>    <strong><em>logger</em></strong>.info(<strong>&quot;Installed? {}&quot;</strong>, result);<br>});</pre><p>After you’ve installed the archive, watchtower should detect a change in your local repository and restart your running application. Voila!</p><blockquote>Note: You can upgrade Watchtower itself in the same way.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0b223fd4eeb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/imont/self-updating-iot-apps-on-the-raspberry-pi-using-docker-a0b223fd4eeb">Self-Updating IoT apps on the Raspberry Pi using Docker</a> was originally published in <a href="https://medium.com/imont">IMONT Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>