Fast Prototyping of BLE Sensors for AWS Cloud Using the ATmega4809 Curiosity Nano Development Platform

2021-10-27
●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).
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.
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.
●This application note explains how to obtain the hardware and software configurations required by the BLE Internet of Things (IoT) project. The functionality of the example project and the AWS configurations are also detailed here.
In the example project, the featured device reads pressure, temperature, and humidity data from the weather sensor.
The sensor sends data through an I2C interface, and a five-second reading interval is used for transmitting the data to the cloud. The device exchanges information with the RN4870 BLE device through the USART interface and starts creating services and characteristics for the sensor and updates them after every reading.
The Raspberry Pi board connects to the BLE device, reads the characteristics, and, using the Greengrass core,publishes the data to the cloud. Greengrass is a gateway software provided by AWS capable of using the hardware components of the Raspberry Pi board. Thus, the gateway core can interact with nearby BLE node devices and can provide secure communication to the cloud. ●Prerequisites:
■Integrated Development Environment (IDE):
▲Atmel Studio v7 with the latest device packages installed.
▲MPLAB® X v5.30 with XC8 v2.10 compiler (used in this project).
◆MCC version 3.85.
◆AVR8 Peripheral Library AVR® microcontroller version 2.0.1.
■Microchip ATmega4809 Curiosity Nano development board
■Microchip Curiosity Nano Base for click boards™
■BLE RN4870 click board from MikroE
■Raspberry Pi 3 Model B+
■Weather click board from MikroE
■Amazon Web Services (AWS) Account

MICROCHIP

ATmega4809

More

Part#

BLE Sensorsmicrocontroller

More

More

Application note & Design Guide

More

More

Please see the document for details

More

More

English Chinese Chinese and English Japanese

03/2020

Rev.A

AN3406,DS00003406A

1.5 MB

- The full preview is over. If you want to read the whole 28 page document,please Sign in/Register -
  • +1 Like
  • Add to Favorites

Recommend

All reproduced articles on this site are for the purpose of conveying more information and clearly indicate the source. If media or individuals who do not want to be reproduced can contact us, which will be deleted.

Contact Us

Email: