Antares
Antares
en
en
  • Getting Started
    • Account Registration
    • Create App
    • Add Devices to the Application
    • Installation Board and Library
      • ESP8266
      • ESP32
      • STM32
    • Arduino IDE Installation
    • Arduino Library Installation
      • Antares LoRaWAN
      • Antares Wi-Fi HTTP
      • Antares Wi-Fi MQTT
      • DHT11 Sensor Library
      • Adafruit SSD1306
    • STM32 Cube IDE Installation
    • Expansion Pack I-CUBE-LRWAN Installation
    • Software Installation
      • MQTTX Installation
      • Postman Installation
      • Operating System (OS) on SD Card Installation
    • Quickstart
  • Antares Insight Hub
    • Getting Started
      • Request Demo
      • Request Free Trial
    • Usecase
      • Power Meter
        • Power Meter Usecase Prerequisites
        • Power Meter Device Recommendation
        • Payload Example Power Meter
        • Setup Device Threshold Power Meter
      • Water Meter
        • Water Meter Usecase Prerequisites
        • Water Meter Device Recommendation
        • Payload Example Water Meter
        • Setup Device Threshold Water Meter
      • Water Level
        • Water Level Usecase Prerequisites
        • Water Level Device Recommendation
        • Payload Example Water Level
        • Setup Device Threshold Water Level
      • Environment Monitoring
        • Prerequisites for Use of Environmental Monitoring
        • Environment Monitoring Device Recommendation
        • Payload Example Environment Monitoring
        • Setup Device Threshold Environment Monitoring
    • Settings
      • Manage Alert Recipient (Telegram)
      • Manage User
      • Roles
  • Subscription and Payment
    • Platform
      • How to Use Platform Packages
      • How to Purchase a Platform Subscription
        • Payment Using Antares Coins
        • Payment Using Virtual Account
          • Mandiri Bank
          • Permata Bank
          • BRI Bank
          • BNI Bank
        • Payment Using e-Wallet (LinkAja)
        • Payment Using Credit Cards (CC)
      • Procedure for Renewing a Platform Subscription
      • Procedure for Changing Platform Subscription
    • Connectivity
      • How to Use Connectivity Packages
      • How to Purchase a Connectivity Subscription
        • Payment Using Antares Coins
        • Payment Using Virtual Account
          • Mandiri Bank
          • Permata Bank
          • BRI Bank
          • BNI Bank
        • Payment Using e-Wallet (LinkAja)
        • Payment Using Credit Cards (CC)
      • Procedure for Renewing a Platform Subscription
      • Procedure for Changing Connectivity Subscription
    • Antares Coins
      • Antares Coins Top Up Payment Procedures
        • Payment Using Virtual Account
          • Mandiri Bank
          • Permata Bank
          • BRI Bank
          • BNI Bank
        • Payment Using e-Wallet (LinkAja)
        • Payment Using Credit Cards (CC)
  • Code and library examples
    • ESP8266 (Wi-Fi)
      • General Prerequisites ESP8266 Wi-Fi
      • ESP8266 (Wi-Fi) HTTP Protocol
        • Sending Simple Data to Antares with HTTP Protocol
        • Retrieve the Last Data from Antares Server with HTTP Protocol
        • Simple Project ESP8266 HTTP Antares
          • Periodic Post DHT 11 Data
          • Post DHT 11 Data with Push Button
          • Post DHT 11 data and Display on OLED
          • Get Data displayed on OLED
          • Post and Get DHT 11 Data displayed on OLED
          • Controlling Relays and LEDs Through Get Commands
      • ESP8266 (Wi-Fi) MQTT Protocol
        • Sending Simple Data to Antares with the MQTT Protocol
        • Retrieve Last Data from Antares Server with MQTT Protocol
        • Simple Project ESP8266 MQTT Antares
          • Periodic Send DHT 11 Data
          • Send DHT 11 Data with Push Button
          • Send DHT 11 data and display on OLED display
          • Retrieve Data displayed on OLED Display
          • DHT 11 Send Data and Retrieve Data displayed on OLED Display
          • Controlling Relays and LEDs Through Get Commands
    • Arduino Uno
      • Arduino IDE Installation
      • Antares Ethernet Shield Library Installation
      • Configuration
      • Send Simple Data to Antares
    • ESP32 (Wi-Fi)
      • General Prerequisites ESP32 Wi-Fi
      • ESP32 (Wi-Fi) HTTP Protocol
        • Sending Simple Data to Antares with HTTP Protocol
        • Retrieve the Last Data from Antares Server with HTTP Protocol
        • Simple Project Lynx-32 HTTP Antares
          • Periodic Post DHT 11 Data
          • Post DHT 11 Data with Push Button
          • Post DHT 11 Data and Display on OLED
          • Get Data displayed on OLED
          • Post and Get DHT 11 Data displayed on OLED
          • Controlling Relays and LEDs Through Get Commands
      • ESP32 (Wi-Fi) MQTT Protocol
        • Sending Simple Data to Antares with the MQTT Protocol
        • Retrieve Last Data from Antares Server with MQTT Protocol
        • Simple Project Lynx-32 MQTT Antares
          • Periodic Send DHT 11 Data
          • Send Data DHT 11 dengan Push Button
          • Send DHT 11 Data and Display on OLED
          • Retrieve Data displayed on OLED Display
          • DHT 11 Send Data and Retrieve Data displayed on OLED
          • Controlling Relays and LEDs Through Retrieve Commands
      • HTTP & MQTT Protocol
    • ESP32 (LoRa)
      • General Prerequisites ESP32 LoRa
      • Sending Simple Data to Antares
      • Project Simple Lynx-32 LoRa Antares
        • Uplink DHT11 Data Periodically
        • Uplink Data DHT11 dengan Push Button
        • Uplink DHT11 Data and Display on OLED Display
        • Downlink Data Displayed on OLED
        • DHT 11 Uplink Data and Downlink Data displayed on OLED
        • Controlling Relay and LED via Downlink Command
      • LoRaWAN Class
    • STM32 (LoRa) STM32Cube IDE
      • General Prerequisites STM32 (LoRa) STM32Cube IDE
      • Sending Simple Data to Antares
    • STM32 (LoRa) Arduino IDE
      • General Prerequisites STM32 (LoRa) Arduino IDE
      • Sending Simple Data to Antares
    • Raspberry Pi
      • GUI (Graphical User Interface)
        • Raspberry GUI General Prerequisites
        • Sending Data Using Node.js
        • Temperature and Humidity Monitoring Using DHT11 Sensor
      • SSH (Secure Shell)
        • Common Raspberry SSH Prerequisites
        • Sending Data Using Node.js
        • Temperature and Humidity Monitoring Using DHT11 Sensor
    • NB-IoT
      • NB-Lynx-7000
        • General Prerequisites NB-Lynx-7000
        • Sending Simple Data to Antares
        • Retrieving GNSS (Global Navigation Satellite System) Data
      • NB-Lynx-95
        • General Prerequisites NB-Lynx-95
        • Sending Simple Data to Antares
    • Android
      • Retrieve data from ANTARES using Android
      • Coding Stuff
    • MIT App Inventor
    • Node-RED
    • Postman
    • MQTT | Push data to Device
    • HTTP | Subscribe and Notify Mechanism
    • PHP Library
    • MQTT | Subscribe LoRa Device
    • LoRaWAN | Downlink Tutorial
    • LoRaWAN Device Register
      • Register Menu
    • GPS TrackerID
  • Data Model
  • Port Configuration
  • API | HTTP
    • Device
    • Data of Device
    • Subscriber
  • API | MQTT
    • Device
    • Subscriber
  • List of Acronyms
  • Relevant Software
