fp-net-6lpwifi1 quick start guide - st.com · s2-lp x-nucleo-s2868a1 hardware description • the...

71
Version 1.4 (Sep 18, 2018) Quick Start Guide STM32Cube Function Pack for connecting 6LoWPAN IoT Nodes to the Internet through a Wi-Fi Network (FP-NET-6LPWIFI1)

Upload: dinhnhan

Post on 19-May-2019

229 views

Category:

Documents


0 download

TRANSCRIPT

Version 1.4 (Sep 18, 2018)

Quick Start GuideSTM32Cube Function Pack for connecting 6LoWPAN IoT Nodes

to the Internet through a Wi-Fi Network

(FP-NET-6LPWIFI1)

Quick Start Guide Contents2

FP-NET-6LPWIFI1: STM32Cube Function Pack for connecting 6LoWPAN IoT Nodes to the Internet through a Wi-Fi Network

Hardware and Software overview

Setup & Demo Examples

Documents & Related Resources

STM32 Open Development Environment: Overview

Sub-1 GHz RF expansion boardsHardware Overview (1/7) 3

S2-LP

X-NUCLEO-S2868A1 Hardware description

• The X-NUCLEO-S2868A1 is an evaluation boardbased on the S2-LP radio and operates in the 868MHz ISM frequency band

• The expansion board is compatible with ST morphoand Arduino UNO R3 connectors. The X-NUCLEO-S2868A1 interfaces with the STM32 Nucleomicrocontroller via SPI connections and GPIO pins.

• Ultra-low power consumption: 7 mA RX and 10 mATX at +10 dBm

Arduino UNO R3 connector

Key products on board

S2-LPS2-LP narrow band ultra-low power sub-1 GHz transceiver tuned for 860 - 940 MHz frequency band

Latest info available at www.st.com

X-NUCLEO-S2868A1

Sub-1 GHz RF expansion boardsHardware Overview (2/7) 4

SPSGRF-868 orSPSGRF-915 (*)

X-NUCLEO-IDS01A4/5 Hardware description

• The X-NUCLEO-IDS01A4, X-NUCLEO-IDS01A5are evaluation boards based on the SPIRIT1 RFmodules SPSGRF-868 and SPSGRF-915

• The SPIRIT1 module communicates with theSTM32 Nucleo developer board hostmicrocontroller though an SPI link available on theArduino UNO R3 connector.

EEPROM

Arduino UNO R3 connector

Key products on board

SPSGRFSub-GHz (868 or 915 MHz) low power programmable RF transceiver modules

SPIRIT1Low data-rate, low-power sub-1GHz transceiver) module

M95640-R64 Kbit SPI bus EEPROM with high-speed clock

Latest info available at www.st.com

X-NUCLEO-IDS01A4

X-NUCLEO-IDS01A5

(*) Identification of the operating frequency of the X-NUCLEO-

IDS01Ax (x=4 or 5) is performed through two resistors (R14 and R15).

Wi-Fi expansion board Hardware Overview (3/7) 5

X-NUCLEO-IDW01M1 Hardware Description

The X-NUCLEO-IDW01M1 is a Wi-Fi evaluation board basedon the SPWF01SA module, which expands the STM32 Nucleoboards. The CE, IC and FCC certified SPWF01SA module hasan embedded STM32 MCU, a low-power Wi-Fi b/g/n SoC withintegrated power amplifier and power management and anSMD antenna. The SPWF01SA module communicates withthe STM32 Nucleo developer board host microcontrollerthough an USART link available on the Arduino UNO R3connector.

Main Features:

• X-NUCLEO-IDW01M1 hosts FCC, IC and CE certifiedSPWF01SA module (FCC ID: VRA-SG9011203, IC: 7420A-SG9011203 and ETSI compliant)

• SPWF01SA module major characteristics:• Compatible with STM32 Nucleo boards• Equipped both with ST morpho connector and Arduino UNO

R3 connectors• Scalable solution; it can cascade multiple boards for larger

systems• Free development firmware library and examples,

compatible with STM32Cube• RoHS compliant

Key Products on board

SPWF01SAST SPWF01Sx module, 802.11 b/g/n compliant

Latest info available at www.st.comX-NUCLEO-IDW01M1

Printed Antenna

Arduino UNO R3 connector

ST morpho connector

STM32 Wi-Fi Frontend

LPS25HB

HTS221

Key Product on board

LSM6DS0: MEMS 3D accelerometer (±2/±4/±8 g) + 3D gyroscope (±245/±500/±2000 dps)

LIS3MDL: MEMS 3D magnetometer (±4/ ±8/ ±12/ 16 gauss)

LPS25HB: MEMS pressure sensor, 260-1260 hPa absolute digital output barometer

HTS221: capacitive digital relative humidity and temperature

DIL 24-pin: socket available for additional MEMS adapters and other sensors

DIL 24-pin

Motion MEMS and environmental sensors expansion boardHardware Overview (4/7) 6

X-NUCLEO-IKS01A1 Hardware Description

• The X-NUCLEO-IKS01A1 is a motion MEMS and environmental sensor evaluation board system.

• It is compatible with the Arduino UNO R3 connector layout, and is designed around ST’s latest sensors.

Arduino UNO R3 connector

ST morpho connector**

** Connector for the STM32 Nucleo Board

LSM6DS0

LIS3MDL

Latest info available at www.st.com

X-NUCLEO-IKS01A1

Key Features

• The X-NUCLEO-IKS01A1 is a motion MEMS and environmentalsensor evaluation board system.

