background image

User Manual for LoRaWAN End Nodes - RS485-LN – RS485 to LoRaWAN Converter User Manual

3.3 Configure Commands to read data

There are plenty of RS485 devices in the market and each device has different command to read the valid data.

To support these devices in flexible, RS485-LN supports flexible command set. User can use 

AT Commands

 or

LoRaWAN Downlink Command to configure what commands RS485-LN should send for each sampling and how to

handle the return from RS485 devices.

Note: below description and commands are for firmware version >v1.1, if you have firmware version v1.0. Please

check the 

user manual v1.0

 or upgrade the firmware to v1.1

 

3.3.1 onfigure UART settings for RS485 or TTL communication

To use RS485-LN to read data from RS485 sensors, connect the RS485-LN A/B traces to the sensors. And user

need to make sure RS485-LN use the match UART setting to access the sensors. The related commands for UART

settings are:

AT Commands

Description

Example

AT+BAUDR

Set the baud rate (for RS485 connection). Default

Value is: 9600.

AT+BAUDR=9600
Options: (1200,2400,4800,14400,19200,115200)

AT+PARITY

Set UART parity (for RS485 connection)

AT+PARITY=0
Option: 0: no parity, 1: odd parity, 2: even parity

AT+STOPBIT

Set serial stopbit (for RS485 connection)
 

AT+STOPBIT=0 for 1bit
AT+STOPBIT=1 for 1.5 bit
AT+STOPBIT=2 for 2 bits

3.3.2 Configure sensors

Some sensors might need to configure before normal operation. User can configure such sensor via PC and

RS485 adapter or through RS485-LN AT Commands 

AT+CFGDEV

. Each 

AT+CFGDEV 

equals to send a RS485

command to sensors. This command will only run when user input it and won’t run during each sampling.

AT Commands

Description

Example

AT+CFGDEV

This command is used to configure the RS485/

TTL devices; they won’t be used during sampling.
AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,
mm: 0: no CRC, 1: add CRC-16/MODBUS in the

end of this command

AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,m

3.3.3 Configure read commands for each sampling

During each sampling, we need confirm what commands we need to send to the RS485 sensors to read data. After

the RS485 sensors send back the value, it normally include some bytes and we only need a few from them for a

shorten payload.

To save the LoRaWAN network bandwidth, we might need to read data from different sensors and combine their

valid value into a short payload.

This section describes how to achieve above goals.
During each sampling, the RS485-LN can support 15 commands to read sensors. And combine the return to one

or several uplink payloads.

Page 16 / 38 - last modified by Bei Jinggeng on 2022/07/08 16:50

Содержание RS485-LN

Страница 1: ...RS485 LN RS485 to LoRaWAN Converter User Manual last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 2: ...ds 23 3 5 2 Sensor related commands 23 3 5 3 Sensor related commands 24 3 6 Listening mode for RS485 network 28 3 7 Buttons 30 3 8 LEDs 30 4 Case Study 30 5 Use AT Command 31 5 1 Access AT Command 31 5 2 Common AT Command Sequence 32 5 2 1 Multi channel ABP mode Use with SX1301 LG308 32 5 5 2 Single channel ABP mode Use with LG01 LG02 32 6 FAQ 33 6 1 How to upgrade the image 33 6 2 How to change t...

Страница 3: ...er User Manual Table of Contents 1 Introduction 1 1 What is RS485 LN RS485 to LoRaWAN Converter 1 2 Specifications 1 3 Features 1 4 Applications 1 5 Firmware Change log 1 6 Hardware Change log 2 Power ON Device Page 3 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 4: ...ork 3 7 Buttons 3 8 LEDs 4 Case Study 5 Use AT Command 5 1 Access AT Command 5 2 Common AT Command Sequence 5 2 1 Multi channel ABP mode Use with SX1301 LG308 5 5 2 Single channel ABP mode Use with LG01 LG02 6 FAQ 6 1 How to upgrade the image 6 2 How to change the LoRa Frequency Bands Region 6 3 How many RS485 Slave can RS485 LN connects 6 4 Compatible question to ChirpStack and TTI LoRaWAN server...