Powered by GitBook
On this page
  • Prerequisites
  • Follow These Steps
  • 1. Open the STM32 Cube IDE application
  • 2.Import LoRaWAN Project End_Node
  • 3. Set LoRaWAN Parameters in Programme Code
  • 4. Set LoRaWAN Parameters in Antares
  • 5. Run Program
  • 6. Check Data in Antares
  1. Code and library examples
  2. STM32 (LoRa) STM32Cube IDE

Sending Simple Data to Antares

PreviousGeneral Prerequisites STM32 (LoRa) STM32Cube IDENextSTM32 (LoRa) Arduino IDE

Last updated 8 months ago

In this project you will be directed to send dummy data from STM32L072 LoRa Discovery Kit B-L072-LRWAN1 to Antares IoT Platform using LoRa connectivity with LoRaWAN protocol.

The LoRaWAN protocol is divided into two classes, Class A and Class C, each class has its own advantages and disadvantages, for more details please visit the following page.

Prerequisites

The required materials follow the General Prerequisites on the previous page. If you have not prepared the requirements on that page, then you can visit the following page.

Follow These Steps

1. Open the STM32 Cube IDE application

2.Import LoRaWAN Project End_Node

In this section, we will explain how to import a project into the STM32 Cube IDE from the I-CUBE-LRWAN expansion software.

You can start creating an application using the STM32Cube IDE. The STM32Cube IDE uses workspaces to store the application files that we will create. You can leave it by default, or create a new workspace, as well as select a workspace that you have already created.

After selecting the directory for the workspace, you can click the launch button until the start page of the STM32 CUBE IDE appears.

To use the sample application provided by the I-CUBE-LRWAN expansion software, you can import the application provided in the expansion folder. In this example, we will use the LoRaWAN_End_Node example found in the STM32CubeExpansion_LRWAN_V2.1.0\Projects\B-L072Z-LRWAN1\Applications\LoRaWAN\LoRaWAN_End_Node\LoRaWAN\App folder.