• All sensors are connected on a single I²C bus• Sensor I²C address selection• Each sensor has separate power supply lines allowing power

consumption measurement• Sensor disconnection (disconnect the I²C bus as well as the

power supply)• Interrupt and DRDY signals from sensors• DIL24 socket (Compatible to STEVAL-MKI***V* MEMS adapter

boards, i.e. STEVAL-MKI160V1)

OPTIONAL

LPS22HB

HTS221

Key Product on board

LSM6DSLMEMS 3D accelerometer (±2/±4/±8/±16 g) + 3D gyroscope (±125/±245/±500/±1000/±2000 dps)LSM303AGR

MEMS 3D magnetometer (±50 gauss) + MEMS 3D accelerometer (±2/±4/±8/±16 g)LPS22HBMEMS pressure sensor, 260-1260 hPa absolute digital output barometer

HTS221Capacitive digital relative humidity and temperature DIL 24-pinSocket available for additional MEMS adapters and other sensors (UV index)

DIL 24-pin

Motion MEMS and environmental sensors expansion boardHardware Overview (5/7) 7

X-NUCLEO-IKS01A2 Hardware Description

• The X-NUCLEO-IKS01A2 is a motion MEMS and environmental sensor evaluation board system.

• It is compatible with the Arduino UNO R3 connector layout, and is designed around ST’s latest sensors.

Arduino UNO R3 connector

ST morpho connector**

** Connector for the STM32 Nucleo Board

LSM6DSL

LSM303AGR

Latest info available at www.st.com

X-NUCLEO-IKS01A2

OPTIONAL

VL6180X

Proximity, gesture and ambient light sensor expansion boardHardware Overview (6/7) 8

X-NUCLEO-6180XA1 Hardware Description

• The X-NUCLEO-6180XA1 is proximity and ambient light sensor evaluation and development board system, designed around VL6180X, a device based on ST’s FlightSenseTM, Time-of-Flight technology.

• The VL6180X communicates with STM32 Nucleo developer board host microcontroller through an I2C link available on the Arduino UNO R3 connector.

ALS or Range VL6180X satellites

Key Products on board

VL6180XProximity, gesture and Ambient Light sensor (ALS)

Selection between Ranging and ALS measurement

Possibility to add 3x VL6180X external satellite boards (order code: VL6180X-SATEL – 2 satellites)

Arduino UNO R3 connectors

Latest info available at www.st.com

X-NUCLEO-6180XA1

OPTIONAL

STM32L4 Discovery Board for IoT node (B-L475E-IOT01A) Hardware Overview (7/7) 9

STM32L4 Discovery Board for IoT node (B-L475E-IOT01A)Hardware Description

The STM32L4 Discovery kit for the IoT node (B-L475E-IOT01A) allows users todevelop applications with direct connection to cloud servers. The STM32L4Discovery kit enables a wide diversity of applications by exploiting low-powermultilink communication (BLE, Sub-GHz), multiway sensing (detection,environmental awareness) and ARM® Cortex®-M4 core-based STM32L4 Seriesfeatures. Arduino™ Uno V3 and PMOD connectivity provide unlimited expansioncapabilities with a large choice of specialized add-on boards.

Key Product on board

• Ultra-low-power STM32L4 Series MCUs based on ARM® Cortex® -M4 core with 1 Mbyte of Flash memory and 128 Kbytes of SRAM, in LQFP100 package

• Bluetooth® V4.1 module (SPBTLE-RF)

• Sub-GHz (868 or 915 MHz) low-power-programmable RF module (SPSGRF-868 or SPSGRF-915)

• Wi-Fi® module Inventek ISM43362-M3G-L44 (802.11 b/g/n compliant)

• Dynamic NFC tag based on M24SR with its printed NFC antenna

• 2 digital omnidirectional microphones (MP34DT01)

• Capacitive digital sensor for relative humidity and temperature (HTS221)

• High-performance 3-axis magnetometer (LIS3MDL), 3D accelerometer and 3D gyroscope (LSM6DSL), 260-1260 hPa absolute digital output barometer (LPS22HB), Time-of-Flight and gesture-detection sensor (VL53L0X)

• USB OTG FS with Micro-AB connector

• Expansion connectors: Arduino™ Uno V3, PMOD

• Flexible power-supply options: ST LINK USB VBUS or external sources

• On-board ST-LINK/V2-1 debugger/programmer with USB re-enumeration capability: mass storage, virtual COM port and debug port

Latest info available at www.st.comB-L475E-IOT01A

FP-NET-6LPWIFI1 Function PackSoftware Overview 10

Overall Software Architecture

Latest info available at www.st.com

FP-NET-6LPWIFI1

FP-NET-6LPWIFI1 Software Description

FP-NET-6LPWIFI1 is an STM32Cube function pack. Thanks to this package you can connect your IoT node inside a 6LoWPAN Wireless Sensors Network to the Internet, by the means of a Wi-Fi network. This software package implements application-level functions to bridge a 6LoWPAN network with a Wi-Fi network. Sample applications are provided to access the resources (e.g. sensors or actuators) on the 6LoWPAN nodes by the means of the OMA Lightweight M2M protocol, and to connect the device to Watson IoT cloud services by the means of the MQTT protocol.

Key features

• Application-level functions to bridge 6LoWPAN and Wi-Finetworks

• Middleware library with Contiki OS and Contiki 6LoWPANprotocol stack 3.0