Страница 5: ...evices and gets the return from the RS485 devices RS485 LN will process these returns according to user define rules to get the final payload and upload to LoRaWAN server For data downlink RS485 LN runs in LoRaWAN Class C When there downlink commands from LoRaWAN server RS485 LN will forward the commands from LoRaWAN server to RS485 devices Demo Dashboard for RS485 LN connect to two energy meters ht...

Страница 6: ...ytes with CRC 1 3 Features LoRaWAN Class A Class C protocol default Class C Frequency Bands CN470 EU433 KR920 US915 EU868 AS923 AU915 IN865 RU864 AT Commands to change parameters Remote configure parameters via LoRa Downlink Firmware upgradable via program port Support multiply RS485 devices by flexible rules Support Modbus protocol Support Interrupt uplink Since hardware version v1 2 1 4 Applicatio...

Страница 7: ...default It has OTAA keys to join network To connect a local LoRaWAN network user just need to input the OTAA keys in the network server and power on the RS485 LN It will auto join the network via OTAA 3 2 Example to join LoRaWAN network Here shows an example for how to join the TTN V3 Network Below is the network structure we use LG308 as LoRaWAN gateway here Page 7 38 last modified by Bei Jinggeng...

Страница 8: ...n this example connected to two RS485 devices for demonstration user can connect to other RS485 devices via the same method The connection is as below 485A and 485B of the sensor are connected to RS485A and RA485B of RS485 LN respectively Page 8 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 9: ...LG308 is already set to connect to TTN V3 network So what we need to now is only configure the TTN V3 Step 1 Create a device in TTN V3 with the OTAA keys from RS485 LN Each RS485 LN is shipped with a sticker with unique device EUI Page 9 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 10: ... Nodes RS485 LN RS485 to LoRaWAN Converter User Manual User can enter this key in their LoRaWAN Server portal Below is TTN V3 screen shot Add APP EUI in the application Page 10 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 11: ...User Manual for LoRaWAN End Nodes RS485 LN RS485 to LoRaWAN Converter User Manual Page 11 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 12: ...User Manual for LoRaWAN End Nodes RS485 LN RS485 to LoRaWAN Converter User Manual Page 12 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 13: ...User Manual for LoRaWAN End Nodes RS485 LN RS485 to LoRaWAN Converter User Manual You can also choose to create the device manually Page 13 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 14: ...User Manual for LoRaWAN End Nodes RS485 LN RS485 to LoRaWAN Converter User Manual Add APP KEY and DEV EUI Page 14 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 15: ...o LoRaWAN Converter User Manual Step 2 Power on RS485 LN and it will auto join to the TTN V3 network After join success it will start to upload message to TTN V3 and user can see in the panel Page 15 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 16: ...STOPBIT Set serial stopbit for RS485 connection AT STOPBIT 0 for 1bit AT STOPBIT 1 for 1 5 bit AT STOPBIT 2 for 2 bits 3 3 2 Configure sensors Some sensors might need to configure before normal operation User can configure such sensor via PC and RS485 adapter or through RS485 LN AT Commands AT CFGDEV Each AT CFGDEV equals to send a RS485 command to sensors This command will only run when user input i...

Страница 17: ...amples for the how above AT Commands works AT COMMANDx This command will be sent to RS485 devices during each sampling Max command length is 14 bytes The grammar is AT COMMANDx xx xx xx xx xx xx xx xx xx xx xx xx m xx xx xx xx xx xx xx xx xx xx xx xx The RS485 command to be sent m 0 no CRC 1 add CRC 16 MODBUS in the end of this command For example if we have a RS485 sensor The command to get senso...

