AN3406
Fast Prototyping of BLE Sensors for AWS Cloud Using the
ATmega4809 Curiosity Nano Development Platform
Introduction
Author: Ioan Pop, Alin Stoicescu, Microchip Technology Inc.
This application note describes how to use the ATmega4809 Curiosity Nano Development Platform to create a low-
power BLE (Bluetooth
®
Low Energy) sensor node that connects to the Amazon Web Services (AWS) Cloud through
a gateway. This document includes a detailed tutorial and links to a GitHub repository containing the documented
code.
The sensor edge node is controlled by the ATmega4809 microcontroller, a robust, low-power microcontroller
engineered for real-time control applications. To prototype the sensor node, the ATmega4809 Curiosity Nano was
used in conjunction with the Curiosity Nano Base for click boards
, which has three mikroBUS
slots. These
mikroBUS sockets are used to connect the RN4870 click board, which incorporates a Microchip RN4870 Bluetooth
Low Energy module, as well as the Weather click board, which contains a BME280 sensor to provide humidity,
temperature, and pressure readings. The application is intended to be an off-the-shelf system – each of the
components is designed for seamless prototyping on the Curiosity Nano Platform and can quickly be configured in
software through MPLAB
®
Code Configurator (MCC).
Figure 1. Sensor Node Block Diagram
USART
I
2
C
ATmega4809
Microcontroller
BM280 Weather
Sensor
RN4870 BLE
Module
When the application starts, the microcontroller creates three public characteristics for pressure, temperature, and
humidity data in the BLE module for the sensor data. The microcontroller reads the data from the sensor every five
seconds and updates the characteristics with the respective values. A gateway is required to transmit the information
to the cloud. The gateway establishes a connection with the BLE module of the end node and connects to the cloud
services from a local Internet network through Ethernet or Wi-Fi
®
. Every five seconds, the gateway reads the
characteristics and publishes the data to the cloud.
© 2020 Microchip Technology Inc.
Application Note
DS00003406A-page 1
Figure 2. Application Functionality Diagram
A Raspberry Pi
®
(RPi) 3 Model B+ board is used as a gateway since it incorporates BLE, Wi-Fi, and Ethernet
modules, and it is easy to use and provides good documentation.
AWS is used for cloud services. It provides a gateway core software called AWS IoT Greengrass that allows the
users to interact with the cloud. Publishing and subscription to topics can be done just by utilizing Application
Programming Interfaces (API) in Lambda.
The source code for peripherals used in the microcontroller is generated using MCC. The code generator creates the
structure of the project, the files, and the source code. MCC provides support for every peripheral and development
extension boards such as the RN4870 click board.
The following GitHub repository contains the project source code for the ATmega4809 Curiosity Nano board together
with the Lambda used by the gateway to read characteristics and publish the data to the cloud.
AN3406
© 2020 Microchip Technology Inc.
Application Note
DS00003406A-page 2