www.dragino.com RS485-LN -- RS485 to LoRaWAN Converter User Manual Document Version: 1.4 Image Version: v1.3.
www.dragino.com 1.0 Release 2019-Dec-8 1.0.1 Improve product photos and network structure 2019-Dec-30 1.0.2 Add AT Command to set UART parity 1.1 Upgrade manual for v1.1 firmware version 2020-Feb-19 1.2 Add downlink command 0x09, Add Command AT+CMDDL 2020-May-16 1.3 Remove FAQ for LG01, Add FAQ for slave numbers, Add Case Study Link. 2020-Dec-5 Update content for firmware v1.3 1.
www.dragino.com 1. Introduction .............................................................................................................................. 5 1.1 What is RS485-LN RS485 to LoRaWAN Converter ...................................................................... 5 1.2 Specifications.............................................................................................................................. 6 1.3 Features ...............................................................
www.dragino.com 5. Use AT Command .................................................................................................................... 27 5.1 6. Access AT Command ................................................................................................................. 27 Trouble Shooting..................................................................................................................... 29 6.1 Downlink doesn’t work, how to solve it? .............................
www.dragino.com 1. Introduction 1.1 What is RS485-LN RS485 to LoRaWAN Converter The Dragino RS485-LN is a RS485 to LoRaWAN Converter. It converts the RS485 signal into LoRaWAN wireless signal which simplify the IoT installation and reduce the installation/maintaining cost. RS485-LN allows user to monitor / control RS485 devices and reach extremely long ranges. It provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption.
www.dragino.com 1.2 Specifications Hardware System: ➢ STM32L072CZT6 MCU ➢ SX1276 Wireless Chip ➢ Power Consumption (exclude RS485 device): Idle: 32mA@12v 20dB Transmit: 65mA@12v Interface for Model: ➢ RS485 ➢ Power Input 7~ 24V DC. LoRa Spec: ➢ 168 dB maximum link budget. ➢ Programmable bit rate up to 300 kbps. ➢ High sensitivity: down to -148 dBm. ➢ Bullet-proof front end: IIP3 = -12.5 dBm. ➢ Excellent blocking immunity. ➢ Low RX current of 10.3 mA, 200 nA register retention.
www.dragino.com ✓ Smart Metering ✓ Smart Agriculture ✓ Smart Cities ✓ Smart Factory 1.5 Hardware Change log v1.2 Add External Interrupt Pin. v1.0 Release 1.6 Installation Please ask a professional engineer to install the RS485-LN.
www.dragino.com 2. Power ON Device The RS485-LN can be powered by 7 ~ 24V DC power source. Connection as below ✓ Power Source VIN to RS485-LN VIN+ ✓ Power Source GND to RS485-LN VIN- Once there is power, the RS485-LN will be on.
www.dragino.com 3. Operation Mode 3.1 How it works? The RS485-LN is configured as LoRaWAN OTAA Class C mode by 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. Assume user already have a LoRaWAN Gateway and set to connect to TTN.
www.dragino.
www.dragino.com User can enter this key in their LoRaWAN Server portal. Below is TTN V3 screen shot: Add APP EUI in the application.
www.dragino.
www.dragino.com You can also choose to create the device manually.
www.dragino.com Add APP KEY and DEV EUI 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. 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.
www.dragino.com AT Commands Description Example AT+BAUDR Set the baud rate (for RS485 connection). AT+BAUDR=9600 Default Value is: 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.
www.dragino.com 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.
www.dragino.com In the RS485-LN, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same. AT+DATACUTx : This command defines how to handle the return from AT+COMMANDx, max return length is 45 bytes. AT+DATACUTx=a,b,c a: length for the return of AT+COMMAND b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections. c: define the position for valid value. Examples: ➢ Grab bytes: ➢ Grab a section. ➢ Grab different sections.
www.dragino.com 3.3.4 Compose the uplink payload Through AT+COMMANDx and AT+DATACUTx we got valid value from each RS485 commands, Assume these valid value are RETURN1, RETURN2, .., 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.
www.dragino.com Examples: AT+DATAUP=1 Compose the uplink payload with value returns in sequence and send with Multiply UPLINKs. Final Payload is 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.
www.dragino.com 3.3.5 Uplink on demand Except uplink periodically, RS485-LN is able to uplink on demand. The server send downlink command to RS485-LN and RS485 will uplink data base on the command. Downlink control command: 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.
www.dragino.com Size(bytes) 1 Length depends on the return from the commands Value PAYLOAD_VER If the valid payload is too long and exceed the maximum support payload length in server, server will show payload not provided in the LoRaWAN server. 3.5 Configure RS485-LN via AT or Downlink User can configure RS485-LN via AT Commands or LoRaWAN Downlink Commands There are two kinds of Commands: ✓ Common Commands: They should be available for each sensor, such as: change uplink interval, reset device.
www.dragino.com For example, To connect a Modbus Alarm with below commands. ✓ The command to active alarm is: 0A 05 00 04 00 01 4C B0. Where 0A 05 00 04 00 01 is the Modbus command to read the register 00 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.
www.dragino.com NN: 0: no CRC; 1: add CRC-16/MODBUS ; 2: set the AT+DATACUT value. LL: The length of AT+COMMAND or AT+DATACUT command XX XX XX XX: AT+COMMAND or AT+DATACUT command YY: If YY=0, RS485-LN will execute the downlink command without uplink; if YY=1, RS485-LN will execute an uplink after got this command.
www.dragino.com RS485 command timeout Some Modbus device has slow action to send replies. This command is used to configure the RS485-LN to use longer time to wait for their action.
www.dragino.com AT+CMDEAR=mm,nn mm: start position of erase ,nn: stop position of erase Etc. AT+CMDEAR=1,10 means erase AT+COMMAND1/AT+DATACUT1 to AT+COMMAND10/AT+DATACUT10 Example screen shot after clear all RS485 commands.
www.dragino.com 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.7 LEDs LEDs Feature PWR Always on if there is power SYS After device is powered on, the SYS will fast blink in GREEN for 5 times, means RS485-LN start to join LoRaWAN network. If join success, SYS will be on GREEN for 5 seconds.
www.dragino.com 4. Case Study User can check this URL for some case studies. http://wiki.dragino.com/index.php?title=APP_RS485_COMMUNICATE_WITH_SENSORS 5. Use AT Command 5.1 Access AT Command RS485-LN supports AT Command set. User 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.
www.dragino.
www.dragino.com 6. Trouble Shooting 6.1 Downlink doesn’t work, how to solve it? Please see this link for debug: http://wiki.dragino.com/index.php?title=Main_Page#LoRaWAN_Communication_Debug 6.2 Why I can’t join TTN V3 in US915 /AU915 bands? It might about the channels mapping. Please see for detail. http://wiki.dragino.com/index.php?title=LoRaWAN_Communication_Debug#Notice_of_US915.2 FCN470.2FAU915_Frequency_band 7.
www.dragino.com 9. FCC Caution: Any Changes or modifications not expressly approved by the party responsible for compliance could void the user's authority to operate the equipment. This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) This device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.