Страница 18: ...User Manual for LoRaWAN End Nodes RS485 LN RS485 to LoRaWAN Converter User Manual Grab a section Grab different sections Page 18 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 19: ... to RETURNx The next step is how to compose the LoRa Uplink Payload by these RETURNs The command is AT DATAUP Examples AT DATAUP 0 Compose the uplink payload with value returns in sequence and send with A SIGNLE UPLINK Final Payload is Battery Info PAYVER VALID Value from RETURN1 Valid Value from RETURN2 RETURNx Where PAYVER is defined by AT PAYVER below is an example screen shot Page 19 38 last mo...

Страница 20: ...inal Payload is Battery Info PAYVER PAYLOAD COUNT PAYLOAD DATA 1 PAYVER Defined by AT PAYVER 2 PAYLOAD COUNT Total how many uplinks of this sampling 3 PAYLOAD Number of this uplink from 0 1 2 3 to PAYLOAD COUNT 4 DATA Valid value max 8 bytes for each uplink so each uplink 11 bytes For the last uplink DATA will might less than 8 bytes Page 20 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 21: ...0 20 20 20 2d DATA3 the rest of Valid value of RETURN10 30 Notice In firmware v1 3 the Max bytes has been changed according to the max bytes in different Frequency Bands for lowest SF As below For AU915 AS923 bands if UplinkDwell time 0 max 51 bytes for each uplink For AU915 AS923 bands if UplinkDwell time 0 max 11 bytes for each uplink For US915 band max 11 bytes for each uplink For all other bands...

Страница 22: ...mand 0x08 command Poll an uplink with current command set in RS485 LN 0xA8 command Send a command to RS485 LN and uplink the output from sensors 3 3 6 Uplink on Interrupt RS485 LN support external Interrupt uplink since hardware v1 2 release Connect the Interrupt pin to RS485 LN INT port and connect the GND pin to V port When there is a high voltage Max 24v on INT pin Device will send an uplink pa...

Страница 23: ...cial designed for RS485 LN User can see these commands below 3 5 1 Common Commands They should be available for each of Dragino Sensors such as change uplink interval reset device For firmware v1 3 user can find what common commands it supports End Device AT Commands and Downlink Command 3 5 2 Sensor related commands Response feature is added to the server s downlink a special package with a FPort o...

Страница 24: ... 40 where stored the DI status The 4C B0 is the CRC 16 MODBUS which calculate manually The command to deactivate alarm is 0A 05 00 04 00 00 8D 70 Where 0A 05 00 04 00 00 is the Modbus command to read the register 00 40 where stored the DI status The 8D 70 is the CRC 16 MODBUS which calculate manually So if user want to use downlink command to control to RS485 Alarm he can use A8 01 06 0A 05 00 04 ...

Страница 25: ...ndle return from RS485 devices Downlink Payload 0xAF downlink command can be used to set AT COMMANDx or AT DATACUTx Note if user use AT COMMANDx to add a new command he also need to send AT DATACUTx downlink Format AF MM NN LL XX XX XX XX YY Where MM the ATCOMMAND or AT DATACUT to be set Value from 01 0F NN 0 no CRC 1 add CRC 16 MODBUS 2 set the AT DATACUT value LL The length of AT COMMAND or AT D...

Страница 26: ...ority vs AT DATACUT command If AT DATACUT command is configured AT MBFUN will be ignore Example AT MBFUN 1 and AT DATACUT1 AT DATACUT2 are not configure 0 0 0 So RS485 LN AT COMMAND1 01 03 00 10 00 08 1 read slave address 01 function code 03 start address 00 01 quantity of registers 00 08 AT COMMAND2 01 02 00 40 00 10 1 read slave address 01 function code 02 start address 00 40 quantity of inputs 00...

Страница 27: ...se see Compose Uplink payload AT Command AT DATAUP 0 AT DATAUP 1 Downlink Payload 0xAD 00 Same as AT DATAUP 0 0xAD 01 Same as AT DATAUP 1 Manually trigger an Uplink Ask device to send an uplink immediately AT Command No AT Command for this user can press the ACT button for 1 second for the same Downlink Payload 0x08 FF RS485 LN will immediately send an uplink Clear RS485 Command The AT COMMANDx an...

