AWS IoT Raspberry Pi

The IoT space is going to get crowded very soon. Almost every company out there is trying to get in on the IoT world including Microsoft, Adafruit, IBM, GE, Google and Amazon; just to name a few. A few weeks ago I decided to play around with Amazon’s IoT platform with my Raspberry Pi 3.

AWS is designed for commercial use. Its great on security and integration with all of its other products. I wanted to learn and familiarize myself with it to see what it has to offer.

I spent a little time reviewing how AWS IoT works and did the interactive tutorial explaining the whole concept. The platform communicates using MQTT which is a common lightweight communication protocol that minimizes code footprints. Essentially your internet capable device sends and receives packets using MQTT to AWS IoT from which it can communicate further to other AWS services as seen in the image below.

When I was working with IoT, Amazon offered Embedded C, JavaScript and Arduino Yún SDKs. I decided not to use any of these and start hacking away with my favorite language: Python (which for now there is an SDK).

My Beginner Project:

Objective: Use Raspberry Pi to connect to AWS IoT. Send light sensor data to AWS IoT and control state of LED from readings on IoT.

Basic Setup: I am using the Raspberry Pi to make all my hardware internet capable. The pi is connected to an Arduino Uno which has a light sensor and LED wired into it. I used the Nanpy library to control the Arduino components and used the paho.mqtt.client library to communicate using the MQTT protocol.

I created a “thing” which is what AWS IoT calls its devices in the cloud. In order to successfully authenticate your device you need three things:

  1. root-CA.crt
  2. certificate.pem.crt
  3. private.pem.crt

These are crucial in order to successfully establish a connection and I had to store these files locally on my Pi.

I wrote a publish program in python which would post the light sensor values in JSON format and then I wrote a subscribe program that would get the sensor value that was being pushed and controlled the LED to turn on if it got too dark and turn off it there was enough ambient light. I wrote my code based upon mariocannistra’s project found here:


AWS IoT works and does what you would look for in a standard IoT platform. It has a lot of authentication making it ideal for a commercial product. However if you want to start learning IoT or want to rapidly build something at a hackathon or a basic personal project, I would steer away from AWS IoT. There are simpler platforms such as Adafruit’s IO which only requires an API key to send and receive data(Still in Beta). If you need help building your project in AWS IoT or want to know how I configured something in my project feel free to leave a response below!