<?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 goMake on Medium]]></title>
        <description><![CDATA[Stories by goMake on Medium]]></description>
        <link>https://medium.com/@gomaketeam?source=rss-65b383f11ec9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*o3X5FTGBj1q6cUQv.jpg</url>
            <title>Stories by goMake on Medium</title>
            <link>https://medium.com/@gomaketeam?source=rss-65b383f11ec9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 20:52:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gomaketeam/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[Connecting the ESP32-DevKitC and AWS IoT Using Mongoose OS, Part II]]></title>
            <link>https://medium.com/@gomaketeam/connecting-the-esp32-devkitc-and-aws-iot-using-mongoose-os-part-ii-88c241fef03?source=rss-65b383f11ec9------2</link>
            <guid isPermaLink="false">https://medium.com/p/88c241fef03</guid>
            <category><![CDATA[aws-iot]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[goMake]]></dc:creator>
            <pubDate>Tue, 26 Sep 2017 23:13:46 GMT</pubDate>
            <atom:updated>2017-09-27T22:08:16.026Z</atom:updated>
            <content:encoded><![CDATA[<p><em>When last we left our hero…</em></p><h3>Recap</h3><p>In <a href="https://medium.com/@gomaketeam/connecting-the-esp32-devkitc-and-aws-iot-using-mongoose-os-part-i-11fecd2d86d5">Part I</a> we:</p><ul><li>Setup the drivers and toolchain for working with ESP32-DevKitC</li><li>Installed Mongoose OS and tested connectivity of the ESP32-DevKitC through the web client IDE</li><li>Configured AWS IoT and added the ESP32 as a “thing” in its registry</li></ul><p>Phew! Now what?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZPW87muHb0YKjVeY9Xb9Q.jpeg" /><figcaption>Source: <a href="http://galleryhip.com/space-cat-wallpapers.html">http://galleryhip.com/space-cat-wallpapers.html</a></figcaption></figure><h3>Goals</h3><ul><li>Create a simple “Internet Button” that emails a quote from spacecat</li><li>Setup a Rule in AWS IoT to trigger another process</li></ul><h3>Concepts</h3><p>MQTT Topics for Interacting with a Shadow: <a href="http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-mqtt.html">Link</a></p><h4>MQTT</h4><p>A lightweight messaging protocol.</p><ul><li><strong>Pub/Sub: </strong>Entities publish new information to a topic and subscribers to that topic receive updates from those publishes.</li><li><strong>Topics/Subscriptions: </strong>Topics are “channels” that entities either push information to or receive information via subscription to that topic. A topic in AWS IoT might look like this:</li></ul><pre>$aws/things/<em>thingName</em>/shadow/update</pre><ul><li><strong>QoS: </strong>“Quality of Service” — this is the level of “handshaking” that occurs to ensure a valid message transmission. QoS=0 is no checking whatsoever, QoS=2 is a 4 step handshake.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*-g6aYok2_dhEACGvW6Y-lw.jpeg" /><figcaption>Slide referenced from: <a href="https://www.slideshare.net/BryanBoyd/mqtt-austin-api">https://www.slideshare.net/BryanBoyd/mqtt-austin-api</a></figcaption></figure><p>MQTT Tutorial: <a href="http://mosquitto.org/man/mqtt-7.html">Link</a></p><h3>Requirements</h3><ul><li>ESP32-DevKitC</li><li>Mongoose OS</li><li>AWS Account</li><li>Completed Steps in Part I</li></ul><h3>Setup</h3><h4>1. Setup an SNS Topic</h4><h4>UI Interface</h4><p>Click <strong>Create New Topic </strong>on the <em>SNS dashboard</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iy7Pqep03nTGA9JrbUgreg.png" /></figure><p>Input a <em>Topic name</em> and <em>Display name</em> for SpaceCat’s mail notifications:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MNaao2dzKeaey21kqGNIrw.png" /></figure><p>After clicking <strong>Create Topic</strong> you will see your topic added to the <em>Topics</em> tab grid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmCeK5MgXmc7KoRAiz_hDw.png" /></figure><p>Switch to the <em>Subscriptions</em> tab, and click <strong>Create subscription</strong>. Select <strong>Email</strong> for your <em>protocol</em> and enter your email address for your <em>Endpoint.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yYitcuD6AfCpnGYKaIMdUg.png" /></figure><p>After clicking <strong>Create subscription</strong>, you should see your subscription show up in the <em>Subscriptions</em> tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXxoMITvRMhVJ4jekqE8Lg.png" /></figure><h4>2. Setup a Rule</h4><p>Navigate to the <em>Rules</em> tab on <em>AWS IoT</em>. Click <strong>Create a rule</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0LGoUwG-Uu_LvhJW8jE-MQ.png" /></figure><p>Fill out the <em>Name</em> and <em>Description</em> fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZLPlZyPqYXWPv_BB2SOFg.png" /></figure><p>Set the <em>Attribute </em>field in the rule to *.</p><p>Set the <em>Topic filter to an appropriate MQTT topic. </em>In our example we will create a topic<em> spacecatmail </em>as:</p><pre>$aws/things/esp32_068A80/spacecatmail</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aqt8fZlBVUIp3x7_z02F_A.png" /></figure><p>Next, click on <strong>Add action</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*051-VseGkPRx-cRjJaphtA.png" /></figure><p>From the list of available <em>actions</em>, click <strong>Send a message as an SNS push notification</strong>. Click <strong>Configure action</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XFHR0APsAOKD0nGB0wNCFA.png" /></figure><p>At the bottom of your rule configuration, you should now see an <em>action</em> added. Click <strong>Create rule</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yDhiiY8c5K7NravEct3Q4A.png" /></figure><h4>3. Code</h4><p>Launch the <em>mos tool </em>IDE:</p><pre>$ ~/.mos/bin/mos</pre><p>Select <em>init.js </em>from the <em>Device File Manager:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vh8Xqjdz-I965vxl8kDHZg.png" /></figure><p>Type in the following code:</p><pre>load(&#39;api_config.js&#39;);<br>load(&#39;api_gpio.js&#39;);<br>load(&#39;api_mqtt.js&#39;);<br>load(&#39;api_net.js&#39;);<br>load(&#39;api_sys.js&#39;);<br>load(&#39;api_timer.js&#39;);</pre><pre>let button = ffi(&#39;int get_button_gpio_pin()&#39;)();</pre><pre>GPIO.set_button_handler(button, GPIO.PULL_UP, GPIO.INT_EDGE_NEG, 200, function() {<br>  let topic = &#39;$aws/things/&#39; + Cfg.get(&#39;device.id&#39;) + &#39;/spacecatmail&#39;;<br>  let message = &#39;Im feline paw-some.&#39;;<br>  let ok = MQTT.pub(topic, message, 1);<br>  print(&#39;Published:&#39;, ok ? &#39;yes&#39; : &#39;no&#39;);<br>}, null);</pre><p>You can change the string for <em>message</em> to whatever you want your spacecat quote to be.</p><h4>4. Flash the ESP</h4><p>To flash your code, click <strong>Save + Reboot</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eA8qS1Nhe74E8uI-PoPaIA.png" /></figure><h4>5. Test</h4><p>Momentarily press the right button on your esp32 devkit and you should see an email from spacecat hit your inbox in a few moments. Huzzah!</p><h3>What’s next?</h3><p>In Part III we will explore:</p><ul><li>how to manipulate the device shadow</li><li>how to create a battery powered thing and expose the deep sleep functionality of the esp32 to preserve power.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88c241fef03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting Raspberry Pi Zero with Amazon Web Services IoT — Part III: Installing the AWS IoT Device…]]></title>
            <link>https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-iii-installing-the-aws-iot-device-919de23f5642?source=rss-65b383f11ec9------2</link>
            <guid isPermaLink="false">https://medium.com/p/919de23f5642</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[goMake]]></dc:creator>
            <pubDate>Thu, 03 Aug 2017 15:55:06 GMT</pubDate>
            <atom:updated>2017-08-03T15:56:59.702Z</atom:updated>
            <content:encoded><![CDATA[<h3>Connecting Raspberry Pi Zero with Amazon Web Services IoT — Part III: Installing the AWS IoT Device SDK and Running a Sample Application</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FjqQd7GDRSOKG4vEP6Mv9Q.jpeg" /></figure><p><em>This post is by </em><a href="http://linkedin.com/in/morrissinger"><em>Morris Singer</em></a><em>, who provides cloud infrastructure architecture expertise to GoMake.</em></p><p>This tutorial is part of a three-part series on using a <a href="https://www.raspberrypi.org/blog/raspberry-pi-zero/">Raspberry Pi Zero</a> with <a href="https://aws.amazon.com/iot">Amazon Web Services (AWS) IoT</a>. In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-i-working-with-aws-iot-caa8a0f6f91b">the first part</a>, I walked through setting up Amazon IoT to communicate with the Pi. In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-ii-provisioning-a-raspberry-pi-1e9c7e7b29a9">the second part</a>, I changed gears and worked through provisioning the Raspberry Pi Zero. In this final part, I will walk through installing the AWS IoT Device SDK and running one of the sample application on the Pi that will demonstrate communication with AWS.</p><h3><strong>Review: What is the Internet of Things</strong></h3><p>The Internet of Things (IoT) represents the growth of the Internet into a platform for providing connectivity between electronics, software, sensors, and actuators embedded into physical devices. IoT allows the physical world to be more directly integrated into the Internet, providing opportunities to improve efficiency, accuracy and control of our physical world via existing networks.</p><p>For a broader exploration of how IoT systems are structured, see <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-i-working-with-aws-iot-caa8a0f6f91b">the first part of this tutorial</a>.</p><h3><strong>What is the AWS IoT Device SDK</strong></h3><p>The AWS IoT Device SDK helps you to connect devices to AWS IoT. It provides features so that devices can seamlessly and securely work with the Device Gateway and Device Shadow provided by AWS IoT.</p><p>For a broader exploration of AWS IoT, see <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-i-working-with-aws-iot-caa8a0f6f91b">the first part of this tutorial</a>.</p><h3><strong>Installing the AWS IoT Device SDK and Building a Sample Application</strong></h3><p>Installing the AWS IoT Device SDK and building a sample application consists of a few steps. One must:</p><ol><li>Upload Certificates and a key pair to the device.</li><li>Download the AWS IoT SDK onto the device and install it.</li><li>Configure the sample application with the needed AWS IoT variables.</li><li>Compile and run the sample application.</li></ol><p>I will discuss each of these steps, individually, below.</p><h4><strong>Upload the Certificates and Keys to Your Device</strong></h4><p>Use Secure Copy (scp) to move the keys and certificates to your device:</p><pre>scp privkey.pem pi@raspberrypi.local:/home/pi<br>scp pubkey.pem pi@raspberrypi.local:/home/pi<br>scp crt.crt pi@raspberrypi.local:/home/pi<br>scp ca.pem pi@raspberrypi.local:/home/pi</pre><p>The default password for the default pi user in Raspbian is raspberry.</p><h4><strong>Download the AWS IoT Device SDK onto the Raspberry Pi</strong></h4><p>Open a Secure Shell (ssh) with the Raspberry Pi:</p><pre>ssh pi@raspberrypi.local</pre><p>The default password for the default pi user in Raspbian is raspberry.</p><p>Next, in the SSH shell, download the <a href="https://s3.amazonaws.com/aws-iot-device-sdk-embedded-c/linux_mqtt_openssl-latest.tar">AWS IoT Device SDK</a> for C in a tarball (linux_mqtt_openssl-latest.tar). Save it in your deviceSDK directory.</p><pre>wget <a href="https://s3.amazonaws.com/aws-iot-device-sdk-embedded-c/linux_mqtt_openssl-latest.tar">https://s3.amazonaws.com/aws-iot-device-sdk-embedded-c/linux_mqtt_openssl-latest.tar</a></pre><p>Move the tarbell into /opt/devicesdk and extract it:</p><pre>mkdir /opt/devicesdk<br>mv linux_mqtt_openssl-latest.tar /opt/devicesdk<br>cd /opt/devicesdk<br>tar -xvf linux_mqtt_openssl-latest.tar</pre><p>Move the certificates and key pair into `/opt/devicesdk/certs`:</p><pre>mv /home/pi/privkey.pem /opt/devicesdk<br>mv /home/pi/pubkey.pem /opt/devicesdk<br>mv /home/pi/crt.crt /opt/devicesdk<br>mv /home/pi/ca.pem /opt/devicesdk</pre><p>Before you can use the AWS IoT Embedded C SDK, you must install the OpenSSL library on Raspberry Pi:</p><pre>sudo apt-get install -y libssl-dev</pre><h4><strong>Supply the AWS IoT Variables to the Application</strong></h4><p>Navigate to /opt/devicesdk/sample_apps/shadow_sample and edit the aws_iot_config.h, using an editor that is installed on Raspbian by default, such as nano:</p><pre>cd /opt/devicesdk/sample_apps/shadow_sample<br>nano aws_iot_config.h</pre><p>Providing the following information:</p><pre>#define AWS_IOT_MQTT_HOST “ENDPOINT.iot.us-east-1.amazonaws.com”<br>#define AWS_IOT_MQTT_PORT 8883<br>#define AWS_IOT_MQTT_CLIENT_ID “THING NAME”<br>#define AWS_IOT_MY_THING_NAME “THING NAME”<br>#define AWS_IOT_ROOT_CA_FILENAME “ca.pem”<br>#define AWS_IOT_CERTIFICATE_FILENAME “cert.crt”<br>#define AWS_IOT_PRIVATE_KEY_FILENAME “privkey.pem”</pre><p>Supply the endpoint you gathered in <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-i-working-with-aws-iot-caa8a0f6f91b">the first part of this tutorial</a>, when interacting with AWS IoT via the AWS CLI. If you need to get it again, use the AWS CLI:</p><pre>aws iot describe_endpoint</pre><p>The file names for AWS_IOT_ROOT_CA_FILENAME, AWS_IOT_CERTIFICATE_FILENAME, and AWS_IOT_PRIVATE_KEY_FILENAME should not contain paths, but should be bare file names instead. The specific values to provide may be different from this example.</p><p>Save the file and exit the editor.</p><h4><strong>Compile and Run the Sample Application</strong></h4><p>Compile the example and run:</p><pre>make -f Makefile</pre><p>This will produce an executable called shadow_sample, which you can run:</p><pre>./shadow_sample</pre><p>You should be able to log into the AWS management console, open the IoT service and see entries being written by your device. It should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*484xtkby6b6eQ_EV1qDNwg.png" /><figcaption>Screen shot of an AWS IoT Device Shadow while running the shadow_sample executable.</figcaption></figure><p>Congratulations! You have connected your device to AWS IoT!</p><h3><strong>Calls to Action</strong></h3><p>Now that you have a Raspberry Pi provisioned for AWS IoT and have the Pi set up to manipulate a device shadow, I encourage you to explore some of the other services that AWS has to offer that plug into AWS IoT, and to build out more sophisticated applications on the Pi.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=919de23f5642" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting Raspberry Pi Zero with Amazon Web Services IoT — Part II: Provisioning a Raspberry Pi]]></title>
            <link>https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-ii-provisioning-a-raspberry-pi-1e9c7e7b29a9?source=rss-65b383f11ec9------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e9c7e7b29a9</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[goMake]]></dc:creator>
            <pubDate>Thu, 03 Aug 2017 15:45:52 GMT</pubDate>
            <atom:updated>2017-08-04T13:43:33.726Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KQj3Ow42L6u6swhP8_6fLg.jpeg" /></figure><p><em>This post is by </em><a href="http://linkedin.com/in/morrissinger"><em>Morris Singer</em></a><em>, who provides cloud infrastructure architecture expertise to GoMake.</em></p><p>This tutorial is part of a three-part series on using a <a href="https://www.raspberrypi.org/blog/raspberry-pi-zero/">Raspberry Pi Zero</a> with <a href="https://aws.amazon.com/iot">Amazon Web Services (AWS) IoT</a>. In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-i-working-with-aws-iot-caa8a0f6f91b">the first part</a>, I walked through setting up Amazon IoT to communicate with the Pi. In this part, I will change gears and work through provisioning the Raspberry Pi Zero. In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-iii-installing-the-aws-iot-device-919de23f5642">the final part</a>, I will walk through installing the AWS IoT Device SDK and running one of the sample application on the Pi that will demonstrate communication with AWS.</p><h3><strong>Review: What is the Internet of Things</strong></h3><p>The Internet of Things (IoT) represents the growth of the Internet into a platform for providing connectivity between electronics, software, sensors, and actuators embedded into physical devices. IoT allows the physical world to be more directly integrated into the Internet, providing opportunities to improve efficiency, accuracy and control of our physical world via existing networks.</p><p>For a broader exploration of how IoT systems are structured, see <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-i-working-with-aws-iot-caa8a0f6f91b">the first part of this tutorial</a>.</p><h3><strong>What is the Raspberry Pi</strong></h3><p>The Raspberry Pi is a series of small, single-board computers developed by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and in developing countries. The original model became far more popular than anticipated, and the computers are now seen as credible offerings for use in IoT systems.</p><p>The Raspberry Pi runs special distributions of Linux that are ported to run on the ARM processors that Raspberry Pi products rely on for processing. They include a 40-pin general input/output (GPIO) header block for connecting the Pi with sensors, actuators, displays, and other peripherals that facilitate the integration of the Pi with physical devices.</p><h3><strong>Flash Raspbian Jessie Onto the SD Card</strong></h3><p>One of the most popular distributions of Linux that runs on the Raspberry Pi is <a href="https://www.raspberrypi.org/downloads/raspbian/">Raspbian</a>, though the Pi is capable of running many other distributions of Linux as well, such as <a href="https://www.centos.org/">CentOS</a>, <a href="https://getfedora.org/">Fedora</a>, <a href="https://ubuntu-mate.org/raspberry-pi/">Ubuntu</a>, <a href="https://www.archlinux.org/">Arch</a>, <a href="https://developer.android.com/things/index.html">Android</a>, <a href="https://www.suse.com/products/arm/raspberry-pi/">SUSE</a>, and others. It is even capable of running a <a href="https://developer.microsoft.com/en-us/windows/iot">special version of Windows 10</a> geared toward IoT devices.</p><p>In this tutorial, I will walk through setting up the Pi with Raspbian. If you have a Raspberry Pi already set up with Raspbian, you can skip this step.</p><p>If you have a blank SD card, you will need to flash an image of Raspbian Linux onto the SD card that you put into the Raspberry Pi.</p><p>To do this, you will need a few pieces of equipment. Namely, you’ll need a MicroSD card (with at least 8 GB), an SD card reader/writer, and (possibly) a MicroSD card adapter. If you use a MacBook Pro, like I do, the card reader will be built into the laptop, but will require a MicroSD adapter.</p><h4><strong>Download the Raspbian Image</strong></h4><p>The first thing to do is to download the Raspbian image of your choice. At the time of this writing, you can choose between Raspbian Jessie and Raspbian Jessie Lite. Both images are available for download <a href="https://www.raspberrypi.org/downloads/raspbian/">here</a>.</p><p>I’ve generally preferred the full image rather than the Lite one, because it makes development and prototyping easier. In a final revision of your work, however, you may find that Lite gives you everything you need or that you like the idea of installing additional software packages piecemeal to get a highly tailored distribution for your needs.</p><p>After you download, it is very important for the security of your system that you check the SHA to ensure that you have a correct and secure version of the image. For this, I use the shasum tool to generate my own hash of the zip file, and compare it with the hash provided on raspberrypi.org using the diff tool:</p><pre>diff &lt;(shasum raspbian-jessie.zip | awk ‘{print $1}’) &lt;(echo “e1edd4d26090b3e67a66939fa77eeb656de8a2c5”) &amp;&amp; echo “OK”</pre><p>If you have a secure image, the result should be:</p><pre>OK</pre><p>Anything else indicates that you should download again and try again.</p><p>Extract the image from the zip file:</p><pre>unzip raspbian-jessie.zip</pre><h4><strong>Identify the Correct Device</strong></h4><p>Next, place the MicroSD card into the adapter, and ensure that any switch on the side of the adapter that controls whether the SD card is writable is flipped to the position that allows you to write to it.</p><p>Open a terminal and determine which device is the MicroSD cad:</p><pre>diskutil list</pre><p>You’ll see a bunch of information on physical and logical volumes that are included in your environment. One entry will correspond directly to the SD card. it may be a little tricky to figure it out, depending on your setup. In my case, I got the following output (which is slightly redacted):</p><pre>/dev/disk0 (internal, physical):<br>#: TYPE NAME SIZE IDENTIFIER<br>0: GUID_partition_scheme *500.3 GB disk0<br>1: EFI EFI 209.7 MB disk0s1<br>2: Apple_CoreStorage Macintosh HD 499.4 GB disk0s2<br>3: Apple_Boot Recovery HD 650.0 MB disk0s3</pre><pre>/dev/disk1 (internal, virtual):<br>#: TYPE NAME SIZE IDENTIFIER<br>0: Macintosh HD +499.0 GB disk1<br>Logical Volume on disk0s2</pre><pre>/dev/disk3 (internal, physical):<br>#: TYPE NAME SIZE IDENTIFIER<br>0: FDisk_partition_scheme *7.9 GB disk3<br>1: Windows_FAT_32 boot 43.7 MB disk3s1<br>2: Linux 7.9 GB disk3s2</pre><p>Here, you can see that disk0 is my main SSD, and that disk1 is a logical volume on a partition in disk0. You can also see disk3, which is clearly different from the first two, and, not coincidentally, has the same capacity as my MicroSD card. So, you know that disk3 is the one to flash.</p><p><strong>N.B.: Be very careful here. If you flash the wrong disk, you could destroy the data on that disk, and if this is your system disk, the result will not be pretty.</strong></p><h4><strong>Flashing the Firmware</strong></h4><p>Once you have identified the correct disk to flash (in this case disk3), unmount it:</p><pre>diskutil unmountDisk /dev/disk3</pre><p>If this works, you will see the following message:</p><pre>Unmount of all volumes on disk3 was successful</pre><p>Next, you’ll need to run the Data Definition (dd) tool to copy the image onto the SD card:</p><pre>sudo dd bs=1m if=IMAGE-FILE of=DISK conv=sync</pre><p><strong>N.B.: Be very sure to specify the correct disk, which you identified earlier. Specifying the incorrect disk here could result in destruction of your system, including its data.</strong></p><p>The process can take a while to run, given that it is transferring potentially over 4GB (in the case of the full Raspbian Jessie). To check in on the progress, send a SIGINFO by pressing CTRL-T, as often as you’d like.</p><h4><strong>Setup Pi Zero for USB On-The-Go (OTG) and Ethernet Gadget</strong></h4><p>Once this is completed, there are a few steps to set up the Pi for your convenience during development. For example, while the Pi makes it perfectly possible to connect an HDMI display and USB keyboard, you may find it easier to use the Pi over SSH from your development laptop. In this approach, no USB keyboard or HDMI monitor is needed.</p><p>For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with <a href="https://support.apple.com/kb/DL999">Bonjour</a>), OS X or Linux (with Avahi Daemon installed).</p><p>USB OTG allows the Pi to function as a USB host rather than as a gadget, which, in combination with Ethernet Gadget, is what allows you to connect with it via SSH over USB. For more information on this, the following resources may be illuminating:</p><ul><li><a href="https://en.wikipedia.org/wiki/USB_On-The-Go">USB On-The-Go — Wikipedia</a></li><li><a href="https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/overview">Overview | Turning your Raspberry PI Zero into a USB Gadget | Adafruit Learning System</a></li><li><a href="https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget">Ethernet Gadget | Turning your Raspberry PI Zero into a USB Gadget | Adafruit Learning System</a></li></ul><h4><strong>Enable OTG</strong></h4><p>You can enable OTG by using the DWC2 USB driver. You will need to add the DWC2 device tree overlay to the Raspbian configuration. To do this, locate the config.txt file on the boot partition of the SD drive and add dtoverlay=dwc2 to the bottom of the file:</p><pre>echo “dtoverlay=dwc2” &gt;&gt;&gt; config.txt</pre><p>For more information on device tree overlays, see <a href="https://www.raspberrypi.org/documentation/configuration/device-tree.md">Device Trees, Overlays, and Parameters</a>.</p><p>Finally, you will need to pass an additional argument to the Linux kernel in order to actually load the dwc2 module (for OTG) and g_ether module (for Ethernet Gadget). You can do this by adding those arguments in the cmdline.txt file. For more information on this file, see <a href="http://elinux.org/RPi_cmdline.txt">RPi cmdline.txt — elinux.org</a></p><p>Open up the cmdline.txt. Insert modules-load=dwc2,g_ether after rootwait.</p><p>For full clarity, an example. Here is the before:</p><pre>dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=bcc21716–02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles</pre><p>And here is the after:</p><pre>dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=bcc21716–02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet splash plymouth.ignore-serial-consoles</pre><h4><strong>Enable SSH</strong></h4><p>If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in root of the boot partition of your SD card. By default SSH is now disabled so this is required to enable it.</p><pre>touch ssh</pre><h4><strong>Get the Pi on Your WiFi</strong></h4><p>At this point, you can eject the SD card (after unmounting it), install it into your Raspberry Pi, and connect a USB Micro cable between your development laptop and the Pi. Give the Pi about 90 seconds to boot, after which you can SSH into it:</p><pre>ssh pi@raspberrypi.local</pre><p>The default password in a Raspbian distro for the pi user is raspberry.</p><p>Now, you will need to make some modifications to your /etc/network/interfaces file in order to provide information on the WiFi access point and password so that the Pi can connect to Wifi.</p><p>The interfaces file defines how the Pi is networked. You should put the eth0 interface into Dynamic Host Configuration Protocol (DHCP) so that your router can provide it with an IP address (unless your needs are different), and ensure that the wlan0 interface includes information on your WiFi access point and password.</p><p>To edit the interfaces file, execute the following command:</p><pre>sudo nano /etc/network/interfaces</pre><p>Ensure that the file ends up looking as follows:</p><pre>auto lo</pre><pre>iface lo inet loopback<br>iface eth0 inet dhcp</pre><pre>allow-hotplug wlan0<br>auto wlan0</pre><pre>iface wlan0 inet dhcp<br>  wpa-ssid “YOUR SSID HERE”<br>  wpa-psk “YOUR PASSWORD HERE”</pre><p>This should work for most people, but your specific needs may be different. I recommend creating a backup of your interfaces file before you modify the interfaces file.</p><h3><strong>Next Steps</strong></h3><p>In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-iii-installing-the-aws-iot-device-919de23f5642">the next section</a>, I will go through how to get the AWS IoT Device SDK onto the Pi and how to build one of the sample applications so that you can see your Pi communicate with AWS IoT.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e9c7e7b29a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting Raspberry Pi Zero with Amazon Web Services IoT — Part I: Working with AWS IoT]]></title>
            <link>https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-i-working-with-aws-iot-caa8a0f6f91b?source=rss-65b383f11ec9------2</link>
            <guid isPermaLink="false">https://medium.com/p/caa8a0f6f91b</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[goMake]]></dc:creator>
            <pubDate>Thu, 03 Aug 2017 15:29:04 GMT</pubDate>
            <atom:updated>2017-08-03T19:51:10.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ajY8jKuqBuZlDw9mdwJn_g.jpeg" /></figure><p><em>This post is by </em><a href="http://linkedin.com/in/morrissinger"><em>Morris Singer</em></a><em>, who provides cloud infrastructure architecture expertise to GoMake.</em></p><p>This tutorial is part of a three-part series on using a <a href="https://www.raspberrypi.org/blog/raspberry-pi-zero/">Raspberry Pi Zero</a> with <a href="https://aws.amazon.com/iot">Amazon Web Services (AWS) IoT</a>. In the first part, I will walk through setting up Amazon IoT to communicate with the Pi. In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-ii-provisioning-a-raspberry-pi-1e9c7e7b29a9">the second part</a>, I will change gears and work through provisioning the Raspberry Pi Zero. In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-iii-installing-the-aws-iot-device-919de23f5642">the final part</a>, I will walk through installing the AWS IoT Device SDK and running one of the sample application on the Pi that will demonstrate communication with AWS.</p><p>Before I get started, I’d like to take a step back and explore why this is even important. Perhaps some readers will be very familiar with all of the components involved and will look to this tutorial for some guidance in setting up the pieces. For others, however, particularly those new to IoT, some introduction to basic IoT systems architecture in general and in the context of AWS may be beneficial.</p><h3>What is the Internet of Things</h3><p>The Internet of Things (IoT) represents the growth of the Internet into a platform for providing connectivity between electronics, software, sensors, and actuators embedded into physical devices. IoT allows the physical world to be more directly integrated into the Internet, providing opportunities to improve efficiency, accuracy and control of our physical world via existing networks.</p><p>Designing and implementing IoT systems comes with numerous challenges. One of the main ones is the interdisciplinary expanse of the technical demands, which range from sensor design, hardware and electronics design and manufacture, low-level programming for resource-limited devices, complex security considerations, provisioning and orchestration, addressing limited connectivity and harsh deployment conditions, cloud infrastructure architecture and dev-ops activities, big data pipeline development, machine learning, and the development of back-end software systems.</p><p>Delegating some of these responsibilities to public cloud providers has made the design of IoT systems far more feasible both economically and in terms of technical complexity. Perhaps the most comprehensive set of cloud offerings in this space is available from <a href="https://aws.amazon.com/">AWS</a>, and that is where this tutorial will focus.</p><p>On the opposite end of an IoT system, the implementation of sensors and actuators and the small computers that drive them can be simplified through the use of certain devices such as the Raspberry Pi, a $5 <a href="https://www.arm.com/">ARM processor</a> that runs an open-source distribution of Linux.</p><p>As such, this tutorial will focus on these two ends: AWS IoT on one end, and the Raspberry Pi on the other. The tutorial will walk the reader through the intervening steps between these two ends and how to set them up so that they work properly, efficiently, securely, and cost-effectively.</p><h3>What is AWS IoT</h3><p>AWS IoT is a platform for providing bi-directional communication between Internet-connected devices and the cloud. It provides the following components:</p><ul><li><strong>Device Gateway:</strong> enables devices and applications to communicate with one another.</li><li><strong>Message Broker:</strong> publish-subscribe mechanism over which devices communicate.</li><li><strong>AWS Integration:</strong> seamless integration with other AWS offerings like <a href="https://aws.amazon.com/lambda/">Lambda</a>, <a href="https://aws.amazon.com/dynamodb/">DynamoDB</a> and <a href="https://aws.amazon.com/s3/">S3</a>.</li><li><strong>Shadows:</strong> persistent object-based representations of device state and managed data.</li><li><strong>Security:</strong> industry-standard encryption and request signing, mapped to entitlements across AWS’s comprehensive suite of infrastructure and software.</li></ul><h3><strong>Prerequisits</strong></h3><p>This tutorial assumes that you have downloaded and installed the AWS CLI and that is is configured with the proper credentials for your AWS account or IAM user.</p><p>For more information on that step, see <a href="http://docs.aws.amazon.com/cli/latest/userguide/installing.html">Installing the AWS Command Line Interface — AWS Command Line Interface</a>.</p><h3><strong>Setting Up AWS IoT</strong></h3><p>Setting up AWS IoT can be divided into five broad steps. One must:</p><ol><li>Register a device (such as a Raspberry Pi) with the IoT service. Such devices are known as Things.</li><li>Create a Certificate and key pair which a device can use to securely authenticate with the AWS IoT service.</li><li>Create a Policy which allows an authenticated device to access a specific set of resources in AWS.</li><li>Attach the Certificate to the Policy and to the Thing.</li><li>Obtain the URL of the endpoint that Things should use to communicate with AWS IoT.</li></ol><p>I will discuss each of these steps, individually, below.</p><h4><strong>Register a Device, Create a Thing</strong></h4><p>The first step is to create a new Thing. A thing is the most basic representation of a device (specific IoT hardware) in the AWS IoT service. In this case, it is the Raspberry Pi you’ll be working with later in this series.</p><p>To create a Thing, use the create-thing command:</p><pre>aws iot create-thing —-thing-name=mything</pre><p>The response you receive, if successful, includes both the name of the Thing and a unique identifer, called an ARN. For example, when running the above command, you may receive a response similar to the following:</p><pre>{<br>  “thingArn”: “arn:aws:iot:us-east-1:012345678901:thing/mything”,<br>  “thingName”: “mything”<br>}</pre><p>It may be useful to copy down the ARN for future reference as you continue with this process.</p><h4><strong>Create a Certificate and Key Pair</strong></h4><p>Security is provided by a mapping of a Thing to a Policy, and a mapping of Policy to specific Statements (which are, themselves, an association of an Action and (optionally) a specific ARN of a resource in AWS). Optionally, you can also map a Thing directly to a Certificate, which may provide some specific advantages depending on your use case.</p><h4><strong>Create the x.509 Certificate, Public Key, and Private Key; Download the root CA Certificate</strong></h4><p>Create and download a public key, private key, and certificate. These items are used during the authentication process and allow your Thing to communicate securely with AWS IoT.</p><p>To create these files, use the create-keys-and-certificate command:</p><pre>aws iot create-keys-and-certificate — set-as-active —-certificate-pem-outfile=cert.crt —-public-key-outfile=pubkey.pem —-private-key-outfile=privkey.pem</pre><p>The output will look similar to the following:</p><pre>{<br>  “certificateId”: “1c15fa7b78b08aa1c19e4548fa9a322242d624f4bc05d2e1d6a343af010c58a8”,<br>  “certificatePem”: “——-BEGIN CERTIFICATE——-[CERTIFICATE CONTENTS] ——-END CERTIFICATE——-\n”,<br>  “certificateArn”: “arn:aws:iot:us-east-1:012345678901:cert/1c15fa7b78b08aa1c19e4548fa9a322242d624f4bc05d2e1d6a343af010c58a8”,<br>  “keyPair”: {<br>    “PrivateKey”: “——-BEGIN RSA PRIVATE KEY——-[PRIVATE KEY CONTENTS]——-END RSA PRIVATE KEY——-\n”,<br>    “PublicKey”: “ ——-BEGIN PUBLIC KEY——-[PUBLIC KEY CONTENTS]——-END PUBLIC KEY——-\n”<br>  }<br>}</pre><p>Retain this output for your records, as some of the information it contains will be needed in subsequent steps.</p><p>You will also need the VeriSign Class 3 Public Primary G5 root CA certificate, which you can download <a href="https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem">here</a>.</p><p>Briefly, AWS IoT uses asymmetric cryptography to ensure that devices are allowed to communicate with AWS, and also to ensure that devices communicate with AWS and not an imposture. For more information, see:</p><ul><li><a href="http://docs.aws.amazon.com/iot/latest/developerguide/managing-device-certs.html">X.509 Certificates and AWS IoT — AWS IoT</a></li><li><a href="https://en.wikipedia.org/wiki/Public-key_cryptography">Public-key cryptography — Wikipedia</a></li></ul><h4><strong>Create a Policy</strong></h4><p>While an x.509 certificate authenticates a device, allowing it to communicate with AWS IoT, it is policies that allow access to resources on AWS, including within AWS IoT, such as subscribing or publishing to MQTT topics.</p><p>Any Thing that presents the certificate can have the actions specified in the attached policy. So, if you want your Thing to be able to publish to an MQTT topic, then you should attach a policy with that action to the certificate.</p><p>You should start by creating a policy. For the purposes of this post, the policy will be set with expansive entitlements within the iot space. For production applications, you will want to tune your policies so that the security is more finely grained.</p><p>Create a new file, mypolicy.json, with the following JSON data:</p><pre>{<br>  “Version”: “2012–10–17”,<br>  “Statement”: [<br>    {<br>      “Effect”: “Allow”,<br>      “Action”: “iot:*”,<br>      “Resource”: “*”<br>    }<br>  ]<br>}</pre><p>Next, use that JSON document to create the policy on AWS IoT:</p><pre>aws iot create-policy —-policy-name=mypolicy —-policy-document=”$(cat mypolicy.json)”</pre><p>The response will look something like:</p><pre>{<br>  “policyName”: “mypolicy”,<br>  “policyVersionId”: “1”,<br>  “policyDocument”: “{\n \”Version\”: \”2012–10–17\”,\n \”Statement\”: [\n {\n \”Effect\”: \”Allow\”,\n \”Action\”: \”iot:*\”,\n \”Resource\”: \”*\”\n }\n ]\n}”,<br>  “policyArn”: “arn:aws:iot:us-east-1:012345678901:policy/mypolicy”<br>}</pre><p>Retain this output for now, as we will reference some of this information in subsequent steps.</p><p>For more information on structuring policies for AWS IoT, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/create-iot-policy.html">Create an AWS IoT Policy — AWS IoT</a>.</p><h4><strong>Attach the Certificate to the Thing</strong></h4><p>Locate the ARN of the certificate you created, above. Use the attach-thing-principal command to attach the certificate to the Thing, supplying the certificate ARN and the name of the Thing:</p><pre>aws iot attach-thing-principal —-thing-name mything —-principal arn:aws:iot:us-east-1:012345678901:cert/1c15fa7b78b08aa1c19e4548fa9a322242d624f4bc05d2e1d6a343af010c58a8</pre><p>You will get no response from executing this command unless there is an error.</p><h4><strong>Attach the Certificate to the Policy</strong></h4><p>Use the attach-principal-policy command to attach the certificate to the Policy, supplying the certificate ARN and the name of the Thing:</p><pre>aws iot attach-principal-policy —-policy-name mypolicy —-principal arn:aws:iot:us-east-1:012345678901:cert/1c15fa7b78b08aa1c19e4548fa9a322242d624f4bc05d2e1d6a343af010c58a8</pre><h4><strong>Obtain the IoT Endpoint</strong></h4><p>Your device will communicate with AWS IoT via an endpoint, which you can obtain using the describe-endpoint command:</p><pre>aws iot describe-endpoint</pre><p>The response will be similar to the following:</p><pre>{<br>  “endpointAddress”: “a28mxzifscn480.iot.us-east-1.amazonaws.com”<br>}</pre><p>Retain this endpoint address, as you will need it to configure your device in subsequent steps.</p><h3><strong>Next Steps</strong></h3><p>In <a href="https://medium.com/@gomaketeam/connecting-raspberry-pi-zero-with-amazon-web-services-iot-part-ii-provisioning-a-raspberry-pi-1e9c7e7b29a9">the next section</a>, I will go through how to provision a Raspberry Pi Zero so that it is ready to communicate with the AWS IoT service, given the infrastructure that you deployed in the above steps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caa8a0f6f91b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting the ESP32-DevKitC and AWS IoT Using Mongoose OS, Part I]]></title>
            <link>https://medium.com/@gomaketeam/connecting-the-esp32-devkitc-and-aws-iot-using-mongoose-os-part-i-11fecd2d86d5?source=rss-65b383f11ec9------2</link>
            <guid isPermaLink="false">https://medium.com/p/11fecd2d86d5</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[aws-iot]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[goMake]]></dc:creator>
            <pubDate>Wed, 02 Aug 2017 15:23:42 GMT</pubDate>
            <atom:updated>2017-10-16T03:39:30.999Z</atom:updated>
            <content:encoded><![CDATA[<p>Jump to <a href="https://medium.com/@gomaketeam/connecting-the-esp32-devkitc-and-aws-iot-using-mongoose-os-part-ii-88c241fef03">Part II</a></p><p>Once you’ve stopped drooling over the extensive <a href="https://espressif.com/en/products/hardware/esp32/overview">ESP32 feature list</a>, its time to get down to connecting your ESP32-DevKitC to something capable of doing some heavier lifting than the chip itself — a cloud offering like AWS IoT is the starting place for a cloud-based solution to communicating with and analyzing data from your ESP.</p><h3>Our Goals</h3><ul><li>Setup a development environment for working with the ESP32 Development Board.</li><li>Configure an ESP32 as an AWS IoT Thing and make it ready to communicate</li></ul><h3>Concepts</h3><h4>What is the ESP32?</h4><p>A lower power, low cost microcontroller unit (MCU) with 2.4Ghz WiFi and Bluetooth BLE onboard. Currently a single <strong>ESP32 module</strong> (without breakout) is around <a href="https://www.dfrobot.com/product-1559.html">$6.50 USD</a>.</p><p>The <strong>ESP32-DevKitC</strong> (<a href="https://www.amazon.com/gp/product/B01N0SB08Q/ref=oh_aui_detailpage_o01_s00?ie=UTF8&amp;psc=1">Amazon, $14.99</a>) is a breakout board offering from Espressif to facilitate development and prototyping of IoT devices from design to market. They take the core SoM (System on Module) that could be used in a commercial application and wrap it with a serial comms chip, USB connector, buttons wired for controlling the programming state, power LED, and breadboard compatible pin headers. Wanna dig in further? Check out the massive <a href="https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf">datasheet</a>.</p><p>One of the big differentiators that sets the ESP32 apart from its Espressif predecessors and WiFi-enabled MCU competitors is its plethora of security features:</p><ul><li><strong>SPI Flash Encryption: </strong><a href="https://mongoose-os.com/blog/mongoose-os-implements-esp32-flash-encryption/">Tutorial</a></li><li><strong>Secure Boot: </strong><a href="http://esp-idf.readthedocs.io/en/latest/security/secure-boot.html">Documentation</a></li><li><strong>Hardware-accelerated Encryption for SHA, AES, RSA, etc</strong></li><li><strong>Secure Over-the-air Code Updates: </strong><a href="https://blog.classycode.com/over-the-air-updating-an-esp32-29f83ebbcca2">Tutorial</a></li><li><strong>Support for ATECC508A Integration: </strong><a href="https://github.com/cesanta/mongoose-os/blob/master/docs/security/508a_setup.md">Tutorial</a></li></ul><p>NOTE: The ESP32-DevKitC that I purchased seemed to be missing an onboard LED for the SoM (or the power LED on the breakout board was meant to be the GPIO addressable LED and wasn’t working).</p><h4>What is AWS IoT?</h4><p>A platform for providing bi-directional communication between internet connected devices and the cloud. It provides:</p><ul><li><strong>Device Gateway</strong>: enables other devices and applications to communicate with a device.</li><li><strong>Message Brokering</strong>: pub/sub mechanism for devices to communicate over</li><li><strong>AWS Integrations</strong>: allows (almost) seamless integration with other AWS offerings like DynamoDB or S3</li><li><strong>Shadows</strong>: persistent object based representations of device state and managed data. IMHO, reminiscent of the idea of a Virtual DOM representing a single device.</li></ul><h4>What is Mongoose OS?</h4><p>An “open-source operating system for the Internet of Things.” While that sounds cool, that really breaks down into:</p><ul><li><strong>Consolidated toolchain</strong> for reading and writing to the ESP32 (or other supported devices)</li><li>Libraries and tools for working with <strong>cloud integrations</strong> like AWS IoT and Google Cloud IoT.</li><li>Simple <strong>web client IDE</strong> for interacting with your device.</li><li><strong>Javascript support</strong> for your device, including libraries for doing common tasks, and utilities for porting C code (think arduino libraries or C-only helper methods) into your Javascript!</li><li>Ready to flash <strong>custom firmware</strong> for ESP32 and supported devices</li></ul><h3>Requirements</h3><ul><li><a href="http://esp-idf.readthedocs.io/en/latest/get-started/get-started-devkitc.html">ESP32-DevKitC</a> (ESP32 Development/Demo Board from Espressif)</li><li>USB A to Micro USB B Connector</li><li><a href="http://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html">AWS CLI</a></li><li>AWS Account <a href="http://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html">with credentials stored on your local environment</a></li></ul><h3>Setup</h3><h4>1. Setup Your Laptop</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YE5JF0YiEQ3EsUVYuXBktA.jpeg" /><figcaption>The second line of text on the serial chip determines the driver you need. CP2102 indicates a Silicon Labs Driver.</figcaption></figure><p>Look at the serial chip on your ESP32-DevKitC (If you are an old man like me, you may need to break out the magnifying lens) and identify the second line of text on the chip — if you have <strong>CP2102 </strong>then you should download the Silicon Labs drivers, otherwise if you see <strong>CH34x</strong> you should download the corresponding CH34x drivers.</p><h4>macOS:</h4><ul><li>Silicon Labs Drivers (CP2102 on serial chip): <a href="https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers">Download</a></li><li>CH34x Drivers (CH340 or CH341 on serial chip): <a href="https://blog.squix.org/wp-content/uploads/2016/12/CH34x_Install_V1.3.zip">Download</a></li></ul><h4>Windows:</h4><ul><li>Silicon Labs Drivers (CP2102 on serial chip): <a href="https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers">Download</a></li><li>PC CH34x Drivers (CH340 or CH341 on serial chip): <a href="http://blog.squix.org/downloads/CH341SER.zip">Download</a></li></ul><p><strong>Installing the macOS Silicon Labs Driver:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wN90tZE1Vu-BlpJYYw5Ufw.png" /></figure><p><strong>Testing your Driver Installation:</strong></p><p>Making sure your Micro USB cable connector is plugged into the mating connector on the ESP32-DevKitC, and the USB A connector is <strong>unplugged</strong> from your laptop. Plug the USB A connector back into the laptop and open a a new terminal:</p><pre><strong>$</strong> ls /dev | grep tty.SLAB<br>tty.SLAB_USBtoUART</pre><p>Note the output of that command — its the name of the serial device we will attempt to connect to via Mongoose OS. In this case the output was <em>tty.SLAB_USBtoUART </em>-&gt; this translates to a full device path of:</p><pre> /dev/tty.SLAB_USBtoUART</pre><p>If you aren’t seeing any output like the one above, disconnect and reconnect the USB cable to the laptop, and try a more generic command like <em>$ ls /dev | grep tty. </em>You will see many devices listed this time; look for the device name with USB or UART in it. If you <em>STILL </em>aren’t seeing your device, something else is wrong.</p><h4>2. Install Mongoose OS</h4><p>This will assume you have already installed the serial drivers from the previous step. Mongoose OS is a combination of command line tool chain and web IDE for interacting with a USB serial connected device (i.e. ESP32).</p><h4>macOS</h4><pre><strong>$</strong> curl -fsSL https://mongoose-os.com/downloads/mos/install.sh | /bin/bash</pre><h4>Windows</h4><p>Installer Executable: <a href="https://mongoose-os.com/downloads/mos-release/win/mos.exe">Download</a></p><pre><strong>$</strong> mos console</pre><h4>3. Flash ESP32 Firmware</h4><p>NOTE: flashing through the CLI was the only way I could get the flash operation to work (macOS Sierra, Chrome 59).</p><h4>macOS</h4><pre><strong>$</strong> ~/.mos/bin/mos flash esp32 --<em>port /dev/cu.SLAB_USBtoUART</em></pre><p>NOTE: <em>cu.DEVICENAME</em> is the <strong>call-up </strong>device that represents the way we connect to an external device</p><h4>Windows</h4><pre><strong>$ </strong>mos flash mos-esp32</pre><p>Example output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6FvWAetl6aB2EcDKK_LiSA.png" /></figure><h4>4. Setup WiFi</h4><p>NOTE: The ESP32 WiFi radio only supports 2.4ghz. <strong>5ghz WiFi networks will not work.</strong></p><h4>macOS</h4><pre><strong>$</strong> ~/.mos/bin/mos wifi YOUR_WIFI_SSID YOUR_WIFI_PASSWORD</pre><h4>Windows</h4><pre><strong>$</strong> mos wifi YOUR_WIFI_SSID YOUR_WIFI_PASSWORD</pre><h4>5. Setup AWS IoT</h4><p>Mongoose OS’ CLI tool has provided a handy setup command that does the following things:</p><ul><li>Checks your stored AWS credentials for what account to use</li><li>Creates a default policy (<a href="http://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html">AWS IoT Policies</a>) for Mongoose OS and the ESP32 to use in communicating with AWS IoT</li><li>Provides the certificate, public, and private keys required for communication and writes them to the ESP32</li><li>Creates a “thing” on AWS IoT for your device</li></ul><p>At this point, make sure <strong>you have your AWS credentials</strong> stored locally that you want to use, and that <strong>your ESP32 is connected to your laptop</strong>. Replace REGION in the commands below with <em>us-east-1</em> or your appropriate AWS region. In your terminal, run:</p><h4>macOS</h4><pre><strong>$</strong> ~/.mos/bin/mos aws-iot-setup --aws-region REGION --aws-iot-policy mos-default</pre><h4>Windows</h4><pre><strong>$</strong> mos aws-iot-setup --aws-region REGION --aws-iot-policy mos-default</pre><p>NOTE: If you renamed <em>mos-default</em> to another policy name you may run into errors. Try creating a policy on AWS IAM console with the name you want before running this with a different name.</p><p>Example output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eRJ7DX_DLOBiNpl14qVhMQ.png" /></figure><p>If you go into your AWS Console -&gt; AWS IoT -&gt; Registry, you should see a device registered like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GeHI5UNDf4aaMi_ZYwN5Qw.png" /></figure><h4>6. Launch the IDE</h4><p>Run the following command in your terminal:</p><h4>macOS</h4><pre><strong>$</strong> ~/.mos/bin/mos ui</pre><h4>Windows</h4><pre><strong>$</strong> mos ui</pre><p>Your default browser should open a tab with something like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PM6erJu8jiRvnYGvhx-66A.png" /><figcaption>There’s a lot going on here, and there’s about to be a whole lot more.</figcaption></figure><p>NOTES:</p><ul><li><strong>Device status</strong> reports whether the connected device chosen in Step 1 is connected to the internet. It does not mean the connection between the device and the computer</li><li>The <strong>Select button</strong> in Step 1 did not work the way I assumed it would. It <em>confirms</em> the device that you enter into the drop down/textbox in Step 1.</li><li><strong>Device logs</strong> (in the shaded out bottom left corner of the screen) is the serial monitor output. Watch this for communications from your device.</li><li><strong>MOS tool logs </strong>(bottom right corner of the screen) is the area for messages from the toolchain (IDE, compiler, flasher, etc)</li></ul><h4>7. Configure the IDE for the ESP32</h4><p>In Step 1 section, use the device we noted down from “Testing your Driver Installation” (Remember we used the command:<em> ls /dev | grep tty.SLAB</em>) we enter its full path into the dropdown/textbox like so:</p><pre>/dev/cu.SLAB_USBtoUART</pre><p>Press the Select button. You should see the Device Status show a connected status (has a green or yellow dot). You should also see some device information show up in the Step 2 section.</p><p>In the Step 2 section, select <em>esp32.</em> DO NOT HIT THE FLASH BUTTON. We have already flashed our device in a previous step.</p><p>If your WiFi in Step 1 left you with a yellow dot and “No IP” in the Device Status, you may need to modify your WiFi information in Step 3 section and hit the Save button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_qXX8UN5OJ9h6h-4bJZQg.png" /></figure><p><strong>Success!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C24prF30cDW7wVedAMZTXw.png" /></figure><h3>Continuing in Part II</h3><p>Now that we have our device and environment up and running, we will tackle communication examples between the ESP and cloud.</p><ul><li>Modifying a thing’s shadow state</li><li>Pushing shadow state back to the ESP32</li><li>Subscribing to MQTT events in AWS IoT</li></ul><p>Goto <a href="https://medium.com/@gomaketeam/connecting-the-esp32-devkitc-and-aws-iot-using-mongoose-os-part-ii-88c241fef03">Part II</a> Now…</p><h3><strong>About the Author</strong></h3><p>Jonathan Barton (@jellyfishtree) is a software engineer, hardware hacker, and a co-founder of GoMake. <a href="https://www.linkedin.com/in/jonathan-barton-09101329/">LinkedIn</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oJHhp88mByyvAPbhrx_i9Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11fecd2d86d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>