Intro: Connecting Nicla Sense ME to AWS

This is the first article of a series I will be publishing in my pursuit to save some money on energy (hello 9% increase in the cost of living!), by using a really cool sensor connected to AWS, feeding a machine learning model to figure out how can we reduce our energy bills by Winter.
Nicla Sense ME is my favorite Arduino board at the moment.
It is a low-power, tiny board (2.2cm x 2.2cm) that uses Bosch Sensortec technology with AI edge computing capabilities.
You can find it in the Arduino store for €69.00 if you are in Europe and $82.80 in the US.
It combines 4 industrial-grade sensors:
- BHI260AP — Motion with embedded AI
- BMM150 — Magnetometer
- BMP390 — Pressure
- BME688 4-in-1 Gas Sensor with embedded AI, Humidity, and Temperature
It can measure:
- Rotation
- Acceleration
- Pressure
- Humidity
- Temperature
- Air Quality
- CO2 Levels
Before going any further, I must say that using this board is a bit overkill for our project, as we are only interested in Temperature and Humidity data. But since I had bought this sensor already, we might as well use it.
It has BLE connectivity and can be powered via micro USB or a 3.7V Li-po battery.
You can find the Datasheet here.
This board cannot be connected directly to AWS as it doesn’t have WiFi connectivity, so we will be developing a custom-made application using python, which can be deployed later using, for example, a Raspberry Pi.
An overview of what we are going to use/do:
Toolset:
- Arduino IDE (1.8.19)
- Python (3.10.5)
- Visual Studio Code IDE (1.69)
- Git (2.37.1)
- Powershell (7.2.5)
Libraries:
To manage the code:
- pyenv-win: A python version management tool
- venv: For creating the virtual environment
- black: A python code formatter
- pylint: A code analyser for python
- python-dotenv: To load environment variables from .env file
For the application:
- pySerial: Access for the serial port
- bleak: A client software, to connect BLE devices
- awsiotsdk: SDK for connecting to AWS IoT from a device using Python
Interfaces:
- Arduino→Serial→PC
- Arduino→Bluetooth→PC
- PC→MQTT→AWS
Keep an eye for the next article, detailing how we got things ready and connected the Nicla Sense ME board to AWS!