In our recent article about the programming languages for IoT development, we’ve mentioned the multicomponent nature of Internet of Things. This is also the reason why choosing the right tech stack for an IoT project can be challenging.
It takes knowledge and experience to select hardware, cloud services and big data tools for an IoT system with multiple devices, complex data model various end-user applications. Needless to say, there’s no lack of tools to build and manage each IoT layer.
Among the well-known names commonly associated with connected technology are Raspberry Pi on the hardware side and AWS IoT platform as an IoT ecosystem management service.
There are many reasons why IoT platform by Amazon and Raspberry Pi hardware are so popular among IoT amateurs and professionals. Earlier, we have talked about what to look for when choosing Arduino or Raspberry Pi for IoT development and later also reviewed AWS IoT platform.
In this article, we’ll touch upon the benefits of AWS IoT — Raspberry Pi combo and find out why making these two work together is a good idea.
You’ll find out:
Why Raspberry Pi and AWS IoT are a good match
How to connect your Pi computer to AWS IoT platform
Why Raspberry Pi and AWS IoT are such a good match
Purpose and requirements. Relatively high computing power, rich componentry and customization opportunities make Pi a great choice for an edge layer device like a gateway or local server. The latest Pi 4 model B has a 1.5 GHz ARM Cortex-A72 processor and up to 4GB SDRAM enough to handle intensive data flows and perform computing at the edge. In turn, AWS IoT platform offers the services designed specifically to quickly and securely roll out edge intelligence and enable diverse functions such as computing, device communication, data management or even running machine learning models locally. Designed for this purpose, AWS IoT Greengrass service can run on general-purpose computers that have at least 1 GHz of computing power and 128MB of RAM. These requirements match the specifications of many Raspberry Pi models and make this small computer ideal to work with this and other AWS IoT services.
Cost-efficiency. You can buy Raspberry Pi online at an average price of $35 (this is the price for the most popular Raspberry Pi 3 Model B+). Amazon IoT platform also stands out for its favorable and flexible pricing policy. According to the official AWS website, “you pay only for what you use.” When it comes to AWS IoT Greengrass services, you even get a free first year of use with AWS Free Tier when connecting up to 3 devices. This is good news for those who create a prototype device to test an IoT business idea.
Simplicity. This could be one of the biggest benefits for those who are just starting an IoT project. You can connect Raspberry Pi and AWS IoT platform in several consecutive steps. It’s a pretty straightforward process, and there’s no shortage of examples and guides on how to do it, including the one provided by AWS. Here’s this process described in more detail.
How to connect Raspberry Pi to AWS IoT
As we have mentioned earlier, the process of setting up Raspberry Pi to work with AWS IoT is straightforward and doesn’t require a lot of tools and coding. Apart from Raspberry Pi 2 B or any later model, you will need a keyboard, mouse, monitor, access to the Internet (Wi-Fi or Ethernet) and an active AWS account.
First of all, you need to set up both Raspberry Pi and AWS IoT. For the board, you will need an SD card with Raspbian or other general-purpose OS, USB power supply, monitor, keyboard, mouse and Internet connectivity. To set up AWS IoT, you will need to create an AWS account (check the Free Tier offers) and access your AWS IoT console.
Step 2. Configure AWS IoT
You need to prepare your AWS account. Using your account’s dashboard, you can create a ‘thing’ that will represent your device, give it a name, create the policy to determine which AWS IoT sources the device can access and register it assigning the necessary certificates.
Step 3. Configure Raspberry Pi
On the hardware side, your Raspberry Pi should have a certificate, private key and root CA certificate installed to authenticate with AWS IoT (read here to learn more) and be able to send messages to AWS IoT. To configure your device to be able , you can use AWS IoT device SDKs, for example, AWS IoT Python SDK or AWS IoT Device SDK for Embedded C depending on your case.
Step 4. Create rules
In order to make AWS IoT act on the data received from Raspberry Pi, you will need to create a rule to specify what AWS IoT should do with the messages coming from the device.
Here’s how it works in a simple IoT application for soil moisture monitoring.
Using Raspberry Pi and AWS IoT in an agriculture application
In the AWS IoT developer guide, you can find an example of connecting Raspberry Pi to AWS IoT services to read and act on the data sent by a moisture sensor.
In this example, Raspberry Pi is configured to collect sensor data on moisture and temperature levels and send the readings to AWS IoT for processing via a lightweight MQTT message. Based on the created rule, AWS IoT figures out when the moisture level goes below the set threshold. Once it does, the service triggers sending an email with the readings to every email subscribed to the relevant topic.
This is a very basic application that can be augmented with other features and functions using different AWS IoT services. For example, you can add Amazon Lambda function to automate some actions or route data to different destinations for analysis using Amazon Kinesis.
Digiteum is a seasoned team of tech experts, senior engineers, architects, and UX/UI designers working together since 2010. We share our rich knowledge and experience in cutting-edge technologies, custom software design and development, modern engineering and automation practices and talk about how to bridge business and technologies to help companies compete, hit their goals, and stay resilient.
IoT Implementation Checklist: 10 Key Points
Digiteum is a custom software development and IT consulting company founded in 2010. We design and develop customer-centric solutions for web, mobile, cloud, and IoT.
They are technically excellent, have an agile process in place and are always looking for "win/win" opportunities. The team is incredibly honest, hard working and has been a source of new ideas and improvements.