LR IoT click
LR IoT Click is a compact add-on board that contains a long-range LoRa transceiver. This board features Semtech Corporation’s LR1110, an ultra-low power platform integrating a LoRa® transceiver, multi-constellation GNSS, and passive WiFi AP MAC address scanner. Alongside its sub-GHz capabilities, the LR1110 also has a multi-band front-end capable of receiving 802.11b/g/n WiFi Access Point MAC addresses and GNSS (GPS, BeiDou, geostationary) satellite raw data befitting geo-positioning purposes. The acquired information is then transmitted using an LPWAN network to a geolocation server, which analyzes it and correlates the position with data from a geolocation database, enabling a unique balance between low power and performance.
click Product page
Click library
- Author : Stefan Filipovic
- Date : Sep 2022.
- Type : SPI type
Software Support
We provide a library for the LR IoT Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for LR IoT Click driver.
Standard key functions :
lriot_cfg_setup
Config Object Initialization function.
void lriot_cfg_setup(lriot_cfg_t *cfg)
LR IoT configuration object setup function.
LR IoT Click configuration object.
Definition lriot.h:297
lriot_init
Initialization function.
err_t lriot_init(lriot_t *ctx, lriot_cfg_t *cfg)
LR IoT initialization function.
LR IoT Click context object.
Definition lriot.h:273
lriot_default_cfg
Click Default Configuration function.
err_t lriot_default_cfg(lriot_t *ctx)
LR IoT default configuration function.
Example key functions :
lriot_get_wifi_scan_results
This function performs a WiFi scanning and reads the results.
err_t lriot_get_wifi_scan_results(lriot_t *ctx, lriot_wifi_scan_results_t *results)
LR IoT get wifi scan results function.
LR IoT WiFi Scan results object.
Definition lriot.h:205
lriot_get_gnss_scan_results
This function performs a GNSS scanning and reads the results.
err_t lriot_get_gnss_scan_results(lriot_t *ctx, lriot_gnss_scan_results_t *results)
LR IoT get gnss scan results function.
LR IoT GNSS Scan results object.
Definition lriot.h:222
lriot_send_lora_message
This function sends a LoRa message to the receiver.
err_t lriot_send_lora_message(lriot_t *ctx, uint8_t *message)
LR IoT send lora message function.
Example Description
This example demonstrates the use of LR IoT click board by reading a GNSS and WiFi
scanning results and displaying it on the USB UART. In the case of a tranceive firmware the communication between two devices over LoRa will be demonstrated as well.
The demo application is composed of two sections :
Application Init
Initializes the driver, performs the click default configuration, and after that reads
and displays the chip's firmware information. In the case you need to update or change the default firmware refer to the LRIOT_UPDATE_FIRMWARE and LRIOT_FIRMWARE_SELECTOR macro definition.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( SPI_MASTER_ERROR ==
lriot_init( &lriot, &lriot_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
{
lriot_display_chip_info ( chip_info );
}
log_info( &logger, " Application Task " );
}
#define LRIOT_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition lriot.h:165
err_t lriot_get_chip_info(lriot_t *ctx, lriot_chip_info_t *info)
LR IoT get chip info function.
@ LRIOT_OK
Definition lriot.h:322
@ LRIOT_ERROR
Definition lriot.h:323
void application_init(void)
Definition main.c:72
LR IoT chip info object.
Definition lriot.h:240
Application Task
There are 3 types of the example:
1. Modem firmware: reads a GNSS and WiFi scanning results and displays them on the USB UART.
- Transcever firmware (application mode transmitter ): reads a GNSS and WiFi scanning results as well as the chip internal temperature and sends specific LoRa messages containing that information to the LoRa receiver.
- Transcever firmware (application mode receiver): reads all incoming LoRa packets and displays them on the USB UART.
{
#if ( LRIOT_FIRMWARE_SELECTOR == LRIOT_TRANSCEIVE_FIRMWARE )
#ifdef DEMO_APP_TRANSMITTER
uint8_t tmp_buf[ 30 ] = { 0 };
float temperature = 0;
{
lriot_display_gnss_scan_results ( gnss_results );
}
memset( lora_buffer, 0, sizeof ( lora_buffer ) );
strcpy( lora_buffer, "Number of sattelites found is " );
l_trim ( tmp_buf );
strcat( lora_buffer, tmp_buf );
{
log_printf( &logger, "Send LoRa message - done\r\n" );
}
{
lriot_display_wifi_scan_results ( wifi_results );
}
memset( lora_buffer, 0, sizeof ( lora_buffer ) );
strcpy( lora_buffer, "Number of WiFi scan results is " );
l_trim ( tmp_buf );
strcat( lora_buffer, tmp_buf );
{
log_printf( &logger, "Send LoRa message - done\r\n" );
}
log_printf ( &logger, "**************************************************************\r\n" );
{
log_printf ( &logger, "Temperature : %.2f degC\r\n", temperature );
}
memset( lora_buffer, 0, sizeof ( lora_buffer ) );
strcpy( lora_buffer, "My temperature is " );
float_to_str ( temperature, tmp_buf );
l_trim ( tmp_buf );
tmp_buf[ 5 ] = 0;
strcat( lora_buffer, tmp_buf );
strcat( lora_buffer, " degC" );
{
log_printf( &logger, "Send LoRa message - done\r\n" );
}
#else
{
log_printf ( &logger, "**************************************************************\r\n" );
log_printf ( &logger, "* RECEIVED LORA PACKET *\r\n" );
log_printf ( &logger, "**************************************************************\r\n" );
log_printf ( &logger,
" RSSI : %d dBm\r\n", ( uint16_t ) pkt_status.
rssi_pkt_in_dbm );
log_printf ( &logger,
" SNR : %d dB\r\n", ( uint16_t ) pkt_status.
snr_pkt_in_db );
log_printf ( &logger, " Message : \"%s\"\r\n\n", lora_buffer );
}
#endif
#else
{
lriot_display_gnss_scan_results ( gnss_results );
}
{
lriot_display_wifi_scan_results ( wifi_results );
}
#endif
}
#define LRIOT_LORA_PKT_PAYLOAD_LEN
LR IoT LoRa macros.
Definition lriot.h:118
err_t lriot_get_temperature(lriot_t *ctx, float *temperature)
LR IoT get temperature function.
err_t lriot_read_lora_message(lriot_t *ctx, lriot_lora_packet_status_t *pkt_status, uint8_t *message)
LR IoT read lora message function.
void application_task(void)
Definition main.c:115
uint8_t num_satellites
Definition lriot.h:223
LR IoT LoRa packet status object.
Definition lriot.h:261
int8_t signal_rssi_pkt_in_dbm
Definition lriot.h:264
int8_t rssi_pkt_in_dbm
Definition lriot.h:262
int8_t snr_pkt_in_db
Definition lriot.h:263
uint8_t num_wifi_results
Definition lriot.h:213
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.LRIoT
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.