3. Getting started with the B L475E IOT01A Discovery kit - lucamaiano/lungsystem GitHub Wiki

Getting started with the B-L475E-IOT01A Discovery kit

This guide let you to set up the board to run the applications for collecting the values from the sensors and for connecting to a Wifi.

Overview

  1. Run the sensor application
  2. Run the Wifi application

Run the sensor application

To run the application on the B-L475E-IOT01A

  1. Connect the board to the pc through the ST-LINK/V2-1 USB connector
  2. Download the DISCO_L475VG_IOT01-Sensors-BSP folder from our repository
  3. Import the entire folder on Arm Mbed Compiler (click on the Import button at the left top of Workbench and then on Choose file at the bottom of the window)
  4. Compile the project (press the Compile button at the top)

This operation emits the bin project in the download folder.

  1. Drug and drop this bin file on the board. After the installation board is automatically detected as a disk drive and you can see values collected by the sensors on a Tera Term window like this.

Run the Wifi application

Let’s see how to build an Iot application.

Introduction

The Iot concept perceives the presence of a network connected to an intelligent cloud.

To make an Iot application we need three main components:

  1. The Thing( the Iot node). The Iot node is the core of running the application.In our case it’s the B-l475E-IOt01A.
  2. The Iot services located in the cloud. This enables bidirectional communication between the Iot node and cloud server over MQTT protocol, to let networking communication. In our case the AWS(Amazon web service) in the platform providing tha Iot services.
  3. The User that uses such services. User can connect to the server via browser or with an application running in his/her mobile phone and access the Iot node data in the cloud any time and in any location. In our case take a look to the Visualization part of our project to see the user module.

Before beginning

Before you get started you need to create an AWS service.

  • Register for an Amazon Web Service account.Unless you already have one, go ahead and create a free aws account at aws.amazon.com

  • Create an IoT Thing. Follow this guide for this step. After this operation you’ll have these parameters
    • root CA
    • thing certificate
    • private key

Let’s begin

To make the B-L475E-IOT01A an Iot you need to set up the environment.

  1. Connect the board to a Pc and open a Tera term terminal.

  1. Download the file ProjectAws.eww from our repository.
  2. Open the project on IAR EMBEDDED WORKBENCH IDE: in the File menu, select Open and click Workspace to display the Open Workspace dialog box.

  1. Proceed with compiling( click on the Compiler button).

  1. If the project is successfully compiled, this window is displayed:

  1. With the board connected start the debug operations to program the Flash memory(click on the Debug button).

  1. This automatically installs on the board the bin file.
  2. When the application is flashed press the reset button.The board will display this banner with connectivity with the cloud.
  3. Set the parameters of the Wifi access point.

Enter:

  • the SSID
  • the security mode
  • the password. The board will try three attempts to connect to the network.Once connected the board sets a real time clock from the network time.
  1. The terminal prompts the AWS credentials that you built when you create the AWS Iot thing.

Enter:

  • the root Certificate
  • the thing certificate
  • the private key This allows the device be authenticated by the server in the cloud.
  1. Enter the server name of the nearest AWS service you origin.

  1. Enter the device name. This allows to identify the device and ensure the right access to the data store.

In our case the name of the device is LungSystem.

The device takes three attempts to connect to the AWS account. Once connected the device is considered an Iot node and subscribes to AWS shadow service This will publish the updated values every ten seconds on the Tera term terminal and store them in the cloud server.

Interact with the Iot node

Let’s see how to interact with the Iot node.

  1. Enter in your AWS console aws.amazon.com.
  2. Enter the Iot services.

You’ll sent on your AWS Iot dashboard. There you’ll see the connections, the type of connection and the protocols used.

Here the MQTT protocol is the most used. 3. Connect to MQTT client to subscribe public message to a specific topic (on the Test window at the bottom).

![](https://github.com/lucamaiano/lungsystem/raw/master/images/mqttp client.png)

The Iot Node sends data in MQTT messages, that are published in a topic named shadow/update

  1. Subscribe to this topic to view this message.

The first message appears in a window displaying the sensor data.The sensor values are published approximately every 10 seconds.

TRY YOURSELF :)

Useful links: http://www.st.com/content/ccc/resource/technical/document/user_manual/group0/d0/f7/45/d7/3b/96/47/b3/DM00285842/files/DM00285842.pdf/jcr:content/translations/en.DM00285842.pdf http://www.st.com/en/evaluation-tools/b-l475e-iot01a.html https://aws.amazon.com/en/ https://d1.awsstatic.com/Projects/P4113926/aws-tutorial_deploy-iot-application.pdf http://www.st.com/stm32l4 http://www.st.com/stm32l4-discovery