Show last authors
1
2
3 (% style="text-align:center" %)
4 [[image:image-20231008143931-2.png||height="414" width="521"]]
5
6
7
8
9
10
11
12
13
14 **Table of Contents:**
15
16 {{toc/}}
17
18
19
20
21
22
23 = 1. Introduction =
24
25 == 1.1 What is RS485 / UART to NB-IoT Converter ==
26
27
28 The Dragino RS485-NB is a (% style="color:blue" %)**RS485 / UART to NB-IoT Converter**(%%) for Internet of Things solutions. User can connect RS485 or UART sensor to RS485-NB converter, and configure RS485-NB to periodically read sensor data and upload via NB-IoT network to IoT server.
29
30 RS485-NB can interface to RS485 sensor, 3.3v/5v UART sensor or interrupt sensor. RS485-NB provides (% style="color:blue" %)**a 3.3v output**(%%) and(% style="color:blue" %)** a 5v output**(%%) to power external sensors. Both output voltages are controllable to minimize the total system power consumption.
31
32 RS485-NB supports different uplink methods including (% style="color:blue" %)**MQTT, MQTTs, UDP & TCP**(%%) for different application requirement, and support uplinks to various IoT Servers.
33
34 RS485-NB supports (% style="color:blue" %)**BLE configure and OTA update**(%%) which make user easy to use.
35
36 RS485-NB is IP67 (% style="color:blue" %)**waterproof**(%%) and powered by (% style="color:blue" %)**8500mAh Li-SOCI2 battery**(%%), it is designed for long-term use up to several years.
37
38 RS485-NB has optional built-in SIM card and default IoT server connection version. Which makes it works with simple configuration.
39
40 [[image:image-20231008143043-1.png||height="388" width="938"]]
41
42
43 == 1.2 ​Features ==
44
45
46 * NB-IoT Bands: B1/B2/B3/B4/B5/B8/B12/B13/B17/B18/B19/B20/B25/B28/B66/B70/B85 @H-FDD
47 * Ultra-low power consumption
48 * Support multiply RS485 devices by flexible rules
49 * Support Modbus protocol
50 * Support Interrupt uplink
51 * Supports connecting a UART sensors with 3.3V or 5V
52 * Multiply Sampling and one uplink
53 * Support Bluetooth v5.1 remote configure and update firmware
54 * Uplink via MQTT, MQTTs, TCP, or UDP
55 * Uplink on periodically
56 * Downlink to change configure
57 * 8500mAh Battery for long term use
58 * Nano SIM card slot for NB-IoT SIM
59
60 == 1.3 Specification ==
61
62
63 (% style="color:blue" %)**Common DC Characteristics:**
64
65 * Supply Voltage: 2.5v ~~ 3.6v
66 * Operating Temperature: -40 ~~ 85°C
67
68 (% style="color:blue" %)**I/O Interface:**
69
70 * Battery controllable output (2.6v ~~ 3.6v depends on battery)
71 * +5v controllable output
72 * 1 x RS485 Interface
73 * 1 x UART Interface , 3.3v or 5v
74 * 1 x Interrupt or Digital IN/OUT pins
75 * 1 x I2C Interface
76 * 1 x one wire interface
77
78 (% style="color:blue" %)**NB-IoT Spec:**
79
80 (% style="color:#037691" %)**NB-IoT Module: BC660K-GL**
81
82 (% style="color:#037691" %)**Support Bands:**
83
84 * B1 @H-FDD: 2100MHz
85 * B2 @H-FDD: 1900MHz
86 * B3 @H-FDD: 1800MHz
87 * B4 @H-FDD: 2100MHz
88 * B5 @H-FDD: 860MHz
89 * B8 @H-FDD: 900MHz
90 * B12 @H-FDD: 720MHz
91 * B13 @H-FDD: 740MHz
92 * B17 @H-FDD: 730MHz
93 * B18 @H-FDD: 870MHz
94 * B19 @H-FDD: 870MHz
95 * B20 @H-FDD: 790MHz
96 * B25 @H-FDD: 1900MHz
97 * B28 @H-FDD: 750MHz
98 * B66 @H-FDD: 2000MHz
99 * B70 @H-FDD: 2000MHz
100 * B85 @H-FDD: 700MHz
101
102 (% style="color:blue" %)**Battery:**
103
104 * Li/SOCI2 un-chargeable battery
105 * Capacity: 8500mAh
106 * Self Discharge: <1% / Year @ 25°C
107 * Max continuously current: 130mA
108 * Max boost current: 2A, 1 second
109
110 (% style="color:blue" %)**Power Consumption**
111
112 * STOP Mode: 10uA @ 3.3v
113 * Max transmit power: 350mA@3.3v
114
115 == 1.4 Applications ==
116
117
118 * Smart Buildings & Home Automation
119 * Logistics and Supply Chain Management
120 * Smart Metering
121 * Smart Agriculture
122 * Smart Cities
123 * Smart Factory
124
125 == 1.5 Sleep mode and working mode ==
126
127
128 (% style="color:blue" %)**Deep Sleep Mode: **(%%)Sensor doesn't have any NB-IoT activate. This mode is used for storage and shipping to save battery life.
129
130 (% style="color:blue" %)**Working Mode:** (%%)In this mode, Sensor will work as NB-IoT Sensor to Join NB-IoT network and send out sensor data to server. Between each sampling/tx/rx periodically, sensor will be in IDLE mode), in IDLE mode, sensor has the same power consumption as Deep Sleep mode.
131
132
133 == 1.6 Button & LEDs ==
134
135
136 [[image:Main.User Manual for LoRaWAN End Nodes.D20-LBD22-LBD23-LB_LoRaWAN_Temperature_Sensor_User_Manual.WebHome@1675071855856-879.png]]
137
138
139 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
140 |=(% style="width: 167px;background-color:#4F81BD;color:white" %)**Behavior on ACT**|=(% style="width: 117px;background-color:#4F81BD;color:white" %)**Function**|=(% style="width:226px;background-color:#4F81BD;color:white" %)**Action**
141 |(% style="width:167px" %)Pressing ACT between 1s < time < 3s|(% style="width:117px" %)Send an uplink|(% style="width:225px" %)(((
142 If sensor has already attached to NB-IoT network, sensor will send an uplink packet, (% style="color:blue" %)**blue led** (%%)will blink once.
143 Meanwhile, BLE module will be active and user can connect via BLE to configure device.
144 )))
145 |(% style="width:167px" %)Pressing ACT for more than 3s|(% style="width:117px" %)Active Device|(% style="width:225px" %)(((
146 (% style="color:green" %)**Green led**(%%) will fast blink 5 times, device will enter (% style="color:#037691" %)**OTA mode**(%%) for 3 seconds. And then start to attach NB-IoT network.
147 (% style="color:green" %)**Green led**(%%) will solidly turn on for 5 seconds after joined in network.
148 Once sensor is active, BLE module will be active and user can connect via BLE to configure device, no matter if device attach NB-IoT network or not.
149 )))
150 |(% style="width:167px" %)Fast press ACT 5 times.|(% style="width:117px" %)Deactivate Device|(% style="width:225px" %)(% style="color:red" %)**Red led**(%%) will solid on for 5 seconds. Means device is in Deep Sleep Mode.
151
152 (% style="color:red" %)**Note: When the device is executing a program, the buttons may become invalid. It is best to press the buttons after the device has completed the program execution.**
153
154
155 == 1.7 BLE connection ==
156
157
158 RS485-NB support BLE remote configure and firmware update.
159
160
161 BLE can be used to configure the parameter of sensor or see the console output from sensor. BLE will be only activate on below case:
162
163 * Press button to send an uplink
164 * Press button to active device.
165 * Device Power on or reset.
166
167 If there is no activity connection on BLE in 60 seconds, sensor will shut down BLE module to enter low power mode.
168
169
170 == 1.8 Pin Definitions , Switch & SIM Direction ==
171
172
173 RS485-NB use the mother board which as below.
174
175 [[image:image-20231024152720-1.png||height="448" width="789"]]
176
177
178 === 1.8.1 Jumper JP2 ===
179
180
181 Power on Device when put this jumper.
182
183
184 === 1.8.2 BOOT MODE / SW1 ===
185
186
187 **1)** (% style="color:blue" %)**ISP**(%%): upgrade mode, device won't have any signal in this mode. but ready for upgrade firmware. LED won't work. Firmware won't run.
188
189 **2)** (% style="color:blue" %)**Flash**(%%): work mode, device starts to work and send out console output for further debug
190
191
192 === 1.8.3 Reset Button ===
193
194
195 Press to reboot the device.
196
197
198 === 1.8.4 SIM Card Direction ===
199
200
201 See this link. [[How to insert SIM Card>>http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H2.AttachNetwork]].
202
203
204 = 2. Use RS485-NB to communicate with IoT Server =
205
206 == 2.1 Send data to IoT server via NB-IoT network ==
207
208
209 The RS485-NB is equipped with a NB-IoT module, the pre-loaded firmware in RS485-NB will get environment data from sensors and send the value to local NB-IoT network via the NB-IoT module.  The NB-IoT network will forward this value to IoT server via the protocol defined by RS485-NB.
210
211
212 Below shows the network structure:
213
214 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-NB_RS485UART_to_NB-IoT_Converter_User_Manual/WebHome/image-20231008143043-1.png?width=938&height=388&rev=1.1||alt="image-20231008143043-1.png"]]
215
216
217 There are two version: (% style="color:blue" %)**-GE**(%%) and (% style="color:blue" %)**-1D**(%%) version of RS485-NB.
218
219
220 (% style="color:blue" %)**GE Version**(%%): This version doesn't include SIM card or point to any IoT server. User needs to use AT Commands to configure below two steps to set RS485-NB send data to IoT server.
221
222 * Install NB-IoT SIM card and configure APN. See instruction of [[Attach Network>>url:http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H2.AttachNetwork]].
223
224 * Set up sensor to point to IoT Server. See instruction of [[Configure to Connect Different Servers>>url:http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H3.Configuretoconnecttodifferentservers]]. 
225
226 Below shows result of different server as a glance.
227
228 (% border="1" cellspacing="4" style="width:515px" %)
229 |(% style="background-color:#4f81bd; color:white; width:100px" %)**Servers**|(% style="background-color:#4f81bd; color:white; width:300px" %)**Dash Board**|(% style="background-color:#4f81bd; color:white; width:115px" %)**Comments**
230 |(% style="width:127px" %)[[Node-Red>>url:http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H3.5A0Node-RedA028viaA0MQTT29]]|(% style="width:385px" %)(((
231 (% style="text-align:center" %)
232 [[image:image-20230819113244-8.png||height="183" width="367"]]
233 )))|(% style="width:170px" %)
234 |(% style="width:127px" %)[[DataCake>>url:http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H3.4Datacake]]|(% style="width:385px" %)(((
235 (% style="text-align:center" %)
236 [[image:image-20230819113244-9.png||height="119" width="367"]]
237 )))|(% style="width:170px" %)
238 |(% style="width:127px" %)[[General UDP>>url:http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H3.1GeneralA0UDPA0Connection]]|(% style="width:385px" %)Raw Payload. Need Developer to design Dash Board|(% style="width:170px" %)
239 |(% style="width:127px" %)[[General MQTT>>url:http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H3.2GeneralA0MQTTA0Connection]]|(% style="width:385px" %)Raw Payload. Need Developer to design Dash Board|(% style="width:170px" %)
240
241 (% style="color:blue" %)**1D Version**(%%): This version has 1NCE SIM card pre-installed and configure to send value to DataCake. User Just need to select the sensor type in DataCake and Activate RS485-NB and user will be able to see data in DataCake. See here for [[DataCake Config Instruction>>url:http://wiki.dragino.com/xwiki/bin/view/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/#H3.4Datacake]].
242
243
244 == 2.2 Configure Device to Read RS485 Sensors ==
245
246
247 There are plenty of RS485 and TTL level devices in the market and each device has different commands to read the valid data. To support these devices in most flexible, RS485-NB supports flexible command set. User can use [[Dragino RS485 Tool>>url:https://www.dropbox.com/sh/us9qecn39fwt8n1/AABREdqUCzEmJMRrfuWuXasoa?dl=0]],  [[AT Commands or LoRaWAN Downlink>>url:http://wiki.dragino.com/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/#H3.5ConfigureRS485-LBviaATorDownlink]] Command to configure how RS485-NB should read the sensor and how to handle the return from RS485 or TTL sensors.
248
249
250 === 2.2.1 Method 1 ~-~- via RS485 Configure Tool ===
251
252
253 Use the RS485 Configure tool is the recommand method. Please see the instruction of how to use the tool:
254
255 * **[[RS485 Configure Tool Instruction>>url:http://wiki.dragino.com/xwiki/bin/view/Main/RS485_Configure_Tool/]]**
256
257 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/image-20231127144411-1.png?width=494&height=368&rev=1.1||alt="image-20231127144411-1.png" height="368" width="494"]]
258
259
260 === 2.2.2 Method 2 ~-~- via AT Commands ===
261
262 ==== 2.2.2.1 Configure UART settings for RS485 or TTL communication ====
263
264
265 (((
266 RS485-NB can connect to either RS485 sensors or TTL sensor. User need to specify what type of sensor need to connect.
267 )))
268
269
270 (((
271 (% style="color:blue" %)**1.  RS485-MODBUS mode:**
272 )))
273
274 (((
275 (% style="color:#037691" %)**AT+MOD=1**  (%%) ~/~/ Support RS485-MODBUS type sensors. User can connect multiply RS485 , Modbus sensors to the A / B pins.
276 )))
277
278
279 (((
280 (% style="color:blue" %)**2.  TTL mode:**
281 )))
282
283 (((
284 (% style="color:#037691" %)**AT+MOD=2**  (%%) ~/~/ Support TTL Level sensors, User can connect one TTL Sensor to the TXD/RXD/GND pins.
285
286
287 )))
288
289 (((
290 RS485-NB default UART settings is (% style="color:green" %)**9600, no parity, stop bit 1,data bit 8**(%%). If the sensor has a different settings, user can change the RS485-NB setting to match.
291 )))
292
293 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:519px" %)
294 |=(% style="width: 119px; background-color:#4F81BD; color: white;" %)(((
295 (((
296 **AT Commands**
297 )))
298 )))|=(% style="width: 121px; background-color:#4F81BD; color: white;" %)(((
299 (((
300 **Description**
301 )))
302 )))|=(% style="width: 278px; background-color:#4F81BD; color: white;" %)(((
303 (((
304 **Example**
305 )))
306 )))
307 |(% style="width:119px" %)(((
308 (((
309 AT+BAUDR
310 )))
311 )))|(% style="width:121px" %)(((
312 (((
313 Set the baud rate.
314
315 Default Value is: 9600.
316 )))
317 )))|(% style="width:278px" %)(((
318 (((
319 (((
320 AT+BAUDR=9600
321 )))
322 )))
323
324 (((
325 (((
326 Options: (1200,2400,4800,14400,19200,115200)
327 )))
328 )))
329 )))
330 |(% style="width:119px" %)(((
331 (((
332 AT+PARITY
333 )))
334 )))|(% style="width:121px" %)(((
335 (((
336 (((
337 Set UART parity.
338 )))
339 )))
340
341 (((
342 (((
343 Default Value is: no parity.
344 )))
345 )))
346 )))|(% style="width:278px" %)(((
347 (((
348 (((
349 AT+PARITY=0
350 )))
351 )))
352
353 (((
354 (((
355 Option: 0: no parity, 1: odd parity, 2: even parity
356 )))
357 )))
358 )))
359 |(% style="width:119px" %)(((
360 (((
361 AT+STOPBIT
362 )))
363 )))|(% style="width:121px" %)(((
364 (((
365 (((
366 Set serial stopbit
367 )))
368 )))
369
370 (((
371 (((
372 Default Value is: 1bit.
373 )))
374 )))
375 )))|(% style="width:278px" %)(((
376 (((
377 AT+STOPBIT=0 for 1 bit
378
379 AT+STOPBIT=1 for 1.5 bits
380 )))
381
382 (((
383 (((
384 AT+STOPBIT=2 for 2 bits
385 )))
386 )))
387 )))
388 |(% style="width:119px" %)AT+DATABIT|(% style="width:121px" %)(((
389 (((
390 (((
391 Set serial databit.
392 )))
393 )))
394
395 (((
396 (((
397 Default Value is: 8bits.
398 )))
399 )))
400 )))|(% style="width:278px" %)(((
401 (((
402 AT+DATABIT=7 for 7 bits
403 )))
404
405 (((
406 (((
407 AT+DATABIT=8 for 8 bits
408 )))
409 )))
410 )))
411
412 Example(Soil three-parameter detector):
413
414 (% style="color:blue" %)**Wiring the UART sensor**
415
416 (((
417 **GND <~-~-~-~-~-~-~-~-> GND
418 TX  <~-~-~-~-~-~-~-~->  RX
419 RX  <~-~-~-~-~-~-~-~->  TX
420 VCC  <~-~-~-~-~-~-~-~->  3.3/5V**
421 )))
422
423 [[image:image-20231024153119-2.png||height="362" width="631"]]
424
425
426 (% style="color:blue" %)**Set the correct configuration:**
427
428 (% style="color:#037691" %)**AT+BAUDR=9600**
429
430 (% style="color:#037691" %)**AT+PARITY=0**
431
432 (% style="color:#037691" %)**AT+STOPBIT=1**
433
434 (% style="color:#037691" %)**AT+DATABIT=8**
435
436 If the sensor needs 5v. Need to move the switch position to 5v and then use the command (% style="color:blue" %)**AT+5VT=30000**
437
438
439 (% style="color:blue" %)**Configuration read command:**
440
441 (% style="color:#037691" %)**AT+CFGDEV=FE 03 00 00 00 03 11 C4,0**
442
443 **FE:** Station address
444
445 **03:** Function code
446
447 **00 00:**Register start address
448
449 **00 03:**Number of registers
450
451 **11 04:**  Check code
452
453 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/image-20230220111709-2.png?rev=1.1||alt="image-20230220111709-2.png"]]
454
455
456 Use AT+COMMAND1 to set it as a command, and use AT+DATACUT1 to intercept the bytes I need
457
458 [[image:image-20231024154517-6.png||height="327" width="770"]]
459
460
461 (% style="color:blue" %)**upload payload:**
462
463 [[image:image-20231024154424-5.png]]
464
465
466 === 2.2.3 Configure sensors ===
467
468
469 (((
470 Some sensors might need to configure before normal operation. User can configure such sensor via PC or through RS485-NB AT Commands (% style="color:#4f81bd" %)**AT+CFGDEV**.
471 )))
472
473 (((
474 When user issue an (% style="color:#4f81bd" %)**AT+CFGDEV**(%%) command, Each (% style="color:#4f81bd" %)**AT+CFGDEV**(%%) equals to send a command to the RS485 or TTL sensors. This command will only run when user input it and won't run during each sampling.
475 )))
476
477 (% border="1" cellspacing="5" style="background-color:#f2f2f2; width:510px" %)
478 |=(% style="width: 130px;background-color:#4F81BD;color:white" %)**AT Commands**|=(% style="width: 190px;background-color:#4F81BD;color:white" %)**Description**|=(% style="width: 190px;background-color:#4F81BD;color:white" %)**Example**
479 |(% style="width:121px" %)AT+CFGDEV|(% style="width:179px" %)(((
480 (((
481 This command is used to configure the RS485/TTL devices; they won’t be used during sampling.
482 )))
483
484 (((
485 AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,
486 )))
487
488 (((
489 mm: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command
490 )))
491 )))|(% style="width:210px" %)AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,m
492
493 === 2.2.4 Configure read commands for each sampling ===
494
495
496 (% style="color:red" %)**Note: Please upgrade firmware to v1.0.3 or above. Otherwise, if a data error occurs in AT+COMMANDx check crc mode, the device will enter an inoperable state.**
497
498
499 (((
500 RS485-NB is a battery powered device; it will sleep most of time. And wake up on each period and read RS485 / TTL sensor data and uplink.
501 )))
502
503 (((
504 During each sampling, we need to confirm what commands we need to send to the sensors to read data. After the RS485/TTL sensors send back the value, it normally includes some bytes and we only need a few from them for a shorten payload.
505 )))
506
507 (((
508 To save the LoRaWAN network bandwidth, we might need to read data from different sensors and combine their valid value into a short payload.
509 )))
510
511 (((
512 This section describes how to achieve above goals.
513 )))
514
515 (((
516 During each sampling, the RS485-NB can support 15 commands to read sensors. And combine the return to one or several uplink payloads.
517 )))
518
519 (((
520 (% style="color:blue" %)**Command from RS485-NB to Sensor:**
521 )))
522
523 (((
524 RS485-NB can send out pre-set max 15 strings via **AT+COMMAD1**, **ATCOMMAND2**,…, to **AT+COMMANDF** . All commands are of same grammar.
525
526
527 )))
528
529 (((
530 (% style="color:blue" %)**Handle return from sensors to RS485-NB**:
531 )))
532
533 (((
534 After RS485-NB send out a string to sensor, RS485-NB will wait for the return from RS485 or TTL sensor. And user can specify how to handle the return, by **AT+DATACUT or AT+SEARCH commands**
535 )))
536
537 * (((
538 (% style="color:blue" %)**AT+DATACUT**
539 )))
540
541 (((
542 When the return value from sensor have fix length and we know which position the valid value we should get, we can use AT+DATACUT command.
543
544
545 )))
546
547 * (((
548 (% style="color:blue" %)**AT+SEARCH**
549 )))
550
551 (((
552 When the return value from sensor is dynamic length and we are not sure which bytes the valid data is, instead, we know what value the valid value following. We can use AT+SEARCH to search the valid value in the return string.
553 )))
554
555
556 (((
557 (% style="color:blue" %)**Define wait timeout:**
558 )))
559
560 (((
561 Some RS485 device might has longer delay on reply, so user can use AT+CMDDL to set the timeout for getting reply after the RS485 command is sent. For example, AT+CMDDL1=1000 to send the open time to 1000ms
562 )))
563
564 (((
565 After we got the valid value from each RS485 commands, we need to combine them together with the command **AT+DATAUP**.
566 )))
567
568 (((
569 **Examples:**
570 )))
571
572 (((
573 Below are examples for the how above AT Commands works.
574 )))
575
576 (((
577 (% style="color:blue" %)**AT+COMMANDx **(%%)**: **This command will be sent to RS485/TTL devices during each sampling, Max command length is 14 bytes. The grammar is:
578 )))
579
580 (% border="1" class="table-bordered" style="background-color:#f2f2f2; width:497px" %)
581 |(% style="width:494px" %)(((
582 (((
583 **AT+COMMANDx=xx xx xx xx xx xx xx xx xx xx xx xx,m**
584 )))
585
586 (((
587 **xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent**
588 )))
589
590 (((
591 **m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command**
592 )))
593 )))
594
595 (((
596 For example, if we have a RS485 sensor. The command to get sensor value is: 01 03 0B B8 00 02 46 0A. Where 01 03 0B B8 00 02 is the Modbus command to read the register 0B B8 where stored the sensor value. The 46 0A is the CRC-16/MODBUS which calculate manually.
597 )))
598
599 (((
600 In the RS485-NB, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same.
601
602
603 )))
604
605 If a single command exceeds 14 bytes, you can use the command splicing function.
606
607 When AT+CMDDLx=1, the commands of AT+COMMANDx and AT+COMMAND(x+1) will be merged.
608
609 **Examples:** To send 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F data it should be configured:
610
611 AT+COMMAND1=00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D,0
612
613 AT+COMMAND1=1
614
615 AT+COMMAND2=0E 0F,0
616
617
618 (((
619 (% style="color:blue" %)**AT+SEARCHx**(%%): This command defines how to handle the return from AT+COMMANDx.
620 )))
621
622 (% border="1" class="table-bordered" style="background-color:#f2f2f2; width:473px" %)
623 |(% style="width:470px" %)(((
624 (((
625 **AT+SEARCHx=aa,xx xx xx xx xx**
626 )))
627
628 * (((
629 **aa: 1: prefix match mode; 2: prefix and suffix match mode**
630 )))
631 * (((
632 **xx xx xx xx xx: match string. Max 5 bytes for prefix and 5 bytes for suffix**
633 )))
634 )))
635
636 (((
637 **Examples:**
638 )))
639
640 (((
641 **1) For a return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49**
642 )))
643
644 (((
645 If we set AT+SEARCH1=1,1E 56 34.      (max 5 bytes for prefix)
646 )))
647
648 (((
649 The valid data will be all bytes after 1E 56 34 , so it is (% style="background-color:yellow" %)**2e 30 58 5f 36 41 30 31 00 49**
650 )))
651
652 (((
653 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/1653271044481-711.png?rev=1.1||alt="1653271044481-711.png"]]
654
655
656 )))
657
658 (((
659 **2) For a return string from AT+COMMAND1:  16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49**
660 )))
661
662 (((
663 If we set AT+SEARCH1=2, 1E 56 34+31 00 49
664 )))
665
666 (((
667 Device will search the bytes between 1E 56 34 and 31 00 49. So it is(% style="background-color:yellow" %) **2e 30 58 5f 36 41 30**
668 )))
669
670 (((
671 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/1653271044481-711.png?rev=1.1||alt="1653271044481-711.png"]]
672
673
674 )))
675
676 (((
677 (% style="color:#037691" %)**AT+DATACUTx**(%%)** : **This command defines how to handle the return from AT+COMMANDx, max return length is 100 bytes.
678 )))
679
680 (% style="background-color:#f2f2f2; width:496px" %)
681 |(% style="width:493px" %)(((
682 (((
683 **AT+DATACUTx=a,b,c**
684 )))
685
686 * (((
687 **a: length for the return of AT+COMMAND**
688 )))
689 * (((
690 **b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections.**
691 )))
692 * (((
693 **c: define the position for valid value.  **
694 )))
695 )))
696
697 (((
698 **Examples:**
699 )))
700
701 * (((
702 (% style="color:blue" %)**Grab bytes:**
703 )))
704
705 (((
706 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/1653271581490-837.png?width=722&height=313&rev=1.1||alt="1653271581490-837.png"]]
707 )))
708
709
710 * (((
711 (% style="color:blue" %)**Grab a section.**
712 )))
713
714 (((
715 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/1653271648378-342.png?width=720&height=326&rev=1.1||alt="1653271648378-342.png"]]
716 )))
717
718
719 * (((
720 (% style="color:blue" %)**Grab different sections.**
721 )))
722
723 (((
724 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/1653271657255-576.png?width=730&height=305&rev=1.1||alt="1653271657255-576.png"]]
725
726
727 )))
728
729 (((
730 (% style="color:red" %)**Note:**
731 )))
732
733 (((
734 (% style="color:#037691" %)**AT+SEARCHx** (%%)and (% style="color:#037691" %)**AT+DATACUTx**(%%) can be used together, if both commands are set, RS485-NB will first process AT+SEARCHx on the return string and get a temporary string, and then process AT+DATACUTx on this temporary string to get the final payload. In this case, AT+DATACUTx need to set to format** AT+DATACUTx=0,xx,xx** where the return bytes set to **0**.
735 )))
736
737 (((
738 **Example:**
739 )))
740
741 (((
742 (% style="color:red" %)AT+COMMAND1=11 01 1E D0,0
743 )))
744
745 (((
746 (% style="color:red" %)AT+SEARCH1=1,1E 56 34
747 )))
748
749 (((
750 (% style="color:red" %)AT+DATACUT1=0,2,1~~5
751 )))
752
753 (((
754 (% style="color:red" %)Return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
755 )))
756
757 (((
758 (% style="color:red" %)String after SEARCH command: 2e 30 58 5f 36 41 30 31 00 49
759 )))
760
761 (((
762 (% style="color:red" %)Valid payload after DataCUT command: 2e 30 58 5f 36
763 )))
764
765
766 (((
767 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/1653271763403-806.png?rev=1.1||alt="1653271763403-806.png"]]
768 )))
769
770
771 === 2.2.5 Uplink when the sensor is not responding ===
772
773 (% style="color:blue" %)
774
775 (% class="wikigeneratedid" %)
776 **1) ** When (% style="color:blue" %)**AT+MOD=1**(%%), if the data intercepted by (% style="color:#037691" %)** AT+DATACUT**(%%) or (% style="color:#037691" %)** AT+MBFUN **(%%)is empty, it will display **NULL**, and the payload will be filled with **n FFs**.
777
778
779 [[image:1698135215181-146.png]]
780
781
782 **2)**  When** (% style="color:blue" %)AT+MOD=2(%%)**, if the data intercepted by (% style="color:#037691" %)** AT+DATACUT** (%%)or (% style="color:#037691" %)** AT+MBFUN**(%%) is empty, it will display **NULL**, and the payload will be filled with **n 00s**.
783
784
785 [[image:1698135222111-424.png||height="292" width="410"]]
786
787
788 === 2.2.6 Uplink on Interrupt ===
789
790
791 Put the interrupt sensor between 3.3v_out and GPIO ext.
792
793 [[image:http://8.211.40.43/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LB_Waterproof_RS485UART_to_LoRaWAN_Converter/WebHome/image-20231019112133-3.png?rev=1.1||alt="image-20231019112133-3.png"]]
794
795
796 (((
797 (% style="color:#4472c4" %)**AT+INTMOD=0**(%%)  Disable Interrupt.( Default Value)
798 )))
799
800 (((
801 (% style="color:#4472c4" %)**AT+INTMOD=1**(%%)  Interrupt trigger by rising or falling edge.
802 )))
803
804 (((
805 (% style="color:#4472c4" %)**AT+INTMOD=2** (%%) Interrupt trigger by falling edge.
806 )))
807
808 (((
809 (% style="color:#4472c4" %)**AT+INTMOD=3**(%%)  Interrupt trigger by rising edge.
810 )))
811
812
813 == 2.3 ​Payload Types ==
814
815
816 To meet different server requirement, RS485-NB supports different payload type.
817
818 **Includes:**
819
820 * [[General JSON format payload>>||anchor="H2.3.1GeneralJsonFormat28Type3D529"]]. (Type=5)
821
822 * [[HEX format Payload>>||anchor="H2.3.2HEXformatPayload28Type3D029"]]. (Type=0)
823
824 User can specify the payload type when choose the connection protocol. Example:
825
826 (% style="color:#037691" %)**AT+PRO=2,0**  (%%) ~/~/ Use UDP Connection & hex Payload
827
828 (% style="color:#037691" %)**AT+PRO=2,5**   (%%) ~/~/ Use UDP Connection & Json Payload
829
830 (% style="color:#037691" %)**AT+PRO=3,0 ** (%%) ~/~/ Use MQTT Connection & hex Payload
831
832 (% style="color:#037691" %)**AT+PRO=3,5 ** (%%) ~/~/ Use MQTT Connection & Json Payload
833
834 (% style="color:#037691" %)**AT+PRO=4,0**  (%%) ~/~/ Use TCP Connection & hex Payload
835
836 (% style="color:#037691" %)**AT+PRO=4,5**   (%%) ~/~/ Use TCP Connection & Json Payload
837
838
839 === 2.3.1 General Json Format(Type~=5) ===
840
841
842 This is the General Json Format. As below:
843
844 (% style="color:#4472c4" %)**{"IMEI":"866207053462705","Model":"RS485-NB","Payload":01111122223333,"battery":3.581,"signal":23}**
845
846
847 (% style="color:red" %)**Notice:The maximum number of bytes in the Payload is 1 payload version number plus 687 RS485 data.**
848
849
850 === 2.3.2 HEX format Payload(Type~=0) ===
851
852
853 This is the HEX Format. As below:
854
855 (% style="color:#4472c4" %)**f866207053462705 1764 0df4 11 00 00 64f02eb0 01 111122223333**
856
857 [[image:image-20231024171309-1.png||height="62" width="1111"]]
858
859
860 (% style="color:blue" %)**Version:**
861
862 These bytes include the hardware and software version.
863
864 (% style="color:#037691" %)**Higher byte:**(%%) Specify Sensor Model: 0x17 for RS485-NB
865
866 (% style="color:#037691" %)**Lower byte:**(%%) Specify the software version: 0x64=100, means firmware version 1.0.0
867
868
869 (% style="color:blue" %)**BAT (Battery Info):**
870
871 Ex1: 0x0DF4 = 3572mV
872
873
874 (% style="color:blue" %)**Signal Strength:**
875
876 NB-IoT Network signal Strength.
877
878 **Ex1: 0x11 = 17**
879
880 **0**  -113dBm or less
881
882 **1**  -111dBm
883
884 **2...30** -109dBm... -53dBm
885
886 **31**   -51dBm or greater
887
888 **99**    Not known or not detectable
889
890
891 (% style="color:blue" %)**GPIO_EXIT Level **(%%):
892
893 GPIO_EXTI is used as Interrupt Pin.
894
895 (% style="color:#037691" %)**Example:**
896
897 01 (H):  GPIO_EXTI pin is high level.
898
899 00 (L):  GPIO_EXTI pin is low level.
900
901
902 (% style="color:blue" %)**GPIO_EXIT Flag:**
903
904 This data field shows if this packet is generated by **Interrupt Pin** or not. 
905
906 Note: The Interrupt Pin is a separate pin in the screw terminal.
907
908 (% style="color:#037691" %)**Example:**
909
910 0x00: Normal uplink packet.
911
912 0x01: Interrupt Uplink Packet.
913
914
915 (% style="color:blue" %)**TimeStamp:   **
916
917 Unit TimeStamp Example: 64F02EB0(H) = 1693462192(D)
918
919 Put the decimal value into this link(https:~/~/www.epochconverter.com/) to get the time.
920
921
922 (% style="color:blue" %)**Payload_version:       **
923
924 The payload version number is used to parse different decodes.
925
926
927 (% style="color:blue" %)**RS485_sensor_data:**
928
929 The data returned by the RS485 sensor or UART sensor needs to be cut out the AT+DATACUTx and AT+MBFUN or AT+SEARCHx commands.
930
931
932 == 2.4 Test Uplink and Change Update Interval ==
933
934
935 By default, Sensor will send uplinks (% style="color:blue" %)**every 2 hours**(%%)
936
937 User can use below commands to change the (% style="color:blue" %)**uplink interval**.
938
939 (% style="color:#037691" %)**AT+TDC=600 ** (%%) ~/~/ Set Update Interval to 600s
940
941 User can also push the button for more than 1 seconds to activate an uplink.
942
943
944 == 2.5 Fast command to handle MODBUS device ==
945
946
947 (((
948 The command is for fast configure to read Modbus devices. It is only valid for the devices which follow the [[MODBUS-RTU protocol>>url:https://www.modbustools.com/modbus.html]].
949 )))
950
951
952 (((
953 (% style="color:#037691" %)**AT+MBFUN has only two value:**
954 )))
955
956 * (((
957 (% style="color:#4472c4" %)** AT+MBFUN=1**(%%): Enable Modbus reading. And get response base on the MODBUS return
958 )))
959
960 (((
961 AT+MBFUN=1, device can auto read the Modbus function code: 01, 02, 03 or 04. AT+MBFUN has lower priority vs AT+DATACUT command. If AT+DATACUT command is configured, AT+MBFUN will be ignore.
962 )))
963
964 * (((
965 (% style="color:#4472c4" %)**AT+MBFUN=0**(%%): Disable Modbus fast reading.
966 )))
967
968 (((
969
970
971 **Example:**
972 )))
973
974 * (((
975 AT+MBFUN=1 and AT+DATACUT1/AT+DATACUT2 are not configure (0,0,0).
976 )))
977 * (((
978 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.
979 )))
980 * (((
981 AT+COMMAND2= 01 02 00 40 00 10,1 ~-~-> read slave address 01 , function code 02, start address 00 40, quantity of inputs 00 10.
982
983
984
985 )))
986
987 == 2.6 RS485 command timeout ==
988
989
990 (((
991 Some Modbus device has slow action to send replies. This command is used to configure the RS485-NB to use longer time to wait for their action.
992 )))
993
994 (((
995 Default value: 0, range:  0 ~~ 10 seconds
996 )))
997
998 (((
999 * (% style="color:#037691" %)**AT Command:**
1000
1001 (% style="color:#4472c4" %)**AT+CMDDLaa=hex(bb cc)**
1002 )))
1003
1004 (((
1005 **Example:**
1006 )))
1007
1008 (((
1009 **AT+CMDDL1=1000** to send the open time to 1000ms
1010 )))
1011
1012
1013 == 2.7 Clear RS485 Command ==
1014
1015
1016 (((
1017 The AT+COMMANDx and AT+DATACUTx  AT+SEARCHx and AT+CMDDLx settings are stored in special location, user can use below command to clear them.
1018 )))
1019
1020
1021 * (((
1022 (% style="color:#037691" %)**AT Command:**
1023 )))
1024
1025 (((
1026 (% style="color:#4472c4" %) **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/AT+SEARCH1/AT+CMDDL1 to AT+COMMANDA/AT+DATACUTA/AT+SEARCHA/AT+CMDDLA.
1027 )))
1028
1029
1030 == 2.8 Set Payload version ==
1031
1032
1033 This is the first byte of the uplink payload. RS485-NB can connect to different sensors. User can set the PAYVER field to tell server how to decode the current payload.
1034
1035 * (% style="color:#037691" %)**AT Command:**
1036
1037 (% style="color:#4472c4" %)** AT+PAYVER:   **(%%)Set PAYVER field = 1
1038
1039
1040 == 2.9 Control output power duration ==
1041
1042
1043 (((
1044 User can set the output power duration before each sampling.
1045 )))
1046
1047 * (((
1048 (% style="color:#037691" %)**AT Command:**
1049 )))
1050
1051 (((
1052 **Example:**
1053 )))
1054
1055 (((
1056 (% style="color:#4472c4" %)** AT+3V3T=1000**(%%)  ~/~/ 3V3 output power will open 1s before each sampling.
1057
1058 (% style="color:#4472c4" %)** AT+3V3T=0**(%%)  ~/~/ Normally open 3V3 power supply.
1059
1060 (% style="color:#4472c4" %)** AT+3V3T=65535**(%%)  ~/~/ Normally closed 3V3 power supply.
1061 )))
1062
1063 (((
1064 (% style="color:#4472c4" %)** AT+5VT=1000**  (%%) ~/~/ +5V output power will open 1s before each sampling.
1065 )))
1066
1067 (% style="color:#4472c4" %)** AT+5VT=0**(%%)  ~/~/ Normally closed +5V power supply.
1068
1069 (% style="color:#4472c4" %)** AT+5VT=65535**(%%)  ~/~/ Normally open +5V power supply.
1070
1071
1072 == 2.10 Get sensor value ==
1073
1074
1075 * (((
1076 (% style="color:#037691" %)**AT Command:**
1077 )))
1078
1079 (% style="color:#4472c4" %)** AT+GETSENSORVALUE=0 **(%%)** **~/~/  The serial port gets the reading of the current sensor
1080
1081 (% style="color:#4472c4" %)** AT+GETSENSORVALUE=1      **(%%)~/~/  The serial port gets the current sensor reading and uploads it.
1082
1083
1084 == 2.11 +3V3 Output ==
1085
1086
1087 (((
1088 RS485-NB has a Controllable +3V3 output, user can use this output to power external sensor.
1089 )))
1090
1091 (((
1092 The +3V3 output will be valid for every sampling. RS485-NB will enable +3V3 output before all sampling and disable the +3V3 after all sampling. 
1093 )))
1094
1095 (((
1096 The +3V3 output time can be controlled by AT Command.
1097 )))
1098
1099
1100 (((
1101 (% style="color:#037691" %)**AT+3V3T=1000**
1102 )))
1103
1104
1105 (((
1106 Means set +3v3 valid time to have 1000ms. So, the real +3v3 output will actually have 1000ms + sampling time for other sensors.
1107 )))
1108
1109 (((
1110 By default, the AT+3V3T=0. This is a special case, means the +3V3 output is always on at any time
1111 )))
1112
1113
1114 == 2.12 +5V Output ==
1115
1116
1117 (((
1118 RS485-NB has a Controllable +5V output, user can use this output to power external sensor.
1119 )))
1120
1121 (((
1122 The +5V output will be valid for every sampling. RS485-NB will enable +5V output before all sampling and disable the +5v after all sampling. 
1123 )))
1124
1125 (((
1126 The 5V output time can be controlled by AT Command.
1127 )))
1128
1129
1130 (((
1131 (% style="color:#037691" %)**AT+5VT=1000**
1132 )))
1133
1134
1135 (((
1136 Means set 5V valid time to have 1000ms. So, the real 5V output will actually have 1000ms + sampling time for other sensors.
1137 )))
1138
1139 (((
1140 By default, the AT+5VT=0. If the external sensor which require 5v and require more time to get stable state, user can use this command to increase the power ON duration for this sensor.
1141 )))
1142
1143
1144 == 2.13 Switch Jumper ==
1145
1146
1147 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:463px" %)
1148 |=(% style="width: 123px;background-color:#4F81BD;color:white" %)**Switch Jumper**|=(% style="width: 340px;background-color:#4F81BD;color:white" %)**Feature**
1149 |(% style="width:123px" %)SW1|(% style="width:340px" %)ISP position: Upgrade firmware via UART
1150 Flash position: Configure device, check running status.
1151 |(% style="width:123px" %)SW2|(% style="width:336px" %)5V position: set to compatible with 5v I/O.
1152 3.3v position: set to compatible with 3.3v I/O.
1153
1154 (((
1155 (% style="color:blue" %)** +3.3V**(%%): is always ON
1156 )))
1157
1158 (((
1159 (% style="color:blue" %)** +5V**(%%): Only open before every sampling. The time is by default, it is (% style="color:#4472c4" %)** AT+5VT=0**(%%).
1160
1161 (% style="color:red" %)**Note: If SW2 is at +5V and AT+5VT=0, work mode 2 will not be able to send data.**
1162 )))
1163
1164
1165 == 2.14 Clock logging (Since firmware version v1.0.7) ==
1166
1167
1168 Sometimes when we deploy lots of end nodes in field. We want all sensors sample data at the same time, and upload these data together for analyze. In such case, we can use clock loging feature.
1169
1170 We can use this command to set the start time of data recording and the time interval to meet the requirements of the specific collection time of data.
1171
1172 * (% style="color:blue" %)**AT Command:**(%%) (% style="color:#037691" %)**AT+CLOCKLOG=a,b,c,d**
1173
1174 (% style="color:#4472c4" %)**a: **(%%)**0:** Disable Clock logging.  ** 1: **Enable Clock Logging
1175
1176 (% style="color:#4472c4" %)**b: **(%%)Specify First sampling start second: range **(0 ~~ 3599, 65535)   ** ~/~/ (% style="color:red" %)**Note:**(%%)** **If parameter b is set to 65535, the log period starts after the node accesses the network and sends packets.
1177
1178 (% style="color:#4472c4" %)**c: **(%%)Specify the sampling interval: range **(0 ~~ 255 minutes)**
1179
1180 (% style="color:#4472c4" %)**d: **(%%)How many entries should be uplink on every TDC **(max 32)**
1181
1182 [[image:image-20240309094931-1.png]]
1183
1184
1185 **Example:**
1186
1187 **AT+CLOCKLOG=1,2799,1,32**
1188 Device will log data to memory start from 2799' and then log every 1 minutes. And every TDC uplink, the uplink payload will consist: Battery info + last 32 memory record (payload+Timestamp).
1189
1190 [[image:image-20240306173013-2.png||height="535" width="1129"]]
1191
1192 (% style="color:red" %)**Note: Users need to synchronize the server time before configuring this command. If the server time is not synchronized before this command is configured, the command takes effect only after the node is reset.**
1193
1194
1195 == 2.15 Example Query saved historical records ==
1196
1197
1198 * (% style="color:blue" %)**AT Command:**(%%) (% style="color:#037691" %)**AT+CDP**
1199
1200 This command can be used to search the saved history, recording up to 32 groups of data, each group of historical data contains a maximum of 100 bytes.
1201
1202 [[image:image-20240306174106-4.png||height="593" width="881"]]
1203
1204
1205
1206 == 2.16 Uplink log query ==
1207
1208 * (% style="color:blue" %)**AT Command:**(%%) (% style="color:#037691" %)**AT+GETLOG**
1209
1210 This command can be used to query upstream logs of data packets.
1211
1212 [[image:image-20240422155603-1.png||height="669" width="873"]]
1213
1214
1215
1216
1217
1218 = 3. Configure RS485-NB =
1219
1220 == 3.1 Configure Methods ==
1221
1222
1223 RS485-NB supports below configure method:
1224
1225 * AT Command via Bluetooth Connection (**Recommended**): [[BLE Configure Instruction>>http://wiki.dragino.com/xwiki/bin/view/Main/BLE%20Bluetooth%20Remote%20Configure/]].
1226
1227 * AT Command via UART Connection : See [[UART Connection>>http://wiki.dragino.com/xwiki/bin/view/Main/UART%20Access%20for%20LoRa%20ST%20v4%20base%20model/#H2.4UARTConnectionforRS485-BLbasemotherboard]].
1228
1229 == 3.2 AT Commands Set ==
1230
1231
1232 AT+<CMD>?        : Help on <CMD>
1233
1234 AT+<CMD>         : Run <CMD>
1235
1236 AT+<CMD>=<value> : Set the value
1237
1238 AT+<CMD>=?       : Get the value
1239
1240
1241 (% style="color:blue" %)**General Commands**      
1242
1243 AT                    : Attention       
1244
1245 AT?  : Short Help     
1246
1247 ATZ  : MCU Reset    
1248
1249 AT+TDC  : Application Data Transmission Interval
1250
1251 AT+CFG  : Print all configurations
1252
1253 AT+CFGMOD           : Working mode selection
1254
1255 AT+DEUI  : Get or set the Device ID
1256
1257 AT+PRO          : Choose agreement
1258
1259 AT+RXDL  : Extend the sending and receiving time
1260
1261 AT+DNSCFG  : Get or Set DNS Server
1262
1263 AT+GETSENSORVALUE   : Returns the current sensor measurement
1264
1265 AT+SERVADDR :  Server Address
1266
1267 AT+MOD:  Get or Set work mode
1268
1269 AT+5VT :  Get or Set extend the time of 5V power
1270
1271 AT+3V3T :  Get or Set extend the time of 3V3 power
1272
1273 AT+INTMOD :  Get or Set the trigger interrupt mode (0:input,1:falling or rising,2:falling,3:rising)
1274
1275 AT+BAUDR: Get or Set baudr of uart
1276
1277 AT+DATABIT: Get or Set databit(7:7 bit,8:8 bit) of uart
1278
1279 AT+PARITY: Get or Set parity(0:none,1:odd,2:even) of uart
1280
1281 AT+STOPBIT: Get or Set stopbit(0:1 bit,1:1.5 bit,2:2 bit) of uart
1282
1283 AT+CMDEAR: Erase command(number of begin to number of ending)
1284
1285 AT+PAYVER: Get or Set payload version
1286
1287 AT+MBFUN: Get or Set Modbus Funtion code(0:none,1:01 or 02,2:03 or 04)for automatic cut
1288
1289 AT+COMMAND: Send data of command1-15 to RS485 deceive for payload
1290
1291 AT+SEARCH:  Retrieve the hexadecimal character that appears in command 1-15
1292
1293 AT+DATACUT: Cut receive data after use command1-15
1294
1295 AT+CMDDL: Set delay timeout after send rs485 command1-15
1296
1297 AT+CFGDEV: Send data to RS485 deceive
1298
1299
1300
1301 (% style="color:blue" %)**MQTT Management**
1302
1303 AT+CLIENT               : Get or Set MQTT client
1304
1305 AT+UNAME              : Get or Set MQTT Username
1306
1307 AT+PWD                  : Get or Set MQTT password
1308
1309 AT+PUBTOPIC  : Get or Set MQTT publish topic
1310
1311 AT+SUBTOPIC  : Get or Set MQTT subscription topic
1312
1313
1314 (% style="color:blue" %)**Information**          
1315
1316 AT+FDR  : Factory Data Reset
1317
1318 AT+PWORD  : Serial Access Password
1319
1320 AT+LDATA  : Get the last upload data
1321
1322
1323 = 4. Battery & Power Consumption =
1324
1325
1326 RS485-NB use ER26500 + SPC1520 battery pack. See below link for detail information about the battery info and how to replace.
1327
1328 [[**Battery Info & Power Consumption Analyze**>>http://wiki.dragino.com/xwiki/bin/view/Main/How%20to%20calculate%20the%20battery%20life%20of%20Dragino%20sensors%3F/]] .
1329
1330
1331 = 5. Firmware update =
1332
1333
1334 User can change device firmware to::
1335
1336 * Update with new features.
1337
1338 * Fix bugs.
1339
1340 Firmware and changelog can be downloaded from : **[[Firmware download link>>https://www.dropbox.com/sh/eywl6agsdcwrn4q/AAD3eMki9zLj2GZtndfHkO_Ra?dl=0]]**
1341
1342 Methods to Update Firmware:
1343
1344 * (Recommended way) OTA firmware update via BLE: [[**Instruction**>>url:http://wiki.dragino.com/xwiki/bin/view/Main/BLE_Firmware_Update_NB_Sensors_BC660K-GL/]].
1345
1346 * Update through UART TTL interface : **[[Instruction>>http://wiki.dragino.com/xwiki/bin/view/Main/UART_Access_for_NB_ST_BC660K-GL/#H4.2UpdateFirmware28Assumethedevicealreadyhaveabootloader29]]**.
1347
1348 = 6. FAQ =
1349
1350 == 6.1 How can I access t BC660K-GL AT Commands? ==
1351
1352
1353 User can access to BC660K-GL directly and send AT Commands.
1354
1355 [[See BC660K-GL AT Command set>>url:https://www.dropbox.com/sh/5f6ssda5fum8rvs/AABT68l8ZzWOvZ5eg2qwOoFda?dl=0]]
1356
1357
1358 == 6.2 How many RS485-Slave can RS485-NB connects? ==
1359
1360
1361 (((
1362 The RS485-NB can support max 32 RS485 devices. Each uplink command of RS485-NB can support max 16 different RS485 command. So RS485-NB can support max 16 RS485 devices pre-program in the device for uplink. For other devices no pre-program, user can use the downlink message (type code 0xA8) to poll their info.
1363 )))
1364
1365
1366 == 6.3 How to configure the device through the MQTT subscription function? ==
1367
1368
1369 Subscription content: {AT COMMAND}
1370
1371 (% style="color:#037691" %)**Example:**
1372
1373 Setting AT+5VT=500 through Node-RED requires MQTT to send the content {AT+5VT=500}.
1374
1375 [[image:1698140180821-486.png]]
1376
1377 The serial port displays:
1378
1379 [[image:image-20231024174641-2.png||height="267" width="531"]]
1380
1381
1382 == 6.4 How to Use RS485-NB  to connect to RS232 devices? ==
1383
1384
1385 [[Use RS485-NB to connect to RS232 devices. - DRAGINO>>http://wiki.dragino.com/xwiki/bin/view/Main/RS485%20to%20RS232/]]
1386
1387
1388 == 6.5 How to judge whether there is a problem with the set COMMAND ==
1389
1390 === 6.5.1 Introduce: ===
1391
1392
1393 Users can use below the structure to fast debug the communication between RS485-NB. The principle is to put the PC in the RS485 network and sniff the packet between Modbus MTU and RS485-NB. We can (% style="color:blue" %)**use this way to:**
1394
1395 1. Test if Modbus-MTU works with PC commands.
1396 1. Check if RS485-NB sent the expected command to Mobus-MTU
1397 1. Check if Modbus-MTU return back the expected result to RS485-NB.
1398 1. If both b) and c) has issue, we can compare PC's output and RS485-NB output.
1399
1400 [[image:1698136924033-830.png]]
1401
1402
1403 (% style="color:blue" %)**Example Connection: **
1404
1405 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-2.png?rev=1.1||alt="image-20221130104310-2.png"]]
1406
1407
1408 === 6.5.2 Set up PC to monitor RS485 network With Serial tool ===
1409
1410
1411 (% style="color:red" %)**Note: Receive and send set to hex mode**
1412
1413 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-3.png?width=714&height=616&rev=1.1||alt="image-20221130104310-3.png" height="616" width="714"]]
1414
1415
1416 === 6.5.3 With ModRSsim2: ===
1417
1418
1419 (% style="color:blue" %)**(1) Select serial port MODBUS RS-232**
1420
1421 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-4.png?width=865&height=390&rev=1.1||alt="image-20221130104310-4.png" height="390" width="865"]]
1422
1423
1424 (% style="color:blue" %)**(2) Click the serial port icon**
1425
1426 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-5.png?width=870&height=392&rev=1.1||alt="image-20221130104310-5.png" height="392" width="870"]]
1427
1428
1429 (% style="color:blue" %)**(3) After selecting the correct serial port and baud rate, click ok**
1430
1431 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-6.png?rev=1.1||alt="image-20221130104310-6.png"]]
1432
1433
1434 (% style="color:blue" %)**(4) Click the comms.**
1435
1436 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-7.png?width=835&height=376&rev=1.1||alt="image-20221130104310-7.png" height="376" width="835"]]
1437
1438 Run RS485-NB command and monitor if it is correct.
1439
1440
1441 === 6.5.4 Example – Test the CFGDEV command ===
1442
1443
1444 RS485-LN sent below command:
1445
1446 (% style="color:blue" %)**AT+CFGDEV=01 03 20 00 01 85 c0,1**(%%) to RS485 network, and PC is able to get this command and return commands from MTU to show in the serial tool.
1447
1448 We can see the output from the Serial port tool to analyze. And check if they are expected result.
1449
1450 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-8.png?width=797&height=214&rev=1.1||alt="image-20221130104310-8.png" height="214" width="797"]]
1451
1452
1453 We can also use ModRSsim2 to see the output.
1454
1455 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-9.png?width=729&height=531&rev=1.1||alt="image-20221130104310-9.png" height="531" width="729"]]
1456
1457
1458 === 6.5.5 Example – Test CMD command sets. ===
1459
1460
1461 Run (% style="color:blue" %)**AT+SENSORVALUE=1**(%%) to test the CMD commands set in RS485-LN.
1462
1463 (% style="color:blue" %)**Serial port tool:**
1464
1465 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-10.png?width=844&height=339&rev=1.1||alt="image-20221130104310-10.png" height="339" width="844"]]
1466
1467
1468 (% style="color:blue" %)**ModRSsim2:**
1469
1470 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-11.png?width=962&height=281&rev=1.1||alt="image-20221130104310-11.png" height="281" width="962"]]
1471
1472
1473 === 6.5.6 Test with PC ===
1474
1475
1476 If there is still have problem to set up correctly the commands between RS485-LN and MTU. User can test the correct RS485 command set in PC and compare with the RS485 command sent out via RS485-LN. as long as both commands are the same, the MTU should return correct result.
1477
1478 Or User can send the working commands set in PC serial tool to Dragino Support to check what should be configured in RS485-LN.
1479
1480 (% style="color:blue" %)**Connection method:**
1481
1482 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-12.png?rev=1.1||alt="image-20221130104310-12.png"]]
1483
1484
1485 (% style="color:blue" %)**Link situation:**
1486
1487 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-13.png?width=486&height=458&rev=1.1||alt="image-20221130104310-13.png" height="458" width="486"]]
1488
1489
1490 [[image:http://wiki.dragino.com/xwiki/bin/download/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/RS485-LN%20%E2%80%93%20RS485%20to%20LoRaWAN%20Converter/WebHome/image-20221130104310-14.png?width=823&height=371&rev=1.1||alt="image-20221130104310-14.png" height="371" width="823"]]
1491
1492
1493 = 7. Order Info =
1494
1495
1496 Part Number: (% style="color:blue" %)**RS485-NB-XX**
1497
1498 (% style="color:red" %)**XX**(%%):
1499
1500 * (% style="color:#037691" %)**GE**(%%): General version ( Exclude SIM card)
1501
1502 * (% style="color:#037691" %)**1D**(%%): with 1NCE* 10 years 500MB SIM card and Pre-configure to DataCake server
1503
1504 (% style="color:blue" %)**YY: The grand connector hole size**
1505
1506 * (% style="color:#037691" %)**M12**(%%): M12 hole
1507
1508 * (% style="color:#037691" %)**M16**(%%): M16 hole
1509
1510 = 8. ​Packing Info =
1511
1512
1513 (% style="color:#037691" %)**Package Includes**:
1514
1515 * RS485-NB NB-IoT Sensor Node x 1
1516
1517 * External antenna x 1
1518
1519 (% style="color:#037691" %)**Dimension and weight**:
1520
1521 * Device Size: 13.0 x 5 x 4.5 cm
1522
1523 * Device Weight: 150g
1524
1525 * Package Size / pcs : 14.0 x 8x 5 cm
1526
1527 * Weight / pcs : 180g
1528
1529 = 9. Support =
1530
1531
1532 * Support is provided Monday to Friday, from 09:00 to 18:00 GMT+8. Due to different timezones we cannot offer live support. However, your questions will be answered as soon as possible in the before-mentioned schedule.
1533
1534 * 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.cc>>mailto:Support@dragino.cc]].
1535
1536 (% style="display:none" %) (%%)
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0