In the next step, we need to import the project files in the STM32 Cube Expansion folder into the STM32 Cube IDE software. To import the files, click on the file and select Open Projects from File System.

Then click Directory to select the location of the project to import. For this tutorial, the project to be imported is in the following folder: STM32CubeExpansion_LRWAN_V2.1.0\Projects\B-L072Z-LRWAN1\Applications\LoRaWAN\LoRaWAN_End_Node. After that click finish.

After the project is successfully imported, the files in the project will be displayed on the left side of the STM32 Cube IDE as follows.

3. Set LoRaWAN Parameters in Programme Code

This section will explain how to integrate the STM32L072 LoRa Discovery Kit board with the Antares platform.

Firstly, select the lora_app.h file located in the LoRaWAN_End_Node/LoRaWAN/App folder. The sample programme provided in the file does not yet match the LoRaWAN Indonesia frequency. Therefore, you need to customise it.

On line 43 of the programme it says LORAMAC_REGION_EU868. To adjust to the LoRaWAN frequency in Indonesia, please change that part to LORAMAC_REGION_AS923.

Next, select the lorawan_conf.h file located in the LoRaWAN_End_Node/LoRaWAN/Target folder. In the programme in the file there are parts that need to be adjusted which are still related to the LoRaWan frequency in Indonesia. On line 49, it can be seen that the programme code uses REGION_EU868 which is not in accordance with the LoRaWan frequency in Indonesia.

So for line 49, it can be made into a comment as follows.

/*#define REGION_EU868*/

Then for this programme, REGION_AS923 is selected. So that line 44 can be uncommented as follows.

#define REGION_AS923

Next, add the following one line of code to the programme after the define REGION_AS923 section.

#define REGION_AS923_DEFAULT_CHANNEL_PLAN 2

Here's how the code looks after adding it.

You can then build the application using CTRL+B, or you can choose the Project tab > Build All.

Then to download the programme into the B-L072Z-LRWAN board, you can press F11 on the keyboard or by selecting the Run > Debug tab.

Then the console will say "Download verified successfully" indicating that the programme was successfully downloaded to the board.

Once the programme has been downloaded to the board, you can view the programme log by clicking on the open console icon in the STM32Cube IDE. Then select Command Shell Console.

The following is a view of the Command Shell Console.

Next, in Connection Type, select Serial Port.

Then in the Connection name option, press New. It can be seen that the connection name section is still empty. Because the port connection has not been registered, you can freely name this connection. For example, the connection name is COM4 (Adjusts to the serial port). Next, click finish.

Next, in the connection name, select COM4 that has just been added. Then, click OK.

Here is the view of the console. The console is still empty and does not display anything yet. It can be seen at the top of the console showing that COM4 (CONNECTED).

To be able to get information from the board such as Application EUI, Device EUI, and Application Key on the console display, press the reset button of the board once until information about the board appears on the console. The following is the information of the board displayed by the console.

Information from the board is used to connect the board with the Antares platform.

4. Set LoRaWAN Parameters in Antares

After logging into the Antares platform, select Application and click Create an Application.

Then fill in the Application Name and Application ID. In this tutorial, let's say the Application Name is LoraSTM32 and the Application ID is 1. Then press Add.

Next, add a device in the application. In this tutorial, the name of the device created is Lorawan. After the device is created, click Set Lora.

The example programme given earlier uses class A with OTAA activation mode OTAA parameters, such as Application EUI, Device EUI, and Application Key can be found in the log as shown in Figure 15.

5. Run Program

To be able to connect the board with devices on the Antares platform, click Run > Run in the STM32 CUBE IDE.

After the programme is run, it can be seen on the console that the device is connected to the Antares platform so it says Joined as follows.

6. Check Data in Antares

Setelah upload program berhasil, selanjutnya buka halaman device antares kemudian lihat apakah data lora sudah berhasil dikirim.

Data sent from the STM32L072 LoRa Discovery Kit B-L072-LRWAN1 are "counter", "port", and a message in the JSON field "data". While other parameters are supporting parameters generated by the Antares LoRaWAN Infrastructure.

LoRaWAN Class
General Prerequisites STM32 (LoRa) STM32Cube IDE
Selecting a Workspace in STM32CUBE IDE
STM32CUBE IDE Home Page
Import Project
Directory for Import Project
STM32 Cube IDE View after Import Project
Programme snippet before change
Programme snippet after change
Program Code Before Customisation
Program Code After Customisation
Code Display
Build Project
Run Debug
Programme download page
Open Console
Remote Connection
Set Connection Type
Connection Name
Connection Name
Communication Port Display Successfully Opened
Information Display Board
Creating Applications in Antares
Add Application
Set Lora
Parameter Input on Lora Set Menu
Running the program
Board successfully connected to Antares Platform
Data Received on the Antares Platform