Aqua-Scope Technologies GENLWE01 LoRaWAN Generic Node Installation Guide
- June 16, 2024
- Aqua-Scope Technologies
Table of Contents
- Product Description
- Hardware
- Use the precompiled pre installed firmware
- Configuration Parameters
- Single Button Menu
- LoRaWAN Payload Commands (Payload Format)
- Own compiled firmware
- Technical Data
- Support and Contact
- Declaration of Conformity
- Disposal Guidelines
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
LoRaWAN Generic
Node
SKU: GENLWE01
Version: 1.0.0
Users and Installation Manual: LoRaWAN Generic Node (GENLWE01)
Product Description
This LoRa device provides a range of I/O options and enables control and monitoring in either LoRaWAN or LoRa P2P mode. In LoRa P2P mode, it allows direct control of Aqua-Scope Motor Servos from I/Os without the need for additional setup or complex installations. Similarly, in LoRaWAN mode, various sensors, digital inputs, and analog inputs can be communicated without requiring extensive technical knowledge. Additionally, it supports the use of custom Android firmware on the device. The device can be powered using a USB-C connection, a 3.3-3.6 V battery, or a 5-12 V AC power supply.
Hardware
The device utilizes the RAK wireless LoRa Module, which consists of an STM32 microcontroller and an SX1262 LORA frontend, to implement a versatile LoRa sensor or actuator. The design is complemented by several onboard sensors, an onboard antenna, and convenient access to generic I/O signals through screw terminals. The device features the following components:
- Onboard button
- One green and one red LED
- NTC for temperature sensing
- ADC for battery voltage measurement
- 3 generic IO’s for own applications
- UART RX/TX interface, used for AT commands, serial console, and firmware updates. It supports TTL UART with 3.3 V and a baud rate of 115200 in 8N1 configuration
- 6 pin jumper header (not soldered in). This connector is only needed when dealing with own compiled firmwares
The device has three different options for power supply:
- USB-C power supply using the USBC socket
- 3 – 3.6 V DC battery using the battery input terminals (GND and BAT).
- 5 – 12 V external AC power supply using the VCC input terminals GND and 12V
Use the precompiled pre installed firmware
Generic AT Commands
The default firmware preloaded on the device serves as a generic LoRa device
that can read and write I/Os. It can communicate using either LoRaWAN or LoRa
P2P mode. The serial interface, whether it’s the RX/TX terminals or the jumper
header, supports a comprehensive set of AT commands.
Both LoRaWAN and LoRa P2P mode support the AT commands as described on
https://docs.rakwireless.com/RUI3/. This generic set of commands is enhanced
by certain device-specific commands.
To switch between LoRaWAN and LoRa P2P modes, you can use the AT command
AT+NWM = 1 to enable LoRaWAN or AT+NWM = 0 to enable LoRa P2P mode.
LoRaWAN functions
Before using the device, it is necessary to register it with your LoRaWAN
server by providing the three keys associated with the device. The device EUI
can be found printed on the device itself. To obtain the missing keys, you
need to enter the device EUI and your registered email address on the website
https://aqua-scope.com/lora. The email address should be the one associated
with your Aqua-Scope Shop account or the one provided by your point of sale.
Failure to register the device or lack of a LoRaWAN network with the
registered LORA keys will result in a failed LoRaWAN joining process. Each
LoRaWAN communication, such as a button press, change in I/Os, or regular
heartbeat, triggers a rejoin attempt. The ongoing LoRaWAN join process is
indicated by slow green/red blinking, while success or failure is indicated by
triple green or red blinks.
The generic device can function as either a Class A or Class C device,
depending on the desired function. By default, it operates as a Class A device
regardless of the pins and functions used. If you intend to use the device as
an actuator, you must switch it to Class C mode using the AT command
AT+CLASS=C (refer to the AT command description for more details).
Please note that Class C mode requires the device to be powered by a mains
power source. You can power the device either through the USB-C connector or
the 5-12 V AC input.
By default, the device functions as a sensor node and reports the following
sensor types:
- 0x01 Temperature: The VAL represents the temperature in 1/10 degrees Celsius using 2complement format. For example, 0x06 0x01 0x00 0xCD corresponds to a temperature of 20.5°C, and 0x06 0x01 0xFF 0xEA corresponds to a temperature of -2°C. 0x05
- Digital Pins: The value represents the status of the two GIOs (bit 0 = 0x01 = SDA, bit 1 = 0x02 = SCL).
- 0x04 ADC (when activated): The VAL represents a positive 16-bit ADC value.
For detailed information on the format of the downlink and uplink payloads in LoRaWAN, please refer to the LoRaWAN payload description. It will provide you with the specific structure and data format used for communication. It’s important to note that downlink commands are only sent immediately when the LoRaWAN device is in Class C mode. In Class C mode, the device is continuously listening for downlink messages, allowing for immediate response and two-way communication.
Configuration Parameters
Parameter 4 (0x04): Wakeup Interval
This parameter defines the wakeup interval of the device in seconds. When
wakeup the device sends out a status report. This report consist of the
battery status command plus certain sensor report commands.
On default the value is set to 900 = 15 min,
Parameter 8 (0x08): Configuration of GPIO Pin ‘SDA’
This parameter defines the operation of the GPIO ‘SDA’ The following values
are valid: 0 = input static, 1 = input pulse, 2 = output. On default the pin
is set as static input.
Parameter 9 (0x09): Configuration of GPIO Pin ‘SCL’
This parameter defines the operation of the GPIO ‘SDA’ The following values
are valid: 0 = input static, 1 = input pulse, 2 = output. On default the pin
is set as static output.
Parameter 10 (0x0a): Configuration of GPIO Pin ‘ADC’
This parameter defines the operation of the GPIO ‘SDA’ The following values
are valid: 0 = input static, 1 = input pulse, 2 = output, 3 = analog input. On
default the pin is set as analog input.
Specific AT commands for LoRaP2P to control Aqua-Scope Motors
In LoRa P2P mode, whether set using AT commands or the single-button menu, the
device can be controlled by AT commands as well, and all generic functions are
available.
By default, the LoRa P2P mode is set up to directly control Aqua-Scope Motor
servos with specific LoRa parameters. These parameters can be changed using AT
commands if needed:
- Frequency: 869525000 Hz
- Spreading factor: 9
- LoRa bandwidth: 125 kHz
- Coding rate: 4/5
- Preamble length: 8
- Fixed payload: false
- CRC flag: true
- IQ inversion: true
- Public syncword: true
When in LoRa P2P mode, the device can be in either sleep or awake mode:
- Awake mode: The device is permanently able to receive status updates from the motors. The current status of the motor is indicated by a short red or green blink of the LEDs.
- Sleep mode: All LEDs are off, and commands are only received immediately after sending out a command. In sleep mode, the device conserves power but does not receive continuous motor status updates.
The motor can be controlled in three different ways:
- Short Push of the button.
- AT Command: Use specific AT commands to control the motor. Details of these commands are provided below.
- Signal level on GPIO SDA, as shown in the picture.
In addition to the generic set of AT commands, there are four application- specific AT commands available to support direct control of the motor servos:
- ATC+PEUI=xxxxxxxx: Set the motor’s 8-digit Device EUI. The Device EUI is printed on the Motor device.
- ATC+PKEY=xxxxxxxxxxxxxxxx: Set the motor’s 16-digit Application Key. Enter this key and your registered email address on https://aqua-scope.com/lora to obtain the missing keys. The email address should be the account email associated with the Aqua-Scope Shop where you purchased the device or the data provided by your point of sale.
- ATC+SLEEP=0 or ATC+SLEEP=1 : This command turns the device into sleep or ‘always on’ mode. For battery operation the device must be in sleep mode. However, in sleep mode the local display of the motors status using LED will be turned off an no update on motor position is received. If you need to rely on the feedback signal for motor position you must run the device mains powered and deactivate the sleep mode using ATC+SLEEP=0 .
- ATC+VALVE=x: Turn valve into open (1) or close (0) position
- ATC+PIN=x,y: Changes the operating mode of the GPIOs
◯ pin SDA: x = 1
◯ pin SCL: x = 2
◯ pin ADC: x = 3
◯ y = 0: Digital Input, Static Mode
◯ y = 1: Digital Input, Pulse Mode
◯ y = 2: Digital Output
◯ y = 3: Analog Input (ADC terminal only)
Static mode means that the current status of the input pin (HIGH or LOW) defines the desired position of the motor. In Pulse mode the pin is always in HIGH and every external LOW pulse changes the motor status.
Single Button Menu
To change settings on the device using the button and LEDs, follow these steps:
- Short Push: Pressing the button briefly will always change the state of the motor if the device is in LoRa P2P mode and configured for direct control of motors.
- Enter the Single-Button Menu: Keep the button pressed for approximately three seconds until the green LED turns off. Once you release the button, the green LED will start flashing rapidly, indicating that you have entered the single-button menu.
- Menu Timeout: If you don’t operate the button for more than 10 seconds, the single-button menu will terminate without any action or change of settings. This is indicated by the fast green LED flashing stopping.
Menu Navigation:
-
Option Selection: After releasing the button, the red LED will blink once, indicating menu option ‘1’.
Short clicks of the button will increase the number of red LED blinks in a sequence. The sequence ranges from one short blink up to six short blinks and then starts again from 1. Each number corresponds to a menu option (1…4). -
Executing a Menu Option: To execute a menu option, select it first by using short clicks on the button. Once the desired number of green LED blinks appears, keep the button pressed for more than two seconds until the green LED stays on.
Menu Options:
- Option 1: Toggle status LED and the RX mode. On default the LEDs will show the status of the motor and any local operation of the motor will be received by LoRaP2P and shown on the LEDs, the defined indicator pin and the UART. The price for this convenience is a higher power consumption only viable when the device is powered by an external power supply. If you run the device on batteries toggle this option to Sleep mode. The LEDs will go off indicating that the device is sleeping. In this mode it will not receive any status changes of the motor.
- Option 2: Toggle between LoraP2P mode (direct control of the motor, default value) and LoRaWAN Class A device. LoRaWAN mode is indicated by blinking red/green after power-on as long as the device searches for a LoRaWAN network. This function mirrors the AT commend AT+NWM = 1|0 on the serial terminal.
- Option 3: Turn terminal SDA into static mode (default)
- Option 4: Turn terminal SDA into pulse mode
By navigating these menu options, you can customize the behavior and settings of the device.
LoRaWAN Payload Commands (Payload Format)
LoRaWAN commands can be daisy chained into the payload up to the defined maximum payload size of 51 bytes. This mean that for all commands sent to defined number of bytes in the payload is required to avoid misinterpretation of command and/or command values in the receiver side. All uplink and downlink commands use FPort=10.
- Uplink Command Hardware Version Report: 0x03 – HW – CAP_MSB CAP_LSB (4 Byte): This command reports the hardware version and a bitmap of the capabilities of the device. It is sent unsolicited as the first command during boot-up and as replying command to downlink command Hardware Version Get. HW is a single byte indicating the version of the hardware. The bitmap indicates the different capabilities of the device.
- Uplink Command Configuration Report: 0x04 – IDX – VAL_MSB – VAL_LSB (4 Byte): This command reports a configuration parameter of the device: IDX is the number of the configuration parameter. The 16 Bit VAL is the parameter itself. Configuration parameters are always 16 Bit values. The table below describes the configuration parameters and their values.
- Uplink Command Sensor Report: 0x06 – ID – VAL_MSB – VAL_LSB (4 Byte): This command reports sensor values. The ID indicates the sensor type and defines the format of the 16-Bit VAL. The sensor types of this devices are listed below.
- Uplink Command Firmware Version Report: 0x0a – VER_MSB VER_2 VER_3 VER LSB (5 Byte): This command reports the 32-bit value of the current firmware. It is sent unsolicited as the first command during boot-up and as replying command to downlink command ‘Hardware Version Get’.
- Uplink Command Battery Report: 0x12 – VOLT – BAT_MSB – BAT_LSB (4 Byte): This command reports the status of the battery. VOLT is the measured voltage of the battery in 100 mV steps, the BAT value is the consumption of the current battery – as counted inside the system – in mAh.
- Downlink Command Hardware Version Get: 0x03 – (1 Byte): This command calls for a Hardware Version Report sent upstream
- Downlink Command Configuration Set: 0x04 – IDX – VAL_MSB – VAL_LSB (4 Byte): This command allows setting configuration parameters of the device: IDX is the number of the configuration parameter. The 16 Bit VAL is the parameter itself. Configuration parameters are always 16 Bit Values. The table below describes the configuration parameters and its values.
- Downlink Command I/O Control: 0x05 – PIN – VAL (4 Byte): This command sets the output value of the Generic Pins. PIN may be 1 = SDA, 2 SCL, or 3 = ADC, the VAL will be either 1 or zero. Please make sure that the output controlled is in output mode.
- Downlink Command Sensor Get: 0x06 – ID (2 Byte): This command requests the report of sensor values. The ID indicates the sensor type. The sensor types of the devices are listed below.
- Downlink Command Configuration Get: 0x14 – IDX (2 Byte): This command allows reading the configuration value IDX. The device will respond with an upstream command Configuration Report
Own compiled firmware
The device is based on the RAK Wireless RAK3172 module, which comes with the
RAK bootloader. This allows you to use your own firmware compiled with the
Arduino environment. For detailed instructions on how to compile and load
custom firmware, please visit the following link:
https://docs.rakwireless.com/Product-
Categories/WisDuo/RAK3172-Module/Quickstart/.
If you wish to use your own compiled firmware or the original RAK Wireless AT
modem firmware, you will need to connect a Serial/USB connector either to the
programming pins located next to the button or to the UART TX/TX terminals.
The pin assignment for the 6 pins can be found on the backside of the PCB. Here is the pin configuration:
- TX: Connect to the RX of the Serial connector.
- RX: Connect to the TX of the Serial connector.
- GND: Connect to ground.
- VCC: You can power the device directly from the Serial connector, but in that case, you should not use any of the other power options.
- BOOT: In case there is an issue when flashing your own firmware, you can recover the original RAK Wireless firmware by using the STM Programmer in STM boot mode. Connect the BOOT pin to VCC before powering the device to activate the boot mode expected by the STM programmer. There is a second VCC pin next to the BOOT pin for easy application of a jumper. Please refer to the abovementioned RAK Wireless documentation for more details.
The following peripherals are accessible using RAK Pin Macros:
- Button: PA_1 (digital input)
- Red LED: PA_10 (digital output)
- Green LED: PA_9 (digital output)
- Temperature NTC: PB_2 (digital input)
- Temperature NTC Enable: PB_5 (digital output)
- Battery Voltage: PB_3 (analog input)
- Generic Terminal ADC: PB_4 (analog or digital input or output)
- Generic Terminal SDA: PA_11 (analog or digital input or output)
- Generic Terminal SCL: PA_12 (analog or digital input or output)
- UART2 with RX and TX: PA_2/PA_3 (serial console and firmware update)
The SDA and SCL pins can also be used as an I2C interface.
The NTC pin is connected to a voltage divider consisting of an NTCG164KF104FT1
(R = 100 KOhm, b = 4485) and a 100 KOhm fixed resistor. When operating on
battery power, this voltage divider will draw a constant current of 16 uA
(3.3V / 200 KOhm). To prevent unnecessary battery drain, the power to the NTC
voltage divider can be switched on and off. Temperature measurement is only
possible when the pin is in a HIGH state. Please refer to the code example
below for instructions on how to activate the NTC voltage divider and read the
NTC value.
int16_t getNTC() {
digitalWrite(PB_5, HIGH);
api.system.sleep.all(100);
int16_t ntc = analogRead(PB_2);
float r_ntc = 100000.0 (1023.0 – ntc) / (ntc – 1);
float t_ntc = (1 / ((log(r_ntc / 100000.0) / 4485.0) + (1.0 / (25.0 +
273.15)))) –
273.15;
digitalWrite(PB_5, LOW);
return (int16_t) (t_ntc 10); // in 1/10 degrees
}
Scope of Delivery
- Main Device
- Manual
Technical Data
- Platform: STM32WLE5CCU6
- Wireless Connection:
- Spec:LoRaWAN 1.0.3
- Join: OTAA
- Class: A
- Frequency: EU868
- Range: > 2km (TX 22 dB)
- Protection: IP 20
- GPIOs
- Output: max. 20 mA
- Input: min. 10 uA
- Power consumption
- Sleeping: 30 uA
- RX: 8.5 mA
- TX: 87 mA (@ 20 dbm 868 MHz)
- Environmental Conditions
- Shipping and Storage: -65 °C … 125 °C
- Operation: – 40 °C … 85 °C
- Humidity: 0…90 %
- Dimensions: 40 x 24 x 14 mm
- Weight (without Battery): 10 gr.
Support and Contact
Should you encounter any problem, please give us the opportunity to address it
before returning this product. Please check our website www.aqua-
scope.com and particularly the support section for
answers and help. You can also send a message to info@aqua-
scope.com.
While the information in this manual has been compiled with great care, it may
not be deemed an assurance of product characteristics. Aqua-Scope shall be
liable only to the degree specified in the terms of sale and delivery. The
reproduction and distribution of the documentation and software supplied with
this product and the use of its contents is subject to written authorization
from Aqua-Scope. We reserve the right to make any alterations that arise as
the result of technical development.
- Phone: +372 (0) 6248002
- eMail: info@aqua-scope.com
- Web: www.aqua-scope.com
Declaration of Conformity
Aqua-Scope Technology OÜ, Sakala 7-2, 10141 Tallinn, Republic of Estonia, declares that this radio emitting device works on the following frequences:
Hereby, Aqua-Scope Technology OÜ declares that the radio equipment type GENLWE01 is in compliance with Directive 2014/53/EU. The full text of the EU declaration of conformity is available at the following internet address: www .aqua-scope.com/ce
Disposal Guidelines
**** Do not dispose of electrical appliances as unsorted municipal waste, use
separate collection facilities. Contact your local government for information
regarding the collection systems available.
If electrical appliances are disposed of in landfills or dumps, hazardous
substances can leak into the groundwater and get into the food chain, damaging
health and well-being.
Copyright © 2023 Aqua-Scope
Technologies, Sakala tn 7-2, 10141 Tallinn, Estonia,
www.aqua-scope.com
References
- Oscilloscope | Keysight
- Install a water leakage protection system DIY: Aqua-Scope
- CE Declarations + Datasheets: Aqua-Scope
- LoRa Access Keys: Aqua-Scope
- RAK3172 Module Quick Start Guide | RAKwireless Documentation Center
- RAKwireless Unified Interface V3 (RUI3) | RAKwireless Documentation Center
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>