• Middleware library implementing the MQTT protocol for access toWatson IoT cloud services provided by IBM

• Middleware library for Wi-Fi connectivity using the SPWF01SAmodule

• Sample application to connect a node in the 6LoWPAN network toa remote server by the means of the OMA Lightweight M2M(LWM2M) Protocol

• Sample application to connect a network of 6LoWPAN nodes withthe Watson IoT services provided by IBM

• Example implementation available for X-NUCLEO-S2868A1board connected to a B-L475E-IOT01A board, or X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5 and X-NUCLEO-IDW01M1boards connected to a NUCLEO-F401RE board

• Easy portability across different MCU families, thanks toSTM32Cube

• Free, user-friendly license terms

Quick Start Guide Contents11

FP-NET-6LPWIFI1: STM32Cube Function Pack for connecting 6LoWPAN IoT Nodes to the Internet through a Wi-Fi Network

Hardware and Software overview

Setup & Demo Examples

Documents & Related Resources

STM32 Open Development Environment: Overview

X-NUCLEO-IDS01A4X-NUCLEO-IDS01A5

Setup & Demo ExamplesHW prerequisites (1/3)

• For configuration based on Discovery Kit:

• 1x Discovery kit IoT node (B-L475E-IOT01A)

• 1x STM32 Nucleo Sub-1GHz RF expansion board based on S2-LP (X-NUCLEO-S2868A1)

• For configuration based on STM32 Nucleo:

• 1x STM32 Nucleo development board (NUCLEO-F401RE)

• 1x STM32 Nucleo Sub-1GHz RF expansion board based on SPIRIT1(X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5)

• 1x STM32 Nucleo Wi-Fi expansion board (X-NUCLEO-IDW01M1)

• 1x PC with Windows 7, 8 or 10

• 1x USB type A to Mini-B USB cable

12

Mini USB NUCLEO-F401RE

X-NUCLEO-IDW01M1

Tera Term terminal (*)running on PC

RouterPC

Routerwith internet connection

(*) or equivalent terminal

Additional requirements

NUCLEO-F401RE board equipped with the Wi-Fi expansion board

and the SPIRI1 based Sub-1GHz RF expansion board (on top)

X-NUCLEO-S2868A1

B-L475E-IOT0A1 DiscoveryKit equipped with the S2-LP

based Sub-1GHz RF expansion board (on top)

Setup & Demo ExamplesHW prerequisites – B-L475E-IOT01A kit based configuration (2/3)

Important: an hardware modification is required on the X-NUCLEO-S2868A1 expansion board: In order to avoid a resource usage conflict between the X-NUCLEO-S2868A1 and the B-L475E-IOT01A

board, the 0-Ohm resistances located at position R11 and R13 must be unmounted, 0-Ohm resistances must be mounted at positions R9 and R6

13

Setup & Demo ExamplesHW prerequisites – NUCLEO-F401RE based configuration (3/3)

Important note: an hardware modification is required on the X-NUCLEO-IDW01M1 Wi-Fi expansion board• In order to avoid a resource usage conflict between the X-NUCLEO-IDW01M1 and the X-NUCLEO-IDS01A4

or X-NUCLEO-IDS01A5 expansion board, the 0-Ohm resistance located at position R4 must be moved to the position R34 (see picture)

14

Move 0-ohm resistorFrom position R4 to R34

• Note that in order to be able to perform the SPSWF01Sx Wi-Fi Module Firmware Update (only if needed, see software pre-requisite slide later) the resistance located at position R4 must be soldered, therefore it is necessary to do any needed firmware update of the Wi-Fi module before removing the resistance located at position R4

• Please also ensure that the following jumpers are correctly set on the X-NUCLEO-IDW01M1 expansion

board:• JP3 mounted in position 1-2, and JP4 mounted in position 1-2

Setup & Demo ExamplesHW prerequisites for the

6LoWPAN Nodes (optional) 15

• 1x STM32 Nucleo Sub-1GHz RF expansion board(X-NUCLEO-S2868A1 or X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5)

• 1x Motion MEMS and environmental sensor expansion board (optional)(X-NUCLEO-IKS01A1 or X-NUCLEO-IKS01A2)

• 1x STM32 Nucleo proximity, gesture and ambient light expansion board (optional) (*)(X-NUCLEO-6180XA1)

• 1x STM32 Nucleo development board (NUCLEO-F401RE or NUCLEO-L152RE)

• 1x PC with Windows 7, 8 or 10

• 1x USB type A to Mini-B USB cable

• The FP-SNS-6LPNODE1 package contains some sample applications for demonstration and evaluation purpose for three different wireless node configurations, as shown in the following pictures

Mini USB

X-NUCLEO-IKS01A1(optional)

Node Configuration “ipso-nosensors”NUCLEO-F401RE or NUCLEO-L152RE

+ X-NUCLEO-S2868A1 orX-NUCLEO-IDS01A4

(or X-NUCLEO-IDS01A5)

Node Configuration “ipso-mems”NUCLEO-F401RE or NUCLEO-L152RE

+ X-NUCLEO-S2868A1 or X-NUCLEO-IDS01A4

(or X-NUCLEO-IDS01A5) + X-NUCLEO-IKS01A1

Node Configuration “ipso-flightsense”NUCLEO-F401RE (*)

+ X-NUCLEO-S2868A1 or X-NUCLEO-IDS01A4

(or X-NUCLEO-IDS01A5) + X-NUCLEO-6180XA1

X-NUCLEO-6180XA1(optional)