Страница 28: ... Set Baud Rate AT BAUDR 9600 Options 1200 2400 4800 14400 19200 115200 Set UART Parity AT PARITY 0 Option 0 no parity 1 odd parity 2 even parity Set STOPBIT AT STOPBIT 0 Option 0 for 1bit 1 for 1 5 bit 2 for 2 bits Downlink Payload A7 01 aa bb Same AT BAUDR hex aa bb 100 Example A7 01 00 60 same as AT BAUDR 9600 A7 01 04 80 same as AT BAUDR 115200 A7 02 aa Same as AT PARITY aa aa value 00 01 or 02...

Страница 29: ...mmand AT RXMODE Command example Function AT RXMODE 1 10 Enable listening mode 1 if RS485 LN has received more than 10 RS485 commands from the network RS485 LN will send these commands via LoRaWAN uplinks AT RXMODE 2 500 Enable listening mode 2 RS485 LN will capture and send a 500ms content once from the first detect of character Max value is 65535 ms AT RXMODE 0 0 Disable listening mode This is the...

Страница 30: ...5 commands from AT COMMANDx the listening mode will be interrupt for a while 3 7 Buttons Button Feature ACT If RS485 joined in network press this button for more than 1 second RS485 will upload a packet and the SYS LED will give a Blue blink RST Reboot RS485 PRO Use for upload image see How to Update Image 3 8 LEDs LEDs Feature PWR Always on if there is power SYS After device is powered on the SYS...

Страница 31: ...r can use a USB to TTL adapter plus the 3 5mm Program Cable to connect to RS485 LN to use AT command as below In PC User needs to set serial tool such as putty SecureCRT baud rate to 9600 to access to access serial console of RS485 LN The default password is 123456 Below is the output for reference Page 31 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 32: ... Command Sequence 5 2 1 Multi channel ABP mode Use with SX1301 LG308 If device has not joined network yet AT FDR AT NJM 0 ATZ If device already joined network AT NJM 0 ATZ 5 5 2 Single channel ABP mode Use with LG01 LG02 AT FDR Reset Parameters to Factory Default Keys Reserve AT NJM 0 Set to ABP mode Page 32 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 33: ...he IoT Server 2 Make sure the LG01 02 gateway RX frequency is exactly the same as AT CHS setting 3 Make sure SF bandwidth setting in LG01 LG02 match the settings of AT DR refer this link to see what DR means 4 The command AT RX2FQ and AT RX2DR is to let downlink work to set the correct parameters user can check the actually downlink parameters to be used As below Which shows the RX2FQ should use 8...

Страница 34: ...d the LT Image files Step3 Open flashloader choose the correct COM port to update Hold down the PRO button and then momentarily press the RST reset button and the SYS led will change from OFF to ON While SYS LED is RED ON it means the RS485 LN is ready to be program Page 34 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 35: ...End Nodes RS485 LN RS485 to LoRaWAN Converter User Manual Notice In case user has lost the program cable User can hand made one from a 3 5mm cable The pin mapping is Page 35 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Страница 36: ...to poll their info 6 4 Compatible question to ChirpStack and TTI LoRaWAN server When user need to use with ChirpStack or TTI Please set AT RPL 4 Detail info check this link Set Packet Receiving Response Level 6 5 Can i use point to point communication for RS485 LN Yes please refer Point to Point Communication for RS485 LN 6 6 How to Use RS485 LN to connect to RS232 devices Use RS485 BL or RS485 LN...

Страница 37: ...y with the limits for a Class B digital device pursuant to part 15 of the FCC Rules These limits are designed to provide reasonable protection against harmful interference in a residential installation This equipment generates uses and can radiate radio frequency energy and if not installed and used in accordance with the instructions may cause harmful interference to radio communications However ...

Страница 38: ...t timezones we cannot offer live support However your questions will be answered as soon as possible in the before mentioned schedule Provide as much information as possible regarding your enquiry product models accurately describe your problem and steps to replicate it etc and send a mail to support dragino com Page 38 38 last modified by Bei Jinggeng on 2022 07 08 16 50 ...

Отзывы: