re:invent 2019 - IoTanium by Onica: Connecting

If you've been following along in the IoTanium journey, I was able to unbox and assemble my IoTanium Dev Kit.  I will be following the additional setup instructions and verifying that everything works in the online IoTanium documentation.

So the first thing I did was to power up and connect the dev kit to a USB power supply.  The keyboard USB on my mac keyboard was able to successfully power the device, so I just went with that.


I then cloned their preview repository by executing: git clone -b preview https://github.com/onicagroup/iotanium.git

Now that I have a copy of the repo on my hard drive, I first connected to the wifi of the IoTanium dev kit and then opened up iotanium/webrepl/webrepl.html from the downloaded repository.

There's a password for both the wifi and establishing a connection to it.  Please review the online IoTanium documentation for what that password is (link above).


The IoTanium device actually uses MicroPython, which seems to be use in other IoT devices like the BBC micro:bit.  While the micro:bit is advertised for students, I believe it could be useful for anyone wanting to learn Python programming for microcontrollers.

At any rate, I need to configure the IoTanium Dev Kit to connect to my home network, which is done via the iotanium_cfg.json file (file is located in the iotanium/ folder).  A quick "vi" to update the config and upload the config file to the dev kit and a click of the Disconnect / Connect button along with reconnecting to my home network and I was successfully connected via my home network instead of the IoTanium wifi.  This now allows the IoTanium Dev Kit to get "online" - e.g. to AWS and other services.




Now that the dev kit can reach the Internet - it's time to configure a connection to AWS.  Heading over to AWS console, I navigate to IoT Core.


Once at AWS IoT, I click on Secure then Certificates to generate new certificates.


I click on "Create Certificates" using the "One-click certificate creation".  Advanced IoT shops may manage their own certificates and simply upload a CSR.


You will get a notification that the certificates are created.  Download "A certificate for this thing" and "A private key".  You can download "A public key" and the Amazon Root CA key as well if needed for your implementation. (I did not as I'm just following the instructions and testing the dev kit out.)


You will need to create a policy, e.g. define what a device with this certificate can do so click on the "Create new policy" button.


Add the authorization to publish and connect to iot.




Don't forget to attach the newly created policy to the certificate that you created previously if AWS doesn't attach it automatically as part of the certificate creation process.  This is a step that I see people commonly missing in IoT lab exercises.

I also make a note of my endpoint that I'll be sending to.



I modified the hello_world.py file (located in the /iotanium folder) with my endpoint, uploaded the python file and the certificate / key and then I ran the program.


Ouch.  Failure.  It seems like the program was sending a message every 5 seconds.  I noticed that the performance of the ESP32 microcontroller is a bit slow (e.g. when I type something into the web terminal page, it sometimes "lags").  So I adjusted the message send rate in hello_world.py from 5 seconds to 15 seconds and success!


Over in AWS Console, subscribe to the topic 'iotanium'.


The messages successfully showed up in the Test console.


Stay tuned for my next blog post where I take a closer look at the dev board and start connecting some electronics to it.

-brian

Note: I am not being compensated by Onica / Rackspace for this blog post, nor does this post constitute an endorsement of this product by me or my employer.  I share my experiences in the hopes of educating and informing others about Internet of Things (IoT).

Popular posts from this blog

Home built Hadoop analytics cluster: Part 4

Home built blob storage server

Setbacks