X-NUCLEO-S2868A1 X-NUCLEO-IKS01A2(optional)

X-NUCLEO-IDS01A4X-NUCLEO-IDS01A5

Setup & Demo ExamplesSW prerequisites 16• STSW-LINK009:

• ST-LINK/V2-1 USB driver

• STSW-LINK007:

• ST-LINK/V2-1 firmware upgrade

• FP-NET-6LPWIFI1

• Copy the .zip file content into a folder on your PC

• The package will contain source code example (Keil, IAR, System Workbench for STM32) that supports configurations based only on B-L475E-IOT01A or on NUCLEO-F401RE development boards

For HW configuration based on STM32Nucleo board with X-NUCLEO-IDW01M1, SPSWF01Sx Wi-Fi Module Firmware Update to the latest version is recommended• We suggest checking the version of the Wi-Fi module firmware that is flashed on the X-NUCLEO-IDW01M1 board

and make sure it is running the latest version• The STSW-WIFI001 package available at www.st.com provides the up-to-date SPSWF01Sx Wi-Fi Module Firmware• Please refer to the documentation of the X-NUCLEO-IDW01M1 board (e.g. “X-NUCLEO-IDW01M1 Quick start user

guide”) in order to learn how to check the Wi-Fi module firmware version and, if needed, to update it

For bidirectional communications, the Wi-Fi bridge application can support up to 4/8 sensors nodes simultaneously (the actual number depends on the Wi-Fi module, this limit is related to the max number of connections that can be opened in parallel); for unidirectional node-to-server communication (e.g. sensors data transmission), this limit does not apply

When using the B-L475E-IOT01A board with mbedTLS protocol running, the “OMA-LWM2M to IBM” application can support only a few sensors nodes simultaneously (this limitation is related to amount of flash memory available on the device)

FP-NET-6LPWIFI1Start coding in few minutes 17

Download & unpack FP-NET-6LPWIFI1

Go to www.st.com/stm32ode-fp1

Select FP-NET-6LPWIFI12

3

4

5

Open a project example:WiFi-Bridge or LWM2M_to_IBM

6

Download and install STM32 Nucleo

ST-LINK/V2-1 USB driver

Modify and build the application

Docs

BSP, HAL and Drivers

6LoWPAN, Wi-Fi, MQTT

Application examples

Node binary FW

FP-NET-6LPWIFI1 package structure

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationSystem Overview – End-to-End Deployment Example

Configuration based on Discovery kit with S2-LP based sub-1GHz radio 18

Note: For bi-directional communications, the Wi-Fi bridge application based on can support up to 4 sensors nodes simultaneously when using the B-L475E-IOT01A board based configuration (a limitation due to the Wi-Fi module which is used); for unidirectional node-to-server communication (e.g. sensors data transmission, such as CoAP notification messages), this limit does not apply

6LoWPAN-WiFi BridgeHardware: B-L475E-IOT01A + X-NUCLEO-S2868A1 (sub-1 GHz) Software: FP-NET-6LPWIFI1 package (V3.0.0 or higher), “WiFi-Bridge” sample application

Wireless Sensors Node (example)Hardware: NUCLEO-F401RE orNUCLEO-L152RE + X-NUCLEO-S2868A1 (sub-1 GHz) + X-NUCLEO-IKS01A2 (Environmental & Motion sensors)Software: FP-SNS-6LPNODE1 package(V1.3.0 or higher) “ipso-mems” application

ApplicationServer

(e.g. Leshan LWM2M)

IPv6/6LoWPAN Network

REST Access to the Wireless Nodes Resources

Wi-Fi Router

internet

Wireless Sensors Node (example)Hardware: NUCLEO-F410RE + X-NUCLEO-S2868A1 (sub-1 GHz) + X-NUCLEO-6180XA1 (Time of flight sensor)Software: FP-SNS-6LPNODE1 package (V1.3.0 or higher), “ipso-flightsense” application

19

6LoWPAN-WiFi BridgeNUCLEO-F401RE

X-NUCLEO-IDS01A4/5 (sub-1 GHz)X-NUCLEO-IDW01M1 (Wi-Fi)Wireless Sensors Node

NUCLEO-F401REX-NUCLEO-IDS01A4/5 (sub-1 GHz)

X-NUCLEO-IKS01A2/1 (Environmental & Motion sensors)

ApplicationServer

(e.g. LWM2M)

IPv6/6LoWPAN Network

Read/Write Access to the Wireless Nodes Resources

Wi-Fi Router

Internet

Wireless Sensors NodeNUCLEO-F401RE

X-NUCLEO-IDS01A4/5 (sub-1 GHz)X-NUCLEO-6180XA1 (Time of flight sensor)

Note: For bi-directional communications, the Wi-Fi bridge application based on can support up to 8 sensors nodes simultaneously when using the STM32 Nucleo board based configuration (a limitation due to the Wi-Fi module which is used); for unidirectional node-to-server communication (e.g. sensors data transmission, such as CoAP notification messages), this limit does not apply

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationSystem Overview – End-to-End Deployment Example

Configuration based on NUCLEO-F401RE with SPIRIT1 based sub-1GHz radio

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationFirmware compilation, flashing and serial line configuration 20

Configure the serial line monitor (speed, data, parity, LF, …)

USB type A to Mini-B USB cable

Compile (or use the pre-built binary file)and program the Wi-Fi Bridge firmware

Reset the MCU by pressing the RESET button on the STM32 Nucleo board

The terminal will then prompt to select how to connect to a Wi-Fi AP (see next slide)

