How to customize STM32 Wireless Long Range demo

Revision as of 17:13, 10 August 2020 by Registered User


Under construction.png Coming soon


User don't need to understand how the flows work to use the dashboard, the only node to configure are the serial in and out. But some user may want to change charts size or add elements. In this case, the flow can be modified by user.


The flow is based on 5 tabs, with specific role for each page :

  • STM32WL Demo Tool : This is the first tab and displays help information
  • Serial port configuration : This flow manages the serial port. The serial port selection must be done in this flow.
  • Demo main flow : This the heart of the demo. This flow manages the dynamics of the dashboard.
  • Sensor panels: This flow contains all the UI elements of each sensor panels.
  • AT Command : This flow handles the command parsing and errors and the serial log part.


1. Serial port configuration

This flow is quite simple. It features one serial node input and one output to handle connection with the concentrator.

Serial port tab

In order to change the com port, the user must change both nodes. The serial port status node is used to detect the event related to serial port like board disconnection. The input for serial port and the events are sent to the AT Command flow.

2. Demo main flow

This is the complex part of the demo, but user should not need to change it. The page can be changed if user wants to build a different application or add additional features. The flow is separated in 3 main area :

2.1. Home Page/Region selection

This section manages the country selection fields when the application starts.

main tab country selection

When the application is initialized, the Region picklist is set to the current Region by the "Reset region" node.
When user changes the Region picklist, the Region value is saved in flow context and the SubRegion picklist is configured with the proper values.
When user changes the SubRegion picklist, the SubRegion value is saved in flow context.

2.2. the Demo main part

The central section manages the dynamic of the dashboard.

main partl

The central part is the FSM nodes which implements the finite state machine. The states are :

  • "INIT" : The concentrator is not connected or not yet initialized. A reset command is sent in this state
  • "IDLE": The concentrator has answered to reset command, and is ready to start. The country selection page is displayed
  • "SEND_REGION": The user has pressed the start button, the set region command is sent to the board, and application waits the answer
  • "SEND_SUBREGION": The concentrator has answered to the set region command, the sub region command is sent
  • "STARTING": The concentrator has acknowledged the sub region, application sends the start command
  • "STARTED": The concentrator is started, beacons are sent periodically, and sensor status will be collected.

The FSM reacts to inputs signals :

  • Start button : messages with topic "start" will start the demo (in IDLE state)
  • Reset button : the demo will go to INIT state and data will be initialized when a message with topic "reset" is received
  • Input from AT command flow. The input are parsed in AT Command flow, and have the following topics : "resetok" when device has performed reset, "connect" when board is connected, "disconnect" when board is disconnected, "ok" when AT command is successful, "error" when an error occurs. This inputs goes through a switch node to separate the data from sensor and the commands status.

On the right side, there are some function nodes used to set data and manage display. The Dashboard UI is managed with UI groups, which are visible or hidden when required. The 2 nodes "Display the country page" and "Display the sensor panels" are generating configuration message to hide and display the correct UI group for each state. The "Reset the UI" node is used to detect the first display of the dashboard, and configures properly the UI elements. The "Reset the data" node will clear the list of sensor, and format a "reset" message to clear all the charts in sensor panels and the Main sensor table.

Four nodes are used to send the command to the concentrator. The message is created with the AT command, and the Flow name. The flow name can be used to route answers if more than one flow are sending AT commands.

2.3. The sensor data management

The data coming from sensors are first decoded by the "parse data" node. The data are coming in a string and are split in an object with fields. Then, the "compute sensor data" will check the data with previous data received to check if packet have been missed, compute the PER and the statistics. The result is stored in memory and sent in a new message to update the charts and the Sensor table. The node will also detect that a new sensor appears, and will send a message in the second output to display and close the new sensor panel.

2.4. The sensor list management

Sensor List management

The sensor list is displayed with the "Sensor list" node. this is a standard ui_table dashboard node. In order to have good performances, and to cache the data properly, a sub flow ui-table-handler is used. The table handler holds the table configuration (column list, colors, sizes). The ui-table handler is a subflow shared by Christian-Me in node-RED forums. announce-remote-device-table-and-collaboration-wanted. Incoming data from sensor are going to the "Inject data" node and are formatted for the ui-table handler. The "reset table" node will build a message to clear the content of the table. The "reset counters" will parse the sensor data and reset the number of packets and stats of all sensors. The "Display charts" node will send a message to "open" the sensor panel when the sensor is clicked in the table.



3. Sensor panels

The sensor tab groups all sensor panels. For each sensor, there is a sub-flow and the ui graphic components (graph and gauge). The pattern is repeated 14 times.

Serial log panel

For each sensor there is :

  • One subflow to filter data. Each time sensor data are received, data are sent to all sensors panels. The "Split sensor data" filter the sensor number and then dispatch the data on various outputs :
  • EUI : used to display the EUI in each sensor panel
  • Temperature : connected to a chart in the sensor panel
  • PER : (not used by default)
  • Voltage : connected to a gauge in the sensor panel
  • RSSI : (not used)
  • Missed packet : connected to a chart in the sensor panels.

To change the sensor Id, double click on the "SplitSensorData" node and set the value in the "sensor" field. Other output can be selected by editing the sub-flow template.

  • Some graphical elements to display the data : The gauge, text, chart must be in the panel UI group. ie "[SM32WL Demo] Sensor 6". The group name must not be changed because it is used to show/open the group when sensor data are received.

4. AT Command

The AT command tab is in charge of handling AT command logic and performing the log.

Serial log panel

The AT commands are sent by main flow and enters in the "validate command" node. The validate command performs this tasks :

  • Check that another command is not ongoing. If there is another command, send an error "Busy".
  • Store the command to be processed and the origin of the message (the Flow name is indicated in message)
  • Forward the command to serial port.

When the command is sent to Serial port, it is also sent to timer node to create a timeout. If there is no answer after the timeout, an error will be raised.
When the response from board is received, it is processed by "result formatter" node. It will change the message to make it understandable by other nodes (FSM, data decoding, timeout node). The node also handles the connect, disconnect and reset messages. The "timeout reset" checks the answer type, and if it is the end of a command, the timeout timer will be stopped. When Timeout timer ends, then a message is sent to "Result formatter" to cancel ongoing AT command and raise a timeout error to the main flow.


The bottom part of the tab manages the log area.

Serial log panel

The logs are coming from the serial port or from the flow output. A direction information is added in the "from" field of each message. Then, the log are formatted : time stamp is added, and object is created with the timestamp, direction and log information. The data are then sent to ui-table handler and displayed in ui-table. The scroll down function node has 2 goals :

  • store auto scroll status when it is changed
  • If auto-scroll is on, each time a new message is added in log, send a request to ui-table to scroll to the last line of log.

5. AT commands details

The AT commands listed below are used for the demo dashboard

5.1. Concentrator reset and config :

  • ATZ  : Resets the board.
  • AT+REGION=x : Defines the region.
  • AT+SUBREGION=x : Defines the subregion.
  • AT+BEACON_ON : Starts the beacon broadcast.
  • AT+LIST_REGIONS : Prints list of all available regions and subregions.

5.2. sensor status :

The concentrator sends the data received from sensors in notifications : AT+RCV. Exemple : AT+RCV=0x00004e1c,0x10,0:6,-35,6,+30.00,3.30 Format of the message is  :

  • AT+RCV=
  • 0x00004e1c : Sensor EUI
  • 0x10 : number of packet transmitted by the sensor.
  • -35 : RSSI level
  • 6 : SNR
  • +30.00 : sensor temperature (inside MCU)
  • 3.30 : sensor voltage