6LoWPAN-WiFi Bridge

1

2

3

Wi-Fi AP/Router

OR

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationConnecting the Wi-Fi bridge to the AP 21

Wi-Fi Network Configuration Setup

• The user is asked to press the bluebutton to enter new credentials or justto wait for the last used settings to beretrieved from FLASH memory

• If the user presses “y” then she/he willbe able to type her/his own credentialsto access the Wi-Fi network, (pleasenote that the WPA Enterpriseencryption is not supported). The newsettings will be saved to FLASHmemory, and will be available whenthe board is restarted

• If credentials are successfully inserted,

the bridge will connect to the Wi-Fi

network.

4

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationWireless Sensors Node Setup (1/4)

22

USB type A to Mini-B USB cable

Select one of the three supported wireless nodes hardware configuration, assemble the STM32 Nucleo and X-NUCLEO expansion boards, connect the STM32 Nucleo board to the host PC and program the binary firmware that is provided for the chosen configuration (example: node “configuration 2” using X-NUCLEO-S2868A1 RF expansion board)

5

6

Wireless Sensors Node

Open a serial line monitor utility, select the serial port name to which the board is connected and configure it with the parameters provided in step 2 (Baud Rate = 115200, Parity = None, Data Bit = 8, Stop bits = 1), then reset the MCU.

The application will run: it demonstrates how a node can connect to a remote server by the means of the OMA Lightweight M2M (LWM2M) standard.

In this example application the node will attempt, for evaluation purpose, to connect to a public online

OMA Lightweight M2M server called “Leshan” (located at: http://leshan.eclipse.org)

Important note: binary files for the various sensor nodes configurations are located inside the “STM32CubeFunctionPack_6LPWIFI1_VX.Y.Z\Utilities\Binary\WiFi-Bridge” folder. The simplest way to program the sensor node is to “drag and drop” the selected binary file on the device with removable storage associated to the corresponding STM32 Nucleo board (e.g. “NODE_F401RE”)

Example: Configuration for “ipso-mems” sample applicationNUCLEO-F401RE development board

+ X-NUCLEO-S2868A1 (Sub-1GHz RF communication based on S2-LP) + X-NUCLEO-IKS01A1 or X-NUCLEO-IKS01A2 (temperature, humidity, motion sensors)

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationWireless Sensors Node Setup (2/4) 23

Wait for the node (acting in this example as a LWM2M client) to complete the registration with

the LWM2M server. The registration starts with the node printing its Client Endpoint ID and, if successful, ends with the print of the Location-path.7

Open a web browser and go to http://leshan.eclipse.org then find the endpoint whose client ID matches the one in the previous step

8Note: in case the node registration is not successful, try again by doing a reset

of the STM32 Nucleo board

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationWireless Sensors Node Setup (3/4) 24

9Click on the corresponding Client Endpoint to visualize the client homepage on the Leshanserver: the available resources hosted on the wireless sensor node are listed on the web page

FP-NET-6LPWIFI1 – Wi-Fi Bridge ApplicationWireless Sensors Node Setup (4/4) 25

10Click either on “Observe” or “Read” to access one or more resources on the node (for example the temperature sensor data). “Observe” is a feature that enables to get updates of sensor data when they change, while “Read” can be used to obtain an instantaneous reading of the sensor data

Current Temperaturesensor valueread from the6LoWPAN node

FP-NET-6LPWIFI1 – Wi-Fi Bridge Application

Additional LWM2M Demo Setup Tips (1/2)

• It is recommended - especially when using the public Leshan LWM2M server – to avoid

using a host PC that is inside a network behind a proxy (which typically happens in

corporate networks) � this proxy may create issues, in particular with the visualization

of the notifications

• It may happen that the web page does not show notifications: most of the time it is

because the host PC went in sleep mode � try to refresh the web page, there is no

need to click on the “Observe” button again

• When you click on the “Observe” button, there is no need to also click on the “Read”

one. To cancel the observation you just need to click on the black square button near

the “Observe” button.

• Please allow several seconds when you boot a node to have it registered to the public

Leshan server

26

FP-NET-6LPWIFI1 – Wi-Fi Bridge Application

Additional LWM2M Demo Setup Tips (2/2)

• The following table contains a list of actually observable resources

• Note that observing other resources not listed here might have side effects due to the current LWM2M server implementation

• Note that in case of observation some thresholds and timers apply. For example, don’t expect the presence sensor to react in less than one second, or a new temperature sensor reading to be sent every few seconds

27

Object Description

Object ID

Resource Description Resource IDs Default Timers (1)

Default Threshold (2)

Magnetometer 3314 3 axis (X,Y,Z) 5702, 5703, 5704 10 sec -

Accelerometer 3313 3 axis (X,Y,Z) 5702, 5703, 5704 1 sec -

Temperature 3303 min, max, actual value 5601, 5602, 5700 60 sec 0.5 °C

Humidity 3304 min, max, actual value 5601, 5602, 5700 60 sec 1 % rH

Barometer 3315 min, max, actual value 5601, 5602, 5700 60 sec 1 hPa

Digital Input (button)

3200 Digital input state and counter

5500, 5501 - -

Presence Sensor (3)

3302 Sensor state 5500 1 sec -

(1) Time elapsed to get a new value of the sensor, this affects notification periods (when using “Observe”)(2) If, compared to the previous reading, the new sensor value is changed less than this threshold, then notifications

are not sent(3) The Presence sensor range is configured by default to 2 cm

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationSystem Overview – End-to-End Deployment Example 28

NUCLEO-F410RE+ X-NUCLEO-IDS01A4/5

(sub-1 GHz based on SPIRIT1)+ X-NUCLEO-IDW01M1 (Wi-Fi)

Wireless Sensors NodeSub-1 GHz radio based on SPIRIT1 transceiver

IBM Watson IoT

IPv6/6LoWPAN Network

MQTT

Wi-Fi Router

IBM Watson IoT

Wireless Sensors NodeSub-1 GHz radio based on S2-LP transceiver

LwM2M

LwM2M

OR

LWM2M to IBM GatewayB-L475E-IOT01A

+ X-NUCLEO-S2868A1 (sub-1 GHz based on S2-LP)

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationFirmware compilation, flashing and serial line configuration 29

Configure the serial line monitor (speed, data, parity, LF, …)

USB type A to Mini-B USB cable

Compile (or use the pre-built binary file)and program the LWM2M to IBM firmware

Reset the MCU by pressing the RESET button on the Discovery or STM32 Nucleo boardThe terminal will then prompt to select how to connect to a Wi-Fi AP (see next slide)

There are two cases:

Case 1: when using B-L475E-IOT01A Discovery kit IoT node

Case 2: when using the NUCLEO-F401RE development board

LWM2M to IBM Gateway

1

2

3

Wi-Fi AP/Router

OR

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationConnecting the Wi-Fi bridge to the AP – Case 1: Setup with Discovery IoT kit

30

Case 1: Wi-Fi Network Configuration Setup

• The user is asked to enter SSID,security mode and password

• If credentials are successfully inserted,the bridge will connect to the Wi-Finetwork.

4.1

• During the 1st connection, the user willneed to enter the x501 certificate usedto authenticate the device using TLS(the certificate will be saved in theflash and won’t need to be re-enteredduring the next connections)

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationConnecting the Wi-Fi bridge to the AP – Case 1: Setup with Discovery IoT kit

31

Case 1: Wi-Fi Network Configuration Setup

• Enter the registration mode:

select “1 – Quickstart”

• Enter the DeviceType, e.g.:lwm2m

• Enter the DeviceID: any stringchosen by the user

4.2

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationConnecting the Wi-Fi bridge to the AP – Case 2: Setup with STM32 Nucleo 32

Case 2: Wi-Fi Network Configuration Setup

• The procedure is similar to the onedescribed for the “Wi-Fi Bridge”Application (see previous slides). Afterthe displaying of some messagesabout the versions of the application,the HAL and the Wi-Fi Modulefirmware, the user is asked to pressthe user button to enter his newcredentials…

• … or to just wait 5 seconds for the laststored parameters (SSID and, in casethe Wi-Fi Network is not open,password) to be read from FLASHmemory.

• After that the gateway successfullyconnects with the Wi-Fi Access Point,the URL to connect with IBM IoT

Cloud service (in Quickstart mode)

is printed

4

FP-NET-6LPWIFI1 – LWM2M to IBM Application

Connecting to the IBM cloud 33

Connection to IBM cloud

• After the Contiki OS parameters aredisplayed (similar to the Wi-Bridgeapplication case), some specific“LWM2M to IBM” Application settingsare printed (number of nodes andresources, IPv6 addresses)

• The gateway connects to the IBMWatson IoT Cloud service

• The user can now power up a node(the “ipso-mems” firmware is shown inthis example), as explained in the nextslide, and wait for it to register to theLWM2M server implemented by theLWM2M to IBM Application

• The sensor data that are pre-programmed by the “Template” (see

slide 31) will be retrieved and

periodically sent to IBM cloud

5

Wi-Fi Network

Setup completed

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationWireless Sensors Node Setup (1/2) 34

USB type A to Mini-B USB cable

Select one of the three supported wireless nodes hardware configuration, assemble the STM32 Nucleo and X-NUCLEO expansion boards, connect the STM32 Nucleo board to the host PC and program the binary firmware that is provided for the chosen configuration (example: “node configuration 2”)

Example: Node Configuration 2 selectedNUCLEO-F401RE + X-NUCLEO-IDS01A4

(or X-NUCLEO-IDS01A5) (Sub-1GHz RF communication) + X-NUCLEO-IKS01A2 (or X-NUCLEO-IKS01A1) (temperature, humidity, motion sensors)

6

7

Wireless Sensors Node

Open a serial line monitor utility, select the serial port name to which the board is connected and configure it with the parameters provided in step 2 (Baud Rate = 115200, Parity = None, Data Bit = 8, Stop bits = 1), then reset the MCU.

The application will run: it demonstrates how a node can connect to a local server (part of the LWM2M to IBM Application) by the means of the OMA Lightweight M2M (LWM2M) standard.

In this example application the node will attempt, for evaluation purpose, to connect to the server running

at the hardcoded address [aaaa::ff:fe00:1]

Important Note: binary files for the various sensor nodes configurations are located inside the

“STM32CubeFunctionPack_6LPWIFI1_VX.Y.Z\Utilities\Binary\LWM2M_to_IBM” folder. The simplest way to

program the sensor node is to “drag and drop” the selected binary file on the device with removable storage

associated to the corresponding STM32 Nucleo board (e.g. “NODE_F401RE”)

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationWireless Sensors Node Setup (2/2) 35

Wait for the node (acting in this example as a LWM2M client) to complete the registration with the LWM2M server. If the client registration is successful, a message will be printed containing also the Location path (these information match what is printed on the server side, see the 3rd bullet step 5)

8

9

Note: in case the node registration is not successful, try

again by doing a reset of the STM32 Nucleo board

The user can now see the data in IBM Watson IoT cloud as shown in step 10

36By inserting the “IBM Quickstart URL” shown in step 4 into a web browser, it is possible to view real time sensor data

10

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationSensor data in IBM Cloud

• OMA LWM2M specification requires that the clients (e.g. the sensor nodes) respond to

commands sent by a server (the LWM2M to IBM Application)

• Clients do not start streaming sensor data without explicit request from the server

• A code template is provided in order to instruct the LWM2M to IBM gateway about which

resources the user wants to automatically retrieve. It can be either:

• by using the Observe/Notification operations

• by polling the selected resources(s) with Read operations

• The default template is shown hereafter (taken from file: Src/lwm2m-resource-directory.c).

More information can be found in the User Manual (see UM2080)

37

FP-NET-6LPWIFI1 – LWM2M to IBM ApplicationTemplate to pre-program the gateway

AppendixRegistered mode configurationCreating a dashboard in IBM Cloud

38

• “Registered mode” enables to connect your STM32 Nucleo and expansion boards to IBM Cloud and build scalable IoT applications based IBM Watson IoT platform

• Create a free account at IBM cloud by following instructions at

https://console.bluemix.net/registration/

• Once you have an IBM cloud user account, use your credentials to create Internet of Things Platform Starter cloud foundry app

Create Watson IoT Platform IBM Cloud

• Click on the xxxx-iotf-service link in your IBM cloud dashboard

40

Registered modeLaunch Watson IoT Platform (1/2)

• Click on Launch to open IBM Watson IoT platform service

41

Registered modeLaunch Watson IoT Platform (2/2)

Registered modeCreate a device type (1/2)

• Click on Device then Device Types

Registered modeCreate a device type (2/2)

• Select Device as Device Type, enter Device Type name then click on Next

• Select BroweDevices in left side bar, then add your device by clicking on Add Device

• Please note that you might have to create a device type first

44

Registered modeAdd a device (1/4)

Registered modeAdd a device (2/4)

• Select Auto-generated authentication token, then click on Next

Registered modeAdd a device (3/4)

• Select Device Type, enter your Device ID, then click on Next

Simple Registration modeAdd a device (4/4)

• Take note of device credentials generated for your device

Simple Registration modeProvision credentials to STM32 Nucleo

• Reboot the STM32 Nucleo board. When requested select Registered mode. Enter device credentials as shown below

Simple Registeration Mode = 2

Registered modeVisualize messages received from STM32 Nucleo

• Browse devices, select your device ID, then click on Recent Events tab

Registered modeCreate dashboard to visualize data (1/4)

• Click on Boards in left bar, then Create New Board

Registered modeCreate dashboard to visualize data (2/4)

• Name your board, then click on Add New Card

Registered modeCreate dashboard to visualize data (3/4)

• Select Card Type, click on your device ID, then click on Connect data set.

• Select status as Event; select one among data set available in the

messages received, select type and unit of the data set, then click Next

Registered modeCreate dashboard to visualize data (4/4)

• For each data set contained in the messages generated by STM32 Nucleo (Temperature, Humidity, etc.), a different card can be added

Registered mode configuration

Connect device to a NodeREDapplication

54

Registered modeConnect device to Node-RED application

• Node-RED is a flow-based development tool for wiring together hardware devices, APIs and online services (nodered.org)

• Node-RED is pre-integrated in Watson IoT Platform

Registered modeConnect device to Node-RED application

• Before connecting your devices to Node-RED, you have to generate API keys in IBM Watson IoT dashboard

Registered modeConnect device to Node-RED application

• Select Standard Application, then click on Generate Key

• Note down API Key and Authentication token

Registered modeConnect device to Node-RED application

• Go back to your IBM Cloud dashboard and click on your app URL to open Node-RED flow editor. It is optional to secure it using a username/password

59

Registered modeConnect device to Node-RED application

• In Node-RED flow editor, select Manage Palette from menu option, click on install tab and install node-red-dashboard in your Node-RED palette

• Select Import to import the flow described in file FFTSensorFlow.json that can be found inside folder STM32CubeFunctionPack_WATSON1_F4_V2.1.1/Utilities/NodeRED

• Copy and paste the content of the JSON file to clipboard

60

Registered modeConnect device to Node-RED application

• Configure the Watson IoT platform node using following parameters:

• API key and authentication token

• Device Type

• Device ID

61

Registered modeConnect device to Node-RED application

Registered modeConnect device to Node-RED application

• In order to visualize the sensor data received from STM32 Nucleo in Node-RED dashboard:

• Click on the Deploy button on top-right of the Node-RED application page

• Click launch icon in dashboard tab

Registered modeConnect device to Node-RED application

• A web based dashboard will appear. Sensor data from STM32 Nucleo is visualized in real time

Registered modeConnect device to Node-RED application

Documents & Related Resources

FP-NET-6LPWIFI1:

• DB2971: STM32Cube Function Pack for connecting 6LoWPAN IoT Nodes to the Internet through a Wi-Fi Network – Data brief

• UM2080: Getting started with the FP-NET-6LPWIFI1 software package for connecting 6LoWPAN IoT Nodes to the Internet through a Wi-Fi Network –User Manual

• Software setup file

X-NUCLEO-S2868A1:

• Gerber files, BOM, and schematics

• DB3602: Sub-1 GHz 868 MHz RF expansion board based on S2-LP radio for STM32 Nucleo – Data brief

• UM2405: Getting started with the X-NUCLEO-S2868A1 Sub-1 GHz 868 MHz RF expansion board based on S2-LP radio for STM32 Nucleo – UserManual

X-NUCLEO-IDS01A4:

• Gerber files, BOM, and schematics

• DB2552: Sub-1 GHz RF expansion board based on the SPSGRF-868 module for STM32 Nucleo – Data brief

• UM1872: Getting started with the Sub-1 GHz expansion board based on the SPSGRF-868 and SPSGRF-915 modules for STM32 – User Manual

X-NUCLEO-IDS01A5:

• Gerber files, BOM, and schematics

• DB2553: Sub-1 GHz RF expansion board based on the SPSGRF-915 module for STM32 Nucleo – Data brief

• UM1872: Getting started with the Sub-1GHz expansion board based on the SPSGRF-868 and SPSGRF-915 modules for STM32 – User Manual

X-NUCLEO-IDW01M1:

• Gerber files, BOM, and schematics

• DB2726: Wi-Fi expansion board based on SWPF01SA module for STM32 Nucleo – Data brief

• UM1975: Getting started with X-NUCLEO-IDW01M1 Wi-Fi expansion board based on SPWF01SA module for STM32 Nucleo – User Manual

65

All documents are available in the DESIGN tab of the related products webpage

Consult www.st.com for the complete list

Quick Start Guide Contents66

FP-NET-6LPWIFI1: STM32Cube Function Pack for connecting 6LoWPAN IoT Nodes to the Internet through a Wi-Fi Network

Hardware and Software overview

Setup & Demo Examples

Documents & Related Resources

STM32 Open Development Environment: Overview

STM32 Open Development EnvironmentFast, affordable Prototyping and Development 67

• The STM32 Open Development Environment (ODE) consists of a set of stackable boards

and a modular open SW environment designed around the STM32 microcontroller family.

www.st.com/stm32ode

Function Packs

(FP)

STM32Cubedevelopment software

STM32 Nucleoexpansion boards

(X-NUCLEO)

STM32 Nucleodevelopment boards

STM32Cube expansion software

(X-CUBE)

Power supply

through USB or external source

Integrated debugging

and programming ST-LINK probe

STM32 microcontroller

Complete product range from ultra-low power to high-performance

ST morpho extension header

STM32 NucleoDevelopment Boards (NUCLEO)

• A comprehensive range of affordable development boards for all the STM32

microcontroller series, with unlimited unified expansion capabilities and integrated

debugger/programmer functionality.

68

www.st.com/stm32nucleo

Arduino™ UNO R3 extension headers

Move/ActuatePower InteractConnect

Sense

STM32 NucleoExpansion Boards (X-NUCLEO)

• Boards with additional functionality that can be plugged directly on top of the STM32

Nucleo development board directly or stacked on another expansion board.

69

DIL24 support for new devices

Motion MEMS sensors

Environmental sensors

www.st.com/x-nucleo

Example of STM32 expansion board (X-NUCLEO-IKS01A1)

STM32 Open Development EnvironmentSoftware components

• STM32Cube software (CUBE) - A set

of free tools and embedded software bricksto enable fast and easy development onthe STM32, including a HardwareAbstraction Layer and middleware bricks.

• STM32Cube expansion software

(X-CUBE) - Expansion software provided

free for use with the STM32 Nucleoexpansion board and fully compatible withthe STM32Cube software framework. Itprovides abstracted access to expansionboard functionality through high-level APIsand sample applications.

70

www.st.com/x-cube

• Compatibility with multiple Development Environments - The STM32 Open Development

Environment is compatible with a number of IDEs including IAR EWARM, Keil MDK, and GCC-basedenvironments. Users can choose from three IDEs from leading vendors, which are free of charge anddeployed in close cooperation with ST. These include Eclipse-based IDEs such as Ac6 SystemWorkbench for STM32 and the MDK-ARM environment.

Tools& IDEs

Application examples(e.g. basedonSTOpenSoftwareX)

Hardware

SampleapplicationsApplications

IAREWARM,Keil MDK-ARM,GCC-basedIDEs(e.g. Ac6System Workbenchfor STM32)

STM32CubeHardware Abstraction Layer (HAL)

STM32Cubemiddleware

Upper level middleware(e.g. STOpenSoftwareX)

Middleware

HardwareAbstraction

STM32Cubeexpansion middleware

STM32 Nucleo expansion boards (X-NUCLEO)

STM32 Nucleo developer boards

OPEN LICENSE MODELS: STM32Cube software and sample applications are covered by a

mix of fully open source BSD license and ST licenses with very permissive terms.

www.st.com/stm32cube

STM32 Open Development EnvironmentBuilding block approach 71

The building blocks Your need Our answer

Move / Actuate

Connect

Power

Sense

Process

Inertial modules, magnetometer

Proximity, microphone

Pressure, temperature, humidity

Bluetooth LE, Sub-GHz radio

NFC, Wi-Fi, GNSS

Energy management & battery

General-purpose microcontrollers

Stepper motor driver

DC & BLDC motor driver

Audio amplifier

COLLECT

TRANSMIT

ACCESS

CREATE

POWER

PROCESS

Software

Secure microcontrollers

Touch controller

Operation Amplifier

Accelerometer, gyroscope

Translate

Industrial input / output

www.st.com/stm32ode