Show last authors
1 (% style="display:none" %) (%%) ​​​(% style="display:none" %)
2
3 (% style="text-align:center" %)
4 [[image:image-20220627094803-5.png||height="366" width="804"]]
5
6
7 (% style="display:none" %) (%%)
8
9
10
11
12
13
14
15 **Table of Contents:**
16
17 (% _mstaria-label="285168" aria-label="macro:toc widget" contenteditable="false" role="region" tabindex="-1" %)
18 (((
19 (% style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||height="15" role="presentation" title="Click and drag to move" width="15"]]
20 )))
21
22 {{toc/}}
23
24
25
26
27
28
29
30
31
32
33 = 1.  Introduction =
34
35 == 1.1 ​ What is LSN50 LoRa Sensor Node ==
36
37
38 (((
39 (((
40 LSN50 is a Long Range LoRaWAN Sensor Node. It is designed for (% style="color:#4472c4" %)**outdoor data logging **(%%)and powered by (% style="color:#4472c4" %)**Li/SOCl2 battery**(%%) for long term use and secure data transmission. It is designed to facilitate developers to quickly deploy industrial level LoRa and IoT solutions. It helps users to turn the idea into a practical application and make the Internet of Things a reality. It is easy to program, create and connect your things everywhere.
41 )))
42
43 (((
44 It is based on SX1276/SX1278 allows the user to send data and reach extremely long ranges at low data-rates. It provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption. It targets professional wireless sensor network applications such as irrigation systems, smart metering, smart cities, building automation, and so on.
45 )))
46
47 (((
48 (% style="color:#4472c4" %)**LSN50**(%%) uses STM32l0x chip from ST, STML0x is the (% style="color:#4472c4" %)**ultra-low-power**(%%) STM32L072xxxx microcontrollers incorporate the connectivity power of the universal serial bus (USB 2.0 crystal-less) with the high-performance ARM® Cortex®-M0+ 32-bit RISC core operating at a 32 MHz frequency, a memory protection unit (MPU), high-speed embedded memories (192 Kbytes of Flash program memory, 6 Kbytes of data EEPROM and 20 Kbytes of RAM) plus an extensive range of enhanced I/Os and peripherals.
49 )))
50
51 (((
52 LSN50 is an (% style="color:#4472c4" %)**open source product**(%%), it is based on the STM32Cube HAL drivers and lots of libraries can be found in ST site for rapid development.
53 )))
54 )))
55
56
57 [[image:1656294562709-486.png]]
58
59
60 == 1.2  Specifications ==
61
62
63 (% style="color:#037691" %)**Micro Controller:**
64
65
66 * MCU: STM32L072xxxx
67 * Flash: 128KB
68 * RAM: 20KB
69 * EEPROM: 6KB
70 * Clock Speed: 32Mhz
71
72 (% style="color:#037691" %)**Common DC Characteristics:**
73
74 * Supply Voltage: 2.1v ~~ 3.6v
75 * Operating Temperature: -40 ~~ 85°C
76 * I/O pins: Refer to [[STM32L072 datasheet>>https://www.st.com/resource/en/datasheet/stm32l072cz.pdf]]
77
78 (% style="color:#037691" %)**LoRa Spec:**
79
80 * Frequency Range,
81 ** Band 1 (HF): 862 ~~ 1020 Mhz
82 * or
83 ** Band 2 (LF): 410 ~~ 528 Mhz
84 * 168 dB maximum link budget.
85 * +20 dBm - 100 mW constant RF output vs.
86 * +14 dBm high efficiency PA.
87 * Programmable bit rate up to 300 kbps.
88 * High sensitivity: down to -148 dBm.
89 * Bullet-proof front end: IIP3 = -12.5 dBm.
90 * Excellent blocking immunity.
91 * Low RX current of 10.3 mA, 200 nA register retention.
92 * Fully integrated synthesizer with a resolution of 61 Hz .
93 * FSK, GFSK, MSK, GMSK, LoRaTM and OOK modulation.
94 * Built-in bit synchronizer for clock recovery.
95 * Preamble detection.
96 * 127 dB Dynamic Range RSSI.
97 * Automatic RF Sense and CAD with ultra-fast AFC.
98 * Packet engine up to 256 bytes with CRC.
99 * LoRaWAN 1.0.2 Specification
100
101 (% style="color:#037691" %)**Battery:**
102
103 * Li/SOCI2 un-chargeable battery
104 * Capacity: 4000mAh
105 * Self Discharge: <1% / Year @ 25°C
106 * Max continuously current: 130mA
107 * Max boost current: 2A, 1 second
108
109 (% style="color:#037691" %)**Power Consumption**
110
111 * STOP Mode: 2.7uA @ 3.3v
112 * LoRa Transmit Mode: 125mA @ 20dBm 44mA @ 14dBm
113
114 == ​1.3  Features ==
115
116
117 * LoRaWAN 1.0.3 Class A, Class C
118 * STM32L072xxxx MCU
119 * SX1276/78 Wireless Chip
120 * Pre-load bootloader on USART1/USART2
121 * MDK-ARM Version 5.24a IDE
122 * I2C, LPUSART1, USB, SPI2
123 * 3x12bit ADC, 1x12bit DAC
124 * 20xDigital I/Os
125 * LoRa™ Modem
126 * Preamble detection
127 * Baud rate configurable
128 * CN470/EU433/KR920/US915/IN865
129 * EU868/AS923/AU915/MA869
130 * Open-source hardware / software
131 * Available Band:433/868/915/920 Mhz
132 * IP66 Waterproof Enclosure
133 * Ultra-Low Power consumption
134 * AT Commands to change parameters
135 * 4000mAh or 8500mAh Battery for long term use.
136
137 == 1.4 ​ Applications ==
138
139
140 * Smart Cities
141 * Smart Factory
142 * Smart Metering
143 * Smart Agriculture
144 * Smart Buildings & Home Automation
145 * Logistics and Supply Chain Management
146
147 == 1.5  Pin Definitions and Switch ==
148
149
150 (% class="wikigeneratedid" %)
151 [[image:1656295519542-152.png||height="413" width="728"]]
152
153
154 (% class="wikigeneratedid" %)
155 [[image:1656295532863-613.png||height="371" width="721"]]
156
157
158 (% border="1" cellspacing="4" style="width:510px" %)
159 |=(% style="width: 30px;background-color:#4F81BD;color:white" %)**No.**|=(% style="width: 70px;background-color:#4F81BD;color:white" %)**Signal**|=(% style="width: 60px;background-color:#4F81BD;color:white" %)**Direction**|=(% style="width: 180px;background-color:#4F81BD;color:white" %)**Function**|=(% style="width: 170px;background-color:#4F81BD;color:white" %)Remark
160 |(% style="background-color:#f2f2f2; width:44px" %)1|(% style="background-color:#f2f2f2; width:86px" %)VCC(2.9V)|(% style="background-color:#f2f2f2; width:84px" %)OUTPUT|(% style="background-color:#f2f2f2; width:322px" %)VCC|(% style="background-color:#f2f2f2; width:296px" %)Directly connect to main power for board
161 |(% style="background-color:#f2f2f2; width:44px" %)2|(% style="background-color:#f2f2f2; width:86px" %)PA0|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)Used as ADC in LSN50 image
162 |(% style="background-color:#f2f2f2; width:44px" %)3|(% style="background-color:#f2f2f2; width:86px" %)PA1|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
163 |(% style="background-color:#f2f2f2; width:44px" %)4|(% style="background-color:#f2f2f2; width:86px" %)PA2|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip, 10k pull up to VCC|(% style="background-color:#f2f2f2; width:296px" %)Used as UART_TXD in LSN50 image
164 |(% style="background-color:#f2f2f2; width:44px" %)5|(% style="background-color:#f2f2f2; width:86px" %)PA3|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip, 10k pull up to VCC|(% style="background-color:#f2f2f2; width:296px" %)Used as UART_RXD in LSN50 image
165 |(% style="background-color:#f2f2f2; width:44px" %)6|(% style="background-color:#f2f2f2; width:86px" %)PB6|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip, 10k pull up to VCC|(% style="background-color:#f2f2f2; width:296px" %)
166 |(% style="background-color:#f2f2f2; width:44px" %)7|(% style="background-color:#f2f2f2; width:86px" %)PB7|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip, 10k pull up to VCC|(% style="background-color:#f2f2f2; width:296px" %)
167 |(% style="background-color:#f2f2f2; width:44px" %)8|(% style="background-color:#f2f2f2; width:86px" %)PB3|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip, 10k pull up to VCC|(% style="background-color:#f2f2f2; width:296px" %)
168 |(% style="background-color:#f2f2f2; width:44px" %)9|(% style="background-color:#f2f2f2; width:86px" %)PB4|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
169 |(% style="background-color:#f2f2f2; width:44px" %)10|(% style="background-color:#f2f2f2; width:86px" %)PA9|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip, 10k pull up to VCC|(% style="background-color:#f2f2f2; width:296px" %)
170 |(% style="background-color:#f2f2f2; width:44px" %)11|(% style="background-color:#f2f2f2; width:86px" %)PA10|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip, 10k pull up to VCC|(% style="background-color:#f2f2f2; width:296px" %)
171 |(% style="background-color:#f2f2f2; width:44px" %)12|(% style="background-color:#f2f2f2; width:86px" %)GND|(% style="background-color:#f2f2f2; width:84px" %) |(% style="background-color:#f2f2f2; width:322px" %)Ground|(% style="background-color:#f2f2f2; width:296px" %)
172 |(% style="background-color:#f2f2f2; width:44px" %)13|(% style="background-color:#f2f2f2; width:86px" %)VCC(2.9V)|(% style="background-color:#f2f2f2; width:84px" %)OUTPUT|(% style="background-color:#f2f2f2; width:322px" %)VCC|(% style="background-color:#f2f2f2; width:296px" %)Directly connect to main power for board
173 |(% style="background-color:#f2f2f2; width:44px" %)14|(% style="background-color:#f2f2f2; width:86px" %)Jumper|(% style="background-color:#f2f2f2; width:84px" %) |(% style="background-color:#f2f2f2; width:322px" %)Power on/off jumper|(% style="background-color:#f2f2f2; width:296px" %)
174 |(% style="background-color:#f2f2f2; width:44px" %)15|(% style="background-color:#f2f2f2; width:86px" %)PA4|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
175 |(% style="background-color:#f2f2f2; width:44px" %)16|(% style="background-color:#f2f2f2; width:86px" %)NRST|(% style="background-color:#f2f2f2; width:84px" %)In|(% style="background-color:#f2f2f2; width:322px" %)Reset MCU|(% style="background-color:#f2f2f2; width:296px" %)
176 |(% style="background-color:#f2f2f2; width:44px" %)17|(% style="background-color:#f2f2f2; width:86px" %)PA12|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
177 |(% style="background-color:#f2f2f2; width:44px" %)18|(% style="background-color:#f2f2f2; width:86px" %)PA11|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
178 |(% style="background-color:#f2f2f2; width:44px" %)19|(% style="background-color:#f2f2f2; width:86px" %)PA14|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
179 |(% style="background-color:#f2f2f2; width:44px" %)20|(% style="background-color:#f2f2f2; width:86px" %)PB13|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
180 |(% style="background-color:#f2f2f2; width:44px" %)21|(% style="background-color:#f2f2f2; width:86px" %)PB12|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
181 |(% style="background-color:#f2f2f2; width:44px" %)22|(% style="background-color:#f2f2f2; width:86px" %)PB15|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
182 |(% style="background-color:#f2f2f2; width:44px" %)23|(% style="background-color:#f2f2f2; width:86px" %)PB14|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
183 |(% style="background-color:#f2f2f2; width:44px" %)24|(% style="background-color:#f2f2f2; width:86px" %)PA13|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)
184 |(% style="background-color:#f2f2f2; width:44px" %)25|(% style="background-color:#f2f2f2; width:86px" %)PA8|(% style="background-color:#f2f2f2; width:84px" %)In/Out|(% style="background-color:#f2f2f2; width:322px" %)Directly from STM32 chip|(% style="background-color:#f2f2f2; width:296px" %)Default use to turn on/off LED1 in LSN50 image
185 |(% style="background-color:#f2f2f2; width:44px" %)26|(% style="background-color:#f2f2f2; width:86px" %)GND|(% style="background-color:#f2f2f2; width:84px" %) |(% style="background-color:#f2f2f2; width:322px" %)Ground|(% style="background-color:#f2f2f2; width:296px" %)
186 |(% style="background-color:#f2f2f2; width:44px" %)27|(% style="background-color:#f2f2f2; width:86px" %)+5V|(% style="background-color:#f2f2f2; width:84px" %)Out|(% style="background-color:#f2f2f2; width:322px" %)5v output power|(% style="background-color:#f2f2f2; width:296px" %)(((
187 Controlled by PB5(Low to Enable, High to Disable)
188
189 Continuous output : max 600mA
190
191 Pulse output : max 1A
192 )))
193 |(% style="background-color:#f2f2f2; width:44px" %)28|(% style="background-color:#f2f2f2; width:86px" %)LED1|(% style="background-color:#f2f2f2; width:84px" %) |(% style="background-color:#f2f2f2; width:322px" %)Controlled by PA8|(% style="background-color:#f2f2f2; width:296px" %)Blink on transmit
194 |(% style="background-color:#f2f2f2; width:44px" %)29|(% style="background-color:#f2f2f2; width:86px" %)BOOT MODE|(% style="background-color:#f2f2f2; width:84px" %) |(% style="background-color:#f2f2f2; width:322px" %)Configure device in working mode or ISP program mode|(% style="background-color:#f2f2f2; width:296px" %)(((
195 (((
196 Flash: Normal Working mode and send AT Commands
197 )))
198
199 (((
200 ISP: UART Program Mode
201 )))
202 )))
203 |(% style="background-color:#f2f2f2; width:44px" %)30|(% style="background-color:#f2f2f2; width:86px" %)NRST|(% style="background-color:#f2f2f2; width:84px" %)In|(% style="background-color:#f2f2f2; width:322px" %)Reset MCU|(% style="background-color:#f2f2f2; width:296px" %)
204
205 (% style="display:none" %)
206
207
208
209 === 1.5.1 Jumper JP2 ===
210
211
212 Power on Device when put this jumper.
213
214
215 === 1.5.2 BOOT MODE / SW1 ===
216
217
218 (((
219 ~1. 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.
220 )))
221
222 (((
223 2. Flash:  work mode, device starts to work and send out console output for further debug
224 )))
225
226
227 === 1.5.3 Reset Button ===
228
229
230 Press to reboot the device.
231
232
233 === 1.5.4 LED ===
234
235
236 It will flash:
237
238 ~1. When boot the device in flash mode
239
240 2. Send an uplink packet
241
242
243 == 1.6  Hardware Change log ==
244
245
246 (% style="color:red" %)**Note: Hardware version is marked in the PCB.**
247
248
249 (% style="color:#4472c4" %)**LSN50 v2.1:**
250
251 1. Change R14 to 1M ohm
252 1. Change R3, R4 to 4.7Kohm. So no need to modify them for 3 DS18B20 connection.
253 1. Add ESD to each I/O
254
255 (% style="color:#4472c4" %)**LSN50 v2.0:**
256
257 * Change to a new enclosure. Improve with external antenna, IP66, ear hook.
258
259 (% style="color:#4472c4" %)**LSN50 v1.3**:
260
261 * Add P-MOS to control 5V output
262
263 (% style="color:#4472c4" %)**LSN50 v1.2**:
264
265 * Add LED. Turn on for every LoRa transmit
266 * Add pin PA4, PB13, NRST
267 * Add 5V Output, on/off control by PB5(Low to Enable, High to Disable)
268
269 == 1.7  Hole Option ==
270
271
272 The LSN50 provides different hole size options for different size sensor cable. The options provided are M12, M16 and M20. The definition is as below:
273
274 [[image:image-20220627104757-1.png]]
275
276
277 [[image:1656298089706-973.png]]
278
279
280 = 2.  Use LSN50 with LoRaWAN firmware =
281
282 == 2.1  How it works ==
283
284
285 (((
286 (((
287 The LSN50 is pre-loaded with a firmware and is configured as LoRaWAN OTAA Class A mode by default. It has OTAA keys to join LoRaWAN network. To connect a local LoRaWAN network, you just need to input the OTAA keys in the LoRaWAN IoT server and power on the LSN50. It will automatically join the network via OTAA.
288 )))
289
290 (((
291
292 )))
293
294 (((
295 The diagram below shows the working flow in default firmware (ver 1.8.0): 
296
297
298 )))
299
300 [[image:image-20220823174408-9.png||height="890" width="657"]]
301
302
303 (((
304 In case you can't set the OTAA keys in the LoRaWAN OTAA server, and you have to use the keys from the server, you can [[use AT Commands>>||anchor="H3.A0UsingtheATCommands"]] to set the keys in the LSN50.
305 )))
306 )))
307
308
309 == 2.2  ​Quick guide to connect to LoRaWAN server (OTAA) ==
310
311
312 (((
313 Following is an example for how to join the [[TTN V3 LoRaWAN Network>>url:http://www.thethingsnetwork.org/]]. Below is the network structure; we use the [[LG308>>url:http://www.dragino.com/products/lora/item/140-lg308.html]] as a LoRaWAN gateway in this example. 
314
315
316 (% style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]][[image:1655891470063-521.png]](% title="Click and drag to resize" %)​[[image:1656298385089-555.png]]
317
318
319 )))
320
321 (% _mstmutation="1" title="Click and drag to resize" %)​(%%)The LG308 is already set to connected to [[TTN V3 network >>url:https://www.thethingsnetwork.org/||_mstmutation="1"]], so what we need to now is configure the TTN V3 server.(% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220, 220, 220, 0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||data-widget="image" draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]][[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% title="Click and drag to resize" %)​(% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" %)​(%%)​
322
323 (((
324
325
326 (% style="color:blue" %)**Step 1**(%%): Create a device in TTN with the OTAA keys from LSN50.
327
328 Each LSN50 is shipped with a sticker with the default device EUI as below:
329 )))
330
331 (((
332 [[image:image-20230425173445-3.png||height="250" width="538"]]
333 )))
334
335 (% title="Click and drag to resize" %)​(% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||data-widget="image" draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220, 220, 220, 0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" title="Click and drag to resize" %)​(% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220, 220, 220, 0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||data-widget="image" draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]][[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% title="Click and drag to resize" %)​(% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" %)​(%%)​
336
337 (((
338 (((
339 You can enter this key in the LoRaWAN Server portal. Below is TTN screen shot:
340 )))
341
342 (((
343 **Register the device:**
344 )))
345 )))
346
347 (% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||data-widget="image" draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220, 220, 220, 0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" title="Click and drag to resize" %)​(% title="Click and drag to resize" %)​(% style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](%%)​(% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||data-widget="image" draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220, 220, 220, 0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" title="Click and drag to resize" %)​(% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||data-widget="image" draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220, 220, 220, 0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" title="Click and drag to resize" %)​(% title="Click and drag to resize" %)​​
348
349 (% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||data-widget="image" draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220, 220, 220, 0.5); display:none" tabindex="-1" %)[[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||draggable="true" height="15" role="presentation" title="Click and drag to move" width="15"]](% _mstaria-label="548795" aria-label="Data URI image image widget" contenteditable="false" role="region" style="background-image:url(http://wiki1.dragino.com/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.61/plugins/widget/images/handle.png); background:rgba(220,220,220,0.5); display:none" tabindex="-1" title="Click and drag to resize" %)​(% title="Click and drag to resize" %)​[[image:image-20231028092240-1.png]]
350
351
352 **Add APP EUI ,DEV EUI and AppKey:**
353
354
355 [[image:image-20231028092510-2.png||height="568" width="775"]]
356
357
358 (% style="color:blue" %)**Step 2**(%%)**:** Power on LSN50
359
360
361 Put a Jumper on JP2 to power on the device.
362
363 [[image:image-20220627145643-5.png]]
364
365
366 **For LSn50v2:**
367
368 [[image:1656313034748-905.png]]
369
370 (((
371 (((
372 (% style="color:blue" %)**Step 3**(%%)**:**  The LSN50 will auto join to the TTN V3 network. After join success, it will start to upload messages to TTN V3 and you can see the messages in the panel.
373 )))
374 )))
375
376 ​[[image:1656312908855-552.png]]
377
378
379 == 2.3  ​Working Mode & Uplink Payload ==
380
381
382 (((
383 LSN50 has different working mode for the connections of different type of sensors. This section describes these modes. Use can use the AT Command AT+MOD to set LSN50 to different working modes.
384 )))
385
386 (((
387 For example:
388 )))
389
390 (((
391 (% _mstmutation="1" style="color:red" %)**AT+MOD=2  **(%%) ~/~/ will set the LSN50 to work in MOD=2 distance mode which target to measure distance via Ultrasonic Sensor.
392 )))
393
394 (((
395
396 )))
397
398 (((
399 (% style="color:red" %)**NOTE:**
400 )))
401
402 (((
403 ~1. Some working modes has payload more than 12 bytes, The US915/AU915/AS923 frequency bands' definition has maximum 11 bytes in **DR0**. Server sides will see NULL payload while LSn50 transmit in DR0 with 12 bytes payload.
404
405 2. All modes share the same Payload Explanation from HERE.
406
407 3. By default, the device will send an uplink message every 5 minutes.
408 )))
409
410
411 === 2.3.1  MOD~=1 (Default Mode) ===
412
413
414 (((
415 In this mode, uplink payload includes in total 11 bytes. Uplink packets use FPORT=2.
416
417 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
418 |(% style="background-color:#4f81bd; color:white; width:60px" %)**Size(bytes)**|(% style="background-color:#4f81bd; color:white; width:30px" %)**2**|(% style="background-color:#4f81bd; color:white; width:100px" %)**2**|(% style="background-color:#4f81bd; color:white; width:30px" %)**2**|(% style="background-color:#4f81bd; color:white; width:110px" %)**1**|(% style="background-color:#4f81bd; color:white; width:100px" %)**2**|(% style="background-color:#4f81bd; color:white; width:80px" %)**2**
419 |Value|Bat|Temperature(DS18B20)|ADC|Digital in & Digital Interrupt|Temperature(SHT20 or SHT31 or BH1750 Illumination Sensor)|Humidity(SHT20)
420
421 [[image:image-20220627150949-6.png]]
422 )))
423
424
425 === 2.3.2 MOD~=2 (Distance Mode) ===
426
427
428 This mode is target to measure the distance. The payload of this mode is totally 11 bytes. The 8^^th^^ and 9^^th^^ bytes is for the distance.
429
430 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
431 |(% style="background-color:#4f81bd; color:white; width:60px" %)**Size(bytes)**|(% style="background-color:#4f81bd; color:white; width:40px" %)**2**|(% style="background-color:#4f81bd; color:white; width:100px" %)**2**|(% style="background-color:#4f81bd; color:white; width:30px" %)**2**|(% style="background-color:#4f81bd; color:white; width:110px" %)**1**|(% style="background-color:#4f81bd; color:white; width:110px" %)**2**|(% style="background-color:#4f81bd; color:white; width:60px" %)**2**
432 |Value|BAT|(((
433 Temperature(DS18B20)
434 )))|ADC|Digital in & Digital Interrupt|(((
435 Distance measure by:
436 1) LIDAR-Lite V3HP
437 Or
438 2) Ultrasonic Sensor
439 )))|Reserved
440
441 [[image:1656324539647-568.png]]
442
443
444 (% style="color:red" %)**Connection of LIDAR-Lite V3HP:**
445
446 [[image:1656324581381-162.png]]
447
448
449 (% style="color:red" %)**Connection to Ultrasonic Sensor:**
450
451 [[image:1656324598488-204.png]]
452
453 For the connection to TF-Mini or TF-Luna , MOD2 payload is as below:
454
455 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
456 |(% style="background-color:#4f81bd; color:white; width:60px" %)**Size(bytes)**|(% style="background-color:#4f81bd; color:white; width:35px" %)**2**|(% style="background-color:#4f81bd; color:white; width:100px" %)**2**|(% style="background-color:#4f81bd; color:white; width:80px" %)**1**|(% style="background-color:#4f81bd; color:white; width:35px" %)**2**|(% style="background-color:#4f81bd; color:white; width:100px" %)**2**|(% style="background-color:#4f81bd; color:white; width:100px" %)**2**
457 |Value|BAT|(% style="width:102px" %)(((
458 Temperature(DS18B20)
459 )))|(% style="width:145px" %)Digital in & Digital Interrupt|ADC|(((
460 Distance measure by:1)TF-Mini plus LiDAR
461 Or 
462 2) TF-Luna LiDAR
463 )))|Distance signal  strength
464
465 [[image:1656376779088-686.png]]
466
467
468 (% style="color:red" %)**Connection to [[TF-Mini plus>>url:http://en.benewake.com/product/detail/5c345cd0e5b3a844c472329b.html]] LiDAR(UART version):**
469
470 Need to remove R3 and R4 resistors to get low power. Since firmware v1.7.0
471
472 [[image:1656376795715-436.png]]
473
474
475 (% style="color:red" %)**Connection to [[TF-Luna>>url:http://en.benewake.com/product/detail/5e1c1fd04d839408076b6255.html]] LiDAR (UART version):**
476
477 Need to remove R3 and R4 resistors to get low power. Since firmware v1.7.0
478
479 [[image:1656376865561-355.png]]
480
481 (((
482 Please use firmware version > 1.6.5 when use MOD=2, in this firmware version, user can use LSn50 v1 to power the ultrasonic sensor directly and with low power consumption.
483 )))
484
485
486 === 2.3.3 MOD~=3 (3 ADC + I2C) ===
487
488
489 This mode has total 12 bytes. Include 3 x ADC + 1x I2C
490
491 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:520px" %)
492 |=(% style="width: 60px;background-color:#4F81BD;color:white" %)(((
493 **Size(bytes)**
494 )))|=(% style="width: 60px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 50px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 50px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 90px;background-color:#4F81BD;color:white" %)**1**|=(% style="width: 90px;background-color:#4F81BD;color:white" %)2|=(% style="width: 90px;background-color:#4F81BD;color:white" %)2|=(% style="width: 30px;background-color:#4F81BD;color:white" %)1
495 |(% style="width:97px" %)Value|(% style="width:46px" %)ADC(Pin PA0)|(% style="width:123px" %)ADC2(PA1)|(% style="width:108px" %)ADC3 (PA4)|(% style="width:133px" %)(((
496 Digital in(PA12)&Digital Interrupt1(PB14)
497 )))|(% style="width:151px" %)Temperature(SHT20 or SHT31 or BH1750 Illumination Sensor)|(% style="width:131px" %)Humidity(SHT20 or SHT31)|(% style="width:66px" %)Bat
498
499 [[image:1656377431497-975.png]]
500
501
502 === 2.3.4 MOD~=4 (3 x DS18B20) ===
503
504
505 This mode is supported in firmware version since v1.6.1. Software set to AT+MOD=4
506
507 Hardware connection is as below,
508
509 (% style="color:red" %)**( Note:**
510
511 * In hardware version v1.x and v2.0 , R3 & R4 should change from 10k to 4.7k ohm to support the other 2 x DS18B20 probes.
512 * In hardware version v2.1 no need to change R3 , R4, by default, they are 4.7k ohm already.
513
514 See [[here>>||anchor="H1.6A0HardwareChangelog" _mstmutation="1"]] for hardware changelog. (% style="color:red" %)**) **
515
516 [[image:1656377461619-156.png]]
517
518
519 This mode has total 11 bytes. As shown below:
520
521 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
522 |(% style="background-color:#4f81bd; color:white; width:60px" %)**Size(bytes)**|(% style="background-color:#4f81bd; color:white; width:40px" %)**2**|(% style="background-color:#4f81bd; color:white; width:100px" %)**2**|(% style="background-color:#4f81bd; color:white; width:30px" %)**2**|(% style="background-color:#4f81bd; color:white; width:110px" %)**1**|(% style="background-color:#4f81bd; color:white; width:110px" %)**2**|(% style="background-color:#4f81bd; color:white; width:60px" %)**2**
523 |Value|BAT|(((
524 Temperature1
525 (DS18B20)
526 (PB3)
527 )))|ADC|Digital in & Digital Interrupt|Temperature2
528 (DS18B20)
529 (PA9)|Temperature3
530 (DS18B20)
531 (PA10)
532
533 [[image:1656377606181-607.png]]
534
535
536 === 2.3.5 MOD~=5(Weight Measurement by HX711) ===
537
538
539 (((
540 This mode is supported in firmware version since v1.6.2. Please use v1.6.5 firmware version so user no need to use extra LDO for connection.
541
542
543 )))
544
545 [[image:1656378224664-860.png]]
546
547
548 Each HX711 need to be calibrated before used. User need to do below two steps:
549
550 1. Zero calibration. Don't put anything on load cell and run **AT+WEIGRE** to calibrate to Zero gram.
551 1. Adjust calibration factor (default value 400): Put a known weight thing on load cell and run **AT+WEIGAP** to adjust the Calibration Factor.
552 1. (((
553 Remove the limit of plus or minus 5Kg in mode 5, and expand from 2 bytes to 4 bytes(Since its maximum number of bytes is 4 bytes with positive and negative
554 So its maximum weight is 2,147,483,647), the unit is g.(Since v1.8.0)
555 )))
556
557 For example:
558
559 (% style="color:#4472c4" %)**AT+WEIGAP =403.0**
560
561 Response:  Weight is 401 g
562
563
564 Check the response of this command and adjust the value to match the real value for thing.
565
566 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:490px" %)
567 |=(% style="width: 60px;background-color:#4F81BD;color:white" %)(((
568 **Size(bytes)**
569 )))|=(% style="width: 30px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 110px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 60px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 130px;background-color:#4F81BD;color:white" %)**1**|=(% style="width: 50px;background-color:#4F81BD;color:white" %)**4**|=(% style="width: 50px;background-color:#4F81BD;color:white" %)2
570 |(% style="width:97px" %)Value|(% style="width:40px" %)[[Bat>>||anchor="H2.4.1BatteryInfo"]]|(% style="width:110px" %)[[Temperature(DS18B20)>>||anchor="H2.4.2Temperature28DS18B2029"]]|(% style="width:30px" %)[[ADC>>||anchor="H2.4.4AnalogueDigitalConverter28ADC29"]]|(% style="width:120px" %)[[Digital Input and Digitak Interrupt>>||anchor="H2.4.3DigitalInput"]]|(% style="width:40px" %)Weight|(% style="width:40px" %)Reserved
571
572 [[image:image-20220820120036-2.png||height="469" width="1003"]]
573
574
575 === 2.3.6 MOD~=6 (Counting Mode, Since firmware v1.6.5) ===
576
577
578 (((
579 In this mode, the device will work in counting mode. It counts the interrupt on the interrupt pins and sends the count on TDC time.
580 )))
581
582 (((
583 Connection is as below. The PIR sensor is a count sensor, it will generate interrupt when people come close or go away. User can replace the PIR sensor with other counting sensors.
584 )))
585
586
587 [[image:1656378351863-572.png]]
588
589
590 (((
591 (% style="color:red" %)**Note:**(%%) LoRaWAN wireless transmission will infect the PIR sensor. Which cause the counting value increase +1 for every uplink. User can change PIR sensor or put sensor away of the LSN50 to avoid this happen.
592
593 Power loss or restart will reset the count
594 )))
595
596
597 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:390px" %)
598 |=(% style="width: 60px;background-color:#4F81BD;color:white" %)**Size(bytes)**|=(% style="width: 50px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 110px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 50px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 70px;background-color:#4F81BD;color:white" %)**1**|=(% style="width: 50px;background-color:#4F81BD;color:white" %)**4**
599 |(% style="width:80px" %)Value|(% style="width:44px" %)[[BAT>>||anchor="H2.4.1BatteryInfo"]]|(% style="width:172px" %)(((
600 [[Temperature(DS18B20)>>||anchor="H2.4.2Temperature28DS18B2029"]]
601 )))|(% style="width:51px" %)[[ADC>>||anchor="H2.4.4AnalogueDigitalConverter28ADC29"]]|(% style="width:206px" %)[[Digital in>>||anchor="H2.4.3DigitalInput"]]|(% style="width:72px" %)Count(PB14)
602
603 [[image:1656378441509-171.png]]
604
605
606 === 2.3.7  MOD~=7 Three interrupt contact modes (the hardware version needs to support three interrupt versions, Since firmware v1.8.0) ===
607
608
609 [[image:image-20220820140109-3.png]]
610
611
612 (% border="1" cellspacing="5" style="background-color:#f2f2f2; width:490px" %)
613 |=(% style="width: 60px;background-color:#4F81BD;color:white" %)(((
614 **Size(bytes)**
615 )))|=(% style="width: 30px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 100px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 30px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 80px;background-color:#4F81BD;color:white" %)**1**|=(% style="width: 70px;background-color:#4F81BD;color:white" %)**1**|=(% style="width: 70px;background-color:#4F81BD;color:white" %)1|=(% style="width: 50px;background-color:#4F81BD;color:white" %)2
616 |(% style="width:97px" %)Value|(% style="width:46px" %)BAT|(% style="width:123px" %)Temperature(DS18B20)|(% style="width:108px" %)ADC|(% style="width:133px" %)(((
617 Digital in(PA12)&Digital Interrupt1(PB14)
618 )))|(% style="width:159px" %)Digital Interrupt2(PB15)|(% style="width:159px" %)Digital Interrupt3(PA4)|(% style="width:159px" %)Reserved
619
620 === 2.3.8  MOD~=8 (3ADC+1DS18B20, Since firmware v1.8.0) ===
621
622
623 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:470px" %)
624 |=(% style="width: 60px;background-color:#4F81BD;color:white" %)(((
625 **Size(bytes)**
626 )))|=(% style="width: 30px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 100px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 60px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 100px;background-color:#4F81BD;color:white" %)**1**|=(% style="width: 60px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 60px;background-color:#4F81BD;color:white" %)2
627 |(% style="width:97px" %)Value|(% style="width:46px" %)BAT|(% style="width:123px" %)Temperature(DS18B20)|(% style="width:108px" %)(((
628 ADC1(PA0)
629 )))|(% style="width:133px" %)(((
630 Digital in
631 & Digital Interrupt(PB14)
632 )))|(% style="width:159px" %)(((
633 ADC2(PA1)
634 )))|(% style="width:159px" %)(((
635 ADC3(PA4)
636 )))
637
638 [[image:image-20220823164903-2.png]]
639
640
641 === 2.3.9  MOD~=9 3DS18B20+ two Interrupt count mode (the hardware version needs to support 3 interrupt versions, Since firmware v1.8.0) ===
642
643
644 (% style="color:red" %)**Note:**(%%) Power loss or restart will reset the count
645
646 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:520px" %)
647 |=(% style="width: 60px;background-color:#4F81BD;color:white" %)(((
648 **Size(bytes)**
649 )))|=(% style="width: 30px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 80px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 80px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 70px;background-color:#4F81BD;color:white" %)**1**|=(% style="width: 80px;background-color:#4F81BD;color:white" %)**2**|=(% style="width: 60px;background-color:#4F81BD;color:white" %)4|=(% style="width: 60px;background-color:#4F81BD;color:white" %)4
650 |(% style="width:97px" %)Value|(% style="width:46px" %)BAT|(% style="width:123px" %)(((
651 Temperature1(PB3)
652 )))|(% style="width:108px" %)(((
653 Temperature2(PA9)
654 )))|(% style="width:133px" %)(((
655 Digital in
656 & Digital Interrupt(PA4)
657 )))|(% style="width:159px" %)(((
658 Temperature3(PA10)
659 )))|(% style="width:159px" %)(((
660 Count1(PB14)
661 )))|(% style="width:159px" %)(((
662 Count2(PB15)
663 )))
664
665 (% class="wikigeneratedid" id="H" %)
666 [[image:image-20220823165322-3.png]]
667
668
669 (% style="color:blue" %)**The newly added AT command is issued correspondingly:**
670
671 **~1. Set Interrupt Mode:**
672
673 Before using the interrupt function of the **INT** pin, users can set the interrupt triggering mode as required.
674
675 (% style="color:#037691" %)**AT Command:**(% style="color:blue" %)** **(% style="color:#4472c4" %)**AT+INTMODx**
676
677 (% style="color:#4472c4" %)**AT+INTMODx:**
678
679 * (% style="color:#4472c4" %)**AT+INTMOD1   **(%%)~/~/ Set the interrupt mode for (% style="background-color:yellow" %)** PB14**(%%) pin.
680 * (% style="color:#4472c4" %)**AT+INTMOD2   **(%%)~/~/ Set the interrupt mode for (% style="background-color:yellow" %)** PB15**(%%) pin.
681 * (% style="color:#4472c4" %)**AT+INTMOD3   **(%%)~/~/ Set the interrupt mode for (% style="background-color:yellow" %)** PA4**(%%) pin.
682
683 **Parameter setting:**
684
685 * **0:** Disable Interrupt
686 * **1:** Trigger by rising and falling edge
687 * **2:** Trigger by falling edge
688 * **3: **Trigger by rising edge
689
690 **Example:**
691
692 * AT+INTMOD1=0  ~/~/Disable the PB14 pin interrupt function
693 * AT+INTMOD2=2  ~/~/Set the interrupt of the PB15 pin to be triggered by the falling edge
694 * AT+INTMOD3=3  ~/~/Set the interrupt of the PA4 pin to be triggered by the rising edge
695
696 (% style="color:#037691" %)**Downlink Command:**(% style="color:blue" %)** **(% style="color:#4472c4" %)**0x06 00 aa bb**
697
698 Format: Command Code (0x06) followed by 3 bytes.
699
700 (% style="color:#4472c4" %)**aa:**(%%) Set the corresponding pin. ((% style="background-color:yellow" %)**00**(%%): PB14 Pin;  (% style="background-color:yellow" %)**01**(%%)**: **PB15 Pin;  (% style="background-color:yellow" %)**02**(%%): PA4 Pin.)
701
702 (% style="color:#4472c4" %)**bb: **(%%)Set interrupt mode. ((% style="background-color:yellow" %)**00**(%%) Disable, (% style="background-color:yellow" %)**01**(%%) falling or rising, (% style="background-color:yellow" %)**02**(%%) falling, (% style="background-color:yellow" %)**03**(%%) rising)
703
704 **Example:**
705
706 * Downlink Payload: **06 00 00 01     **~/~/ Equal to AT+INTMOD1=1
707 * Downlink Payload: **06 00 01 02     **~/~/ Equal to AT+INTMOD2=2
708 * Downlink Payload: **06 00 02 03     **~/~/ Equal to AT+INTMOD3=3
709
710 **~ 2. Set the counting value:**
711
712 (% style="color:blue" %)**AT+SETCNT=aa,bb** 
713
714 When aa is 1, set the count of PB14 pin to BB Corresponding downlink:09 01 bb bb bb bb
715
716 When aa is 2, set the count of PB15 pin to BB Corresponding downlink:09 02 bb bb bb bb
717
718
719 === 2.3.10  ​Decode payload in The Things Network ===
720
721
722 While using TTN V3 network, you can add the payload format to decode the payload.
723
724
725 [[image:1656378466788-734.png]]
726
727
728 (((
729 The payload decoder function for TTN V3 are here:
730 )))
731
732 (((
733 LSN50 TTN V3 Payload Decoder:  [[https:~~/~~/github.com/dragino/dragino-end-node-decoder>>https://github.com/dragino/dragino-end-node-decoder]]
734 )))
735
736
737 == 2.4 Payload Explanation and Sensor Interface ==
738
739 === 2.4.1 Battery Info ===
740
741
742 (((
743 Check the battery voltage for LSN50.
744 )))
745
746 (((
747 Ex1: 0x0B45 = 2885mV
748 )))
749
750 (((
751 Ex2: 0x0B49 = 2889mV
752 )))
753
754
755 === 2.4.2 Temperature (DS18B20) ===
756
757
758 If there is a DS18B20 connected to PB3 pin. The temperature will be uploaded in the payload.
759
760 More DS18B20 can check the [[3 DS18B20 mode>>||anchor="2.3.4MOD3D4283xDS18B2029"]]
761
762
763 (% style="color:#4472c4" %)**Connection:**
764
765 [[image:1656378573379-646.png]]
766
767
768 (% style="color:#4472c4" %)**Example**:
769
770 If payload is: 0105H:  (0105 & 8000 == 0), temp = 0105H /10 = 26.1 degree
771
772 If payload is: FF3FH :  (FF3F & 8000 == 1) , temp = (FF3FH - 65536)/10 = -19.3 degrees.
773
774 (FF3F & 8000 : Judge whether the highest bit is 1, when the highest bit is 1, it is negative)
775
776
777 === 2.4.3 Digital Input ===
778
779
780 The digital input for pin PA12,
781
782 * When PA12 is high, the bit 1 of payload byte 6 is 1.
783 * When PA12 is low, the bit 1 of payload byte 6 is 0.
784
785 === 2.4.4 Analogue Digital Converter (ADC) ===
786
787
788 (((
789 The ADC pins in LSN50 can measure range from 0~~Vbat, it use reference voltage from STM32. If user need to measure a voltage > VBat, please use resistors to divide this voltage to lower than VBat, otherwise, it may destroy the ADC pin.
790
791 Note: minimum VBat is 2.5v, when batrrey lower than this value. Device won't be able to send LoRa Uplink.
792 )))
793
794
795 (((
796 The ADC monitors the voltage on the PA0 line, in mV.
797 )))
798
799 (((
800 Ex: 0x021F = 543mv,
801 )))
802
803
804 (((
805 (% style="color:#4472c4" %)** Example1:** (%%) Reading an Oil Sensor (Read a resistance value):
806
807
808 )))
809
810 [[image:image-20220627172409-28.png]]
811
812
813 In the LSN50, we can use PB4 and PA0 pin to calculate the resistance for the oil sensor.
814
815
816 (% style="color:blue" %)**Steps:**
817
818 1. Solder a 10K resistor between PA0 and VCC.
819 1. Screw oil sensor's two pins to PA0 and PB4.
820
821 The equipment circuit is as below:
822
823
824 [[image:image-20220627172500-29.png]]
825
826
827 According to above diagram:
828
829 [[image:image-20220628091043-4.png]]
830
831 So
832
833 [[image:image-20220628091344-6.png]]
834
835
836 [[image:image-20220628091621-8.png]] is the reading of ADC. So if ADC=0x05DC=0.9 v and VCC (BAT) is 2.9v
837
838
839 The [[image:image-20220628091702-9.png]] 4.5K ohm
840
841 Since the Bouy is linear resistance from 10 ~~ 70cm.
842
843
844 The position of Bouy is [[image:image-20220628091824-10.png]] , from the bottom of Bouy.
845
846
847 === 2.4.5 Digital Interrupt ===
848
849
850 Digital Interrupt refers to pin PB14, and there are different trigger methods. When there is a trigger, the LSN50 will send a packet to the server.
851
852
853 (((
854 (% style="color:#4472c4" %)** Interrupt connection method:**
855 )))
856
857 [[image:1656379178634-321.png]]
858
859
860 (((
861 (% style="color:#4472c4" %)**Example to use with door sensor : (Requires firmware > 1.5.1)**
862 )))
863
864
865 (((
866 The door sensor is shown at right. It is a two wire magnetic contact switch used for detecting the open/close status of doors or windows.
867 )))
868
869 [[image:1656379210849-860.png]]
870
871
872 (((
873 When the two pieces are close to each other, the 2 wire output will be short or open (depending on the type), while if the two pieces are away from each other, the 2 wire output will be the opposite status. So we can use LSN50 interrupt interface to detect the status for the door or window.
874 )))
875
876
877 (((
878 (% style="color:#4472c4" %)** Below is the installation example:**
879 )))
880
881 (((
882 Fix one piece of the magnetic sensor to the door and connect the two pins to LSN50 as follows:
883 )))
884
885 * (((
886 One pin to LSN50's PB14 pin
887 )))
888 * (((
889 The other pin to LSN50's VCC pin
890 )))
891
892 (((
893 Install the other piece to the door. Find a place where the two pieces will be close to each other when the door is closed. For this particular magnetic sensor, when the door is closed, the output will be short, and PB14 will be at the VCC voltage.
894 )))
895
896
897 (((
898 Door sensors have two types: ** (% style="color:#4472c4" %)NC (Normal close)(%%)** and (% style="color:#4472c4" %)**NO (normal open)**(%%). The connection for both type sensors are the same. But the decoding for payload are reverse, user need to modify this in the IoT Server decoder.
899 )))
900
901 (((
902 When door sensor is shorted, there will extra power consumption in the circuit, the extra current is 3v3/R14 = 3v2/1Mohm = 0.3uA which can be ignored.
903 )))
904
905 [[image:1656379283019-229.png]]
906
907
908 (((
909 The above photos shows the two parts of the magnetic switch fitted to a door.
910 )))
911
912 (((
913 (((
914 The software by default uses the falling edge on the signal line as an interrupt. We need to modify it to accept both the rising edge (0v ~-~-> VCC , door close) and the falling edge (VCC ~-~-> 0v , door open) as the interrupt.
915 )))
916 )))
917
918
919 (((
920 The command is:
921 )))
922
923 (((
924 (% _mstmutation="1" style="color:blue" %)**AT+INTMOD=1 **(% _mstmutation="1" %)** **(%%)~/~/(more info about INMOD please refer(% _mstmutation="1" %)** **(%%)[[**AT Command Manual**>>url:http://www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/&file=DRAGINO_LSN50_AT_Commands_v1.5.1.pdf||_mstmutation="1"]](% _mstmutation="1" %)**. **(%%))
925 )))
926
927
928 (((
929 Below shows some screen captures in TTN V3:
930 )))
931
932 [[image:1656379339508-835.png]]
933
934
935 In MOD=1, user can use byte 6 to see the status for door open or close. TTN V3 decoder is as below:
936
937 (% style="background-color:#dcdcdc" %)door= (bytes[6] & 0x80)? "CLOSE":"OPEN";
938
939
940 (% style="color:red" %)**Notice for hardware version LSN50 v1 < v1.3**(%%) (produced before 2018-Nov).
941
942 In this hardware version, there is no R14 resistance solder. When use the latest firmware, it should set AT+INTMOD=0 to close the interrupt. If user need to use Interrupt in this hardware version, user need to solder R14 with 10M resistor and C1 (0.1uF) on board.
943
944 [[image:1656379563303-771.png]]
945
946
947 === 2.4.6 I2C Interface (SHT20) ===
948
949
950 (((
951 The PB6(SCL) and PB7(SDA) are I2C interface lines. You can use these to connect to an I2C device and get the sensor data.
952 )))
953
954 (((
955 We have made an example to show how to use the I2C interface to connect to the SHT20 Temperature and Humidity Sensor. This is supported in the stock firmware since v1.5 with (% style="color:#4472c4" %)**AT+MOD=1 (default value).**
956
957 (% style="color:red" %)**Notice: Different I2C sensors have different I2C commands set and initiate process, if user want to use other I2C sensors, User need to re-write the source code to support those sensors. SHT20 code in LSN50 will be a good reference.**
958 )))
959
960 (((
961 Below is the connection to SHT20/ SHT31. The connection is as below:
962 )))
963
964
965 [[image:image-20220902163605-2.png]]
966
967
968 The device will be able to get the I2C sensor data now and upload to IoT Server.
969
970 [[image:1656379664142-345.png]]
971
972 Convert the read byte to decimal and divide it by ten.
973
974
975 (% style="color:blue" %)**Example:**
976
977 Temperature:  Read:0116(H) = 278(D)  Value:  278 /10=27.8℃;
978
979 Humidity:    Read:0248(H)=584(D)  Value:  584 / 10=58.4, So 58.4%
980
981
982 If you want to use other I2C device, please refer the SHT20 part source code as reference.
983
984
985 === 2.4.7 ​Distance Reading ===
986
987
988 Refer [[Ultrasonic Sensor section>>||anchor="H2.4.8UltrasonicSensor"]].
989
990
991 === 2.4.8 Ultrasonic Sensor ===
992
993
994 (((
995 The LSN50 v1.5 firmware supports ultrasonic sensor (with AT+MOD=2) such as SEN0208 from DF-Robot. This Fundamental Principles of this sensor can be found at this link: [[https:~~/~~/wiki.dfrobot.com/Weather_-_proof_Ultrasonic_Sensor_with_Separate_Probe_SKU~~_~~__SEN0208>>url:https://wiki.dfrobot.com/Weather_-_proof_Ultrasonic_Sensor_with_Separate_Probe_SKU___SEN0208]]
996 )))
997
998
999 (((
1000 The LSN50 detects the pulse width of the sensor and converts it to mm output. The accuracy will be within 1 centimeter. The usable range (the distance between the ultrasonic probe and the measured object) is between 24cm and 600cm.
1001 )))
1002
1003
1004 (((
1005 The picture below shows the connection:
1006 )))
1007
1008 [[image:1656380061365-178.png]]
1009
1010 Connect to the LSN50 and run (% style="color:blue" %)**AT+MOD=2**(%%) to switch to ultrasonic mode (ULT).
1011
1012 The ultrasonic sensor uses the 8^^th^^ and 9^^th^^ byte for the measurement value.
1013
1014
1015 (% style="color:blue" %)**Example:**
1016
1017 Distance:  Read: 0C2D(Hex) = 3117(D)  Value:  3117 mm=311.7 cm
1018
1019 [[image:1656384895430-327.png]]
1020
1021
1022 [[image:1656384913616-455.png]]
1023
1024
1025 You can see the serial output in ULT mode as below:
1026
1027 [[image:1656384939855-223.png]]
1028
1029
1030 **In TTN V3 server:**
1031
1032 [[image:1656384961830-307.png]]
1033
1034
1035 [[image:1656384973646-598.png]]
1036
1037
1038 === 2.4.9  Battery Output - VDD pin ===
1039
1040
1041 The VDD pin of LSN50v2 is connected to the Battery directly. If users want to use VDD pin to power an external sensor. User need to make sure the external sensor is of low power consumption. Because the VDD pin is always open. If the external sensor is of high power consumption. the battery of LSN50v2 will run out very soon.
1042
1043
1044 === 2.4.10  +5V Output ===
1045
1046
1047 Since v1.2 hardware version, a +5v output is added in the hardware. The +5V output will be valid for every sampling.  LSN50 will enable +5V output before all sampling and disable the +5v after all sampling. 
1048
1049
1050 (((
1051 Since firmware (% style="color:red" %)**v1.6.3**(%%), The 5V output time can be controlled by AT Command.
1052 )))
1053
1054 (((
1055 (% style="color:#4472c4" %)**AT+5VT=1000**
1056 )))
1057
1058 (((
1059 Means set 5V valid time to have 1000ms. So the real 5V output will actually have 1000ms + sampling time for other sensors.
1060 )))
1061
1062
1063 (((
1064 By default the AT+5VT=500. 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.
1065 )))
1066
1067
1068 === 2.4.11  Weigh Sensor HX711 ===
1069
1070
1071 Since v1.6.2 firmware, LSN50 support Weigh Sensor HX711.
1072
1073
1074 === 2.4.12  BH1750 Illumination Sensor ===
1075
1076
1077 Since v1.7.0 firmware, MOD=1 support this sensor. The sensor value is in the 8^^th^^ and 9^^th^^ bytes.
1078
1079 [[image:image-20220628110012-11.jpeg]]
1080
1081
1082 [[image:image-20220628110012-12.png]]
1083
1084
1085 === 2.4.13  Working MOD ===
1086
1087
1088 (((
1089 The working MOD info is contained in the Digital in & Digital Interrupt byte (7^^th^^ Byte).
1090 )))
1091
1092 (((
1093 User can use the 3^^rd^^ ~~ 7^^th^^  bit of this byte to see the working mod:
1094 )))
1095
1096 (((
1097 Case 7^^th^^ Byte >> 2 & 0x1f:
1098 )))
1099
1100 * 0: MOD1
1101 * 1: MOD2
1102 * 2: MOD3
1103 * 3: MOD4
1104 * 4: MOD5
1105 * 5: MOD6
1106
1107 == 2.5 Configure LSN50 via AT or Downlink ==
1108
1109
1110 (((
1111 User can configure LSN50 via [[AT Commands >>||anchor="H3.A0UsingtheATCommands"]]or LoRaWAN Downlink Commands
1112 )))
1113
1114 (((
1115 There are two kinds of Commands:
1116 )))
1117
1118 * (% _mstmutation="1" style="color:blue" %)**Common Commands**(%%): They should be available for each sensor, such as: change uplink interval, reset device. For firmware v1.7.0, user can find what common commands it supports:  [[End Device AT Commands>>doc:Main.End Device AT Commands and Downlink Command.WebHome||_mstmutation="1"]]
1119
1120 * (% style="color:blue" %)**Sensor Related Commands**(%%): These commands are special designed for LSN50.  User can see these commands below:
1121
1122 === 2.5.1 Common Commands: ===
1123
1124
1125 They should be available for each of Dragino Sensors, such as: change uplink interval, reset device. For firmware v1.7.0, user can find what common commands it supports: [[End Device AT Commands>>doc:Main.End Device AT Commands and Downlink Command.WebHome]]
1126
1127
1128 === 2.5.2 Sensor related commands: ===
1129
1130
1131 (% style="color:blue" %)**Set work mode:**
1132
1133 * (% style="color:#037691" %)**AT Command:**
1134
1135 (((
1136 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+MOD=2 **(%%) ~/~/ Set work MOD =2. (1: IIC mode, 2: Distance mode, 3: 3ADC mode, 4: 3DS18B20 mode, 5: weight mode)
1137 )))
1138
1139 (((
1140 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+MOD=?** (%%) ~/~/  Get current work MOD
1141 )))
1142
1143
1144 * (% style="color:#037691" %)**Downlink Payload:**
1145
1146 (% style="background-color:#dcdcdc" %)**0x0A aa** (%%) ~/~/ Same as AT+MOD=aa
1147
1148
1149
1150 (% style="color:blue" %)**Set the trigger interrupt mode:**
1151
1152 * (% style="color:#037691" %)**AT Command:**
1153
1154 (((
1155 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+INTMOD=2**  (%%) ~/~/ Set INTMOD =2. (0: Disable, 1:falling or rising, 2: falling, 3: rising)
1156 )))
1157
1158 (((
1159 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+INTMOD=?**  (%%) ~/~/  Get current INTMOD
1160 )))
1161
1162
1163 * (% style="color:#037691" %)**Downlink Payload:**
1164
1165 (% style="background-color:#dcdcdc" %)**0x06 000003**      (%%) ~/~/ Set AT+INTMOD=3
1166
1167
1168
1169 (% style="color:blue" %)**Set the 5V power open time during sampling:**
1170
1171 * (% style="color:#037691" %)**AT Command:**
1172
1173 (((
1174 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+5VT=1000** (%%) ~/~/ Set 5v open time to 1000ms
1175 )))
1176
1177 (((
1178 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+5VT=?**    (%%) ~/~/  Check current 5v open duration
1179 )))
1180
1181
1182 * (% style="color:#037691" %)**Downlink Payload:**
1183
1184 (% style="background-color:#dcdcdc" %)**0x07 aa bb**    (%%) ~/~/ Equal AT+5VT=0x(aa bb)
1185
1186
1187
1188 (% style="color:blue" %)**Set the weight to 0g (Zero Calibration):**
1189
1190 * (% style="color:#037691" %)**AT Command:**
1191
1192 (% style="background-color:#dcdcdc" %)**AT+WEIGRE** ** **(%%)** **~/~/ Set the weight to 0g
1193
1194
1195 * (% style="color:#037691" %)**Downlink Payload:**
1196
1197 (% style="background-color:#dcdcdc" %)**0x08 01** (%%) ~/~/ Set the weight to 0g
1198
1199
1200
1201 (% style="color:blue" %)**Get or Set the GAP Value (calibrate factor) of measurement:**
1202
1203 * (% style="color:#037691" %)**AT Command:**
1204
1205 (((
1206 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+WEIGAP=403.0**  (%%) ~/~/ Set GAP Value =403.0 (response: Weight: xx g)
1207 )))
1208
1209 (((
1210 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+WEIGAP=?**  (%%) ~/~/  Get current GAP Value
1211 )))
1212
1213
1214 * (% style="color:#037691" %)**Downlink Payload:**
1215
1216 (% style="background-color:#dcdcdc" %)**0x08 02 aa bb** (%%) ~/~/ Equal to AT+WEIGAP=0x(aa bb)/10
1217
1218
1219
1220 (% style="color:blue" %)**Encrypt upload:**
1221
1222 * (% style="color:#037691" %)**AT Command:**
1223
1224 (((
1225 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+DECRYPT=1**  (%%) ~/~/ The payload is uploaded without encryption
1226 )))
1227
1228 (((
1229 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+DECRYPT=0**  (%%) ~/~/  Encrypt when uploading payload (default)
1230 )))
1231
1232
1233
1234 (% style="color:blue" %)**Get data:**
1235
1236 * (% style="color:#037691" %)**AT Command:**
1237
1238 (((
1239 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+GETSENSORVALUE=0** (%%) ~/~/ The serial port gets the reading of the current sensor
1240 )))
1241
1242 (((
1243 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+GETSENSORVALUE=1** (%%) ~/~/  The serial port gets the current sensor reading and uploads it.
1244
1245
1246
1247 (% style="color:blue" %)**Resets the downlink packet count:**
1248
1249 * (% style="color:#037691" %)**AT Command:**
1250
1251 (((
1252 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+DISFCNTCHECK=0**(% _mstmutation="1" %)**     **(%%) ~/~/(% _mstmutation="1" %)** **(%%)When the downlink packet count sent by the server is less than the node downlink packet count or exceeds 16384, the node will no longer receive downlink packets (default)
1253 )))
1254
1255 (((
1256 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+DISFCNTCHECK=1** (%%) ~/~/  When the downlink packet count sent by the server is less than the node downlink packet count or exceeds 16384, the node resets the downlink packet count and keeps it consistent with the server downlink packet count
1257 )))
1258
1259
1260
1261 (% style="color:blue" %)**When the limit bytes are exceeded, upload in batches:**
1262
1263 * (% style="color:#037691" %)**AT Command:**
1264
1265 (((
1266 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+DISMACANS=0**(%%)  ~/~/ When the MACANS of the reply server plus the payload exceeds the maximum number of bytes of 11 bytes (DR0 of US915, DR2 of AS923, DR2 of AU195), the node will send a packet with a payload of 00 and a port of 4. (default)
1267 )))
1268
1269 (((
1270 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+DISMACANS=1** (%%) ~/~/ When the MACANS of the reply server plus the payload exceeds the maximum number of bytes of the DR, the node will ignore the MACANS and not reply, and only upload the payload part.
1271 )))
1272
1273 * (% style="color:#037691" %)**Downlink Payload:**
1274
1275 (% class="wikigeneratedid" %)
1276 (% style="background-color:#dcdcdc" %)**0x21 00 01 ** (%%) ~/~/ Set  the DISMACANS=1
1277
1278
1279
1280 (% style="color:blue" %)**Copy downlink to uplink:**
1281
1282 * (% style="color:#037691" %)**AT Command:**
1283
1284 (((
1285 (% _mstmutation="1" style="background-color:#dcdcdc" %)**AT+RPL=5**(%%)  ~/~/ After receiving the package from the server, it will immediately upload the content of the package to the server, the port number is 100.
1286 )))
1287
1288 (% class="wikigeneratedid" %)
1289 Example: (% style="background-color:#dcdcdc" %)**aa xx xx xx xx** (%%) ~/~/ aa indicates whether the configuration has changed, 00 is yes, 01 is no; xx xx xx xx are the bytes sent.
1290
1291
1292 (% class="wikigeneratedid" %)
1293 [[image:image-20220823173747-6.png||height="165" width="1124"]]
1294
1295 **For example, sending 11 22 33 44 55 66 77 will return invalid configuration 00 11 22 33 44 55 66 77.**
1296
1297
1298
1299 [[image:image-20220823173833-7.png||height="149" width="1124"]]
1300
1301 **For example, if 01 00 02 58 is issued, a valid configuration of 01 01 00 02 58 will be returned.**
1302
1303
1304
1305 (% style="color:blue" %)**Query version number and frequency band 、TDC:**
1306
1307 * (((
1308 (% style="color:#037691" %)**Downlink: 26 01  **(%%) ~/~/  Downlink 26 01 can query device upload frequency, frequency band, software version number, TDC time.
1309 )))
1310
1311 **Example:**
1312
1313
1314 [[image:image-20220823173929-8.png||height="76" width="1205"]]
1315
1316
1317
1318 (% style="color:blue" %)**Add rejoin feature if device offline: (Since V1.8.0)**
1319
1320 * (% style="color:#037691" %)**AT Command:**
1321
1322 **AT+DDETECT=<Flag>,<ACK_Timout_1>,<ACK_Timout_2>    (Default Value: AT+DDETECT=1,1440,2880)**
1323
1324 (% style="color:red" %)**Flag:** (%%) 1 Enable online detect, 0: Disable online detect
1325
1326 (% style="color:red" %)**ACK_Timout_1:**(%%) Unit: min
1327
1328 (% style="color:red" %)**ACK_Timout_2:**(%%) Unit: min
1329
1330
1331 **Example: AT+DDETECT=1,1440,2880**
1332
1333 Enable Online Detect, if end node doesn't receive any downlink within ACK_Timout_1( 1440 minutes or 24 hours). End node will use confirmed uplink to send packets during ACK_Timout_1 (the 24th hour) to ACK_Timout_2 ( the 48th hour).
1334
1335 If from the 24th to 48th hour, end node got an downlink from server, it will switch back to unconfirmed uplink. end node will restart ACK_Timout_1.
1336
1337 If from the 24th to 48th hour, end node still not got any downlink, means device doesn't get ACK in 48 hours. Device will process rejoin, rejoin request interval is AT+RJTDC period. For AU915/ US915, device will use the sub-band used for last join.
1338
1339
1340 * (((
1341 (% style="color:#037691" %)**Downlink: 0x32 01 05A0 0B40 **
1342
1343 0x01 : Flag
1344
1345 0x05A0: ACK_Timout_1
1346
1347 0x0B40: ACK_Timout_2
1348
1349
1350
1351 )))
1352
1353 (% class="wikigeneratedid" %)
1354 (% style="color:blue" %)**Add new feature to control NBTrans for unconfirmed uplink mode:**
1355
1356 * (% style="color:#037691" %)**AT Command:**
1357
1358 (% style="background-color:#dcdcdc" %)** AT+SETMAXNBTRANS=value1,value2   **(%%)** **~/~/ NBTrans specified how many re-transmission for each packet. If LoRaWAN LinkADR from server set NBTrans to high value. The battery will consume fast.
1359
1360 **AT+SETMAXNBTRANS=value1,value2 Default Value: AT+SETMAXNBTRANS=1,0**
1361
1362 (% style="color:red" %)**value1:** (%%) Set max NBTrans. For example, if value1(NBTrans)=1, end node set NBTrans max to 1 , even downlink LinkADR request end node to set NBTrans to higher value such as 6.
1363
1364 (% style="color:red" %)**value2:** (%%) 0: uplink fcnt doesn't change for each NBTrans;  1: uplink fcnt increase by 1 for each NBTrans.
1365
1366 set value2 to 1 for Chirpstack server, because Chirpstack will ignore same FCNT in re-transmission.
1367
1368
1369 **Example: AT+SETMAXNBTRANS=2,1**
1370
1371 Set max NBTrans to 2, fcnt will increase +1 for each NBTrans
1372
1373
1374 * (((
1375 (% style="color:#037691" %)**Downlink: 0x33 02 01**
1376
1377 value1=0x02
1378 )))
1379
1380 (% class="wikigeneratedid" %)
1381 value2=0x01
1382
1383
1384 == 2.6 Show Data in Datacake IoT Server ==
1385
1386
1387 (((
1388 Datacake provides a human friendly interface to show the sensor data, once we have data in TTN V3, we can use Datacake to connect to TTN V3 and see the data in Datacake. Below are the steps:
1389 )))
1390
1391 (((
1392 (% style="color:blue" %)**Step 1**(%%)**:** Be sure that your device is programmed and properly connected to the network at this time.
1393 )))
1394
1395 (((
1396 (% style="color:blue" %)**Step 2**(%%)**:** To configure the Application to forward data to Datacake you will need to add integration. To add the Datacake integration, perform the following steps:
1397 )))
1398
1399 [[image:1656385623971-339.png]]
1400
1401
1402 [[image:1656385646347-395.png]]
1403
1404
1405 [[image:1656385662459-942.png]]
1406
1407
1408 (% style="color:blue" %)**Step 3**(%%)**: **Create an account or log in Datacake.
1409
1410 (% style="color:blue" %)**Step 4**(%%)**:** Search the LSN50 and add DevEUI.
1411
1412 [[image:1656385688973-317.png]]
1413
1414
1415 == 2.7 ​Firmware Change Log ==
1416
1417
1418 (((
1419 **Firmware download: ** [[https:~~/~~/www.dropbox.com/scl/fo/e8tj75c12ecumt4qvx3w0/APfXGCagGqiDYqkl7cnItlk?rlkey=tfltr3b4xsa7gp0wg5silkpcw&st=yeqslbpz&dl=0>>https://www.dropbox.com/scl/fo/e8tj75c12ecumt4qvx3w0/APfXGCagGqiDYqkl7cnItlk?rlkey=tfltr3b4xsa7gp0wg5silkpcw&st=yeqslbpz&dl=0]]
1420 )))
1421
1422 (((
1423 **Firmware Change Log: **[[https:~~/~~/www.dropbox.com/scl/fo/e8tj75c12ecumt4qvx3w0/APfXGCagGqiDYqkl7cnItlk?rlkey=tfltr3b4xsa7gp0wg5silkpcw&st=yeqslbpz&dl=0>>https://www.dropbox.com/scl/fo/e8tj75c12ecumt4qvx3w0/APfXGCagGqiDYqkl7cnItlk?rlkey=tfltr3b4xsa7gp0wg5silkpcw&st=yeqslbpz&dl=0]]
1424
1425
1426 )))
1427
1428 == 2.8 Use VDD or +5V to Power External Sensor ==
1429
1430
1431 (((
1432 User can use VDD or +5V to power external sensor.
1433 )))
1434
1435 (((
1436 (% style="color:red" %)**Note:**
1437 )))
1438
1439 1. (((
1440 VDD is 2.5~~3.3v from the battery + diode, the VDD is always on, so when use VDD to power external sensor, make sure the sensor has a low power consumption in sleep mode ( less 50 uA) to get a long battery life.
1441 )))
1442 1. (((
1443 +5V output is only ON when sampling. And MCU will turn off it after sampling. So if sensor can support 5v, +5V out is the best choice. [[See here for more info>>||anchor="H2.4.10A02B5VOutput"]].
1444 )))
1445
1446 (((
1447 (% style="color:red" %)**Note: Always test the actually current pass by the JP2 jumper when connect to a new type of sensor.**
1448 )))
1449
1450
1451 == 2.9  Battery & Power Consumption ==
1452
1453
1454 LSN50v2 uses ER26500 + SPC1520 battery pack. See below link for detail information about the battery info and how to replace.
1455
1456 [[**Battery Info & Power Consumption Analyze**>>url:http://wiki.dragino.com/xwiki/bin/view/Main/How%20to%20calculate%20the%20battery%20life%20of%20Dragino%20sensors%3F/]] .
1457
1458
1459 = 3.  Using the AT Commands =
1460
1461 == 3.1  Access AT Commands ==
1462
1463
1464 LSN50 supports AT Command set in the stock firmware. You can use a USB to TTL adapter to connect to LSN50 for using AT command, as below.
1465
1466
1467 (% style="color:#4472c4" %)**LSN50 v1 UART connection photo**
1468
1469 [[image:image-20220627165424-24.png||height="495" width="486"]]
1470
1471
1472 (% style="color:#4472c4" %)**LSN50 v2 UART connection photo**
1473
1474 [[image:image-20220627165424-25.png||height="437" width="894"]]
1475
1476
1477 (((
1478 In the PC, you need to set the serial baud rate to (% style="color:green" %)**9600**(%%) to access the serial console for LSN50. LSN50 will output system info once power on as below:
1479 )))
1480
1481 [[image:image-20220627165531-26.png||height="624" width="893"]](% style="display:none" %)
1482
1483
1484 == 3.2  Common AT Command Sequence ==
1485
1486 === 3.2.1  Multi-channel ABP mode (Use with SX1301/LG308) ===
1487
1488
1489 (((
1490 (% style="color:#037691" %)**If device has not joined network via OTAA:**
1491 )))
1492
1493 (((
1494 (% style="background-color:#dcdcdc" %)**AT+FDR**
1495 )))
1496
1497 (((
1498 (% style="background-color:#dcdcdc" %)**AT+NJM=0**
1499 )))
1500
1501 (((
1502 (% style="background-color:#dcdcdc" %)**ATZ**
1503 )))
1504
1505
1506 (((
1507 (% style="color:#037691" %)**If device already joined network:**
1508 )))
1509
1510 (((
1511 (% style="background-color:#dcdcdc" %)**AT+NJM=0**
1512 )))
1513
1514 (((
1515 (% style="background-color:#dcdcdc" %)**ATZ**
1516 )))
1517
1518
1519 === 3.2.2  Single-channel ABP mode (Use with LG01/LG02) ===
1520
1521
1522 See [[Sect 6.7>>||anchor="H6.7A0HowtoconfiguretheEUIkeysinLSN503F"]]
1523
1524
1525 = 4.  Upload Firmware =
1526
1527
1528 (% style="color:red" %)**Notes**:
1529
1530 * Since image v1.3, the firmware will show version info during boot. If your device doesn't show version info, you may have a very old image version.
1531 * Always run AT+FDR to reset parameters to factory default after an update image.
1532 If the update is from image >= v1.3 to another image version >=v1.3, then the keys will be kept after running AT+FDR.
1533 Otherwise (e.g. from v1.2 to v1.3), AT+FDR may erase the keys.
1534
1535 == 4.1  Upload Firmware via Serial Port ==
1536
1537
1538 The LSN50's AT Command port can be used for firmware upgrade. The hardware connection for upgrade firmware is as below:
1539
1540 [[image:image-20220627163506-18.png||height="426" width="418"]]
1541
1542
1543 (% style="color:blue" %)**Step1**(%%)**:** Download [[flash loader>>url:https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/flasher-stm32.html]].
1544
1545 (% style="color:blue" %)**Step2**(%%)**:** Download the [[LSN50 Image files>>https://www.dropbox.com/scl/fo/e8tj75c12ecumt4qvx3w0/APfXGCagGqiDYqkl7cnItlk?rlkey=tfltr3b4xsa7gp0wg5silkpcw&st=5xb2s2ij&dl=0]].
1546
1547 (% style="color:blue" %)**Step3**(%%)**: **Open flashloader; choose the correct COM port to update
1548
1549 [[image:image-20220627163821-19.png]]
1550
1551
1552 [[image:image-20220627163930-20.png||height="450" width="751"]]
1553
1554
1555 [[image:image-20220627164030-21.png||height="459" width="750"]]
1556
1557
1558 (((
1559 (% style="color:blue" %)**Step4**(%%)**: **Switch SW1 back to flash state and push the RESET button.
1560 )))
1561
1562 (((
1563 The LSN50 will then run the new firmware.
1564 )))
1565
1566
1567 == 4.2  Upload Firmware via ST-Link V2 ==
1568
1569
1570 You can use ST-LINK to upgrade firmware into LSN50. The hardware connection for upgrade firmware is as below:
1571
1572 [[image:1656319349131-664.png]]
1573
1574
1575 (% style="color:blue" %)**Connection:**
1576
1577 * (% style="background-color:yellow" %)**ST-LINK v2 GND  <~-~-> LSN50 GND**
1578 * (% style="background-color:yellow" %)**ST-LINK v2 SWCLK <~-~-> LSN50 PA14**
1579 * (% style="background-color:yellow" %)**ST-LINK v2 SWDIO <~-~-> LSN50 PA13**
1580 * (% style="background-color:yellow" %)**ST-LINK v2 RST  <~-~->  LSN50 NRST**
1581
1582 (% style="color:blue" %)**Step1:**(%%) Install [[ST-LINK driver>>url:https://www.stmicroelectronics.com.cn/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-utilities/stsw-link009.html]] first and then install [[ST-LINK Utility>>url:https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link004.html]]
1583
1584 (% style="color:blue" %)**Step2**(%%): Download the [[LSN50 Image files>>url:https://github.com/dragino/LoRa_STM32/tree/master/LSN50.hex]].
1585
1586 (% style="color:blue" %)**Step3:**(%%)** **Open ST-LINK utility, (% style="color:blue" %)**file ~-~-> open file**(%%) to select the image to be upgraded.
1587
1588 (% style="color:blue" %)**Step4:**(%%)** **Click the “(% style="color:blue" %)**Program Verify**”(%%) button on ST-LINK.
1589
1590 [[image:image-20220627164303-22.png]]
1591
1592
1593 (((
1594 (% style="color:blue" %)**Step5:**(%%)** **The led on the ST-LINK adapter will now blinking, and the ST-Link utility will pop up a download window. Click the start button to download the image to LSN50.
1595 )))
1596
1597 (((
1598 (% style="color:red" %)**NOTE: If this step fails, ST-LINK can't establish connection to LSN50, please try to swap SWDIO & SWCLK pin. Some ST-LINK v2 devices are incorrectly marked.**
1599 )))
1600
1601
1602 [[image:image-20220627164303-23.png]]
1603
1604
1605 = 5.  Developer Guide =
1606
1607
1608 * (((
1609 Software Source Code Download : [[https:~~/~~/github.com/dragino/LoRa_STM32/tree/master/STM32CubeExpansion_LRWAN>>https://github.com/dragino/LoRa_STM32/tree/master/STM32CubeExpansion_LRWAN]]
1610 )))
1611 * (((
1612 Hardware Source Code Download: [[https:~~/~~/github.com/dragino/Lora/tree/master/LSN50>>https://github.com/dragino/Lora/tree/master/LSN50]]
1613 )))
1614
1615 (((
1616 LSN50 is an open source project, developer can use compile their firmware for customized applications. User can get the source code from:
1617 )))
1618
1619 * (((
1620 Software Source Code: [[https:~~/~~/github.com/dragino/LoRa_STM32/tree/master/STM32CubeExpansion_LRWAN>>url:https://github.com/dragino/LoRa_STM32/tree/master/STM32CubeExpansion_LRWAN||_mstmutation="1"]]
1621 )))
1622 * (((
1623 Hardware Design files:  [[https:~~/~~/github.com/dragino/Lora/tree/master/LSN50>>url:https://github.com/dragino/Lora/tree/master/LSN50]]
1624 )))
1625 * (((
1626 Compile instruction:  [[http:~~/~~/wiki.dragino.com/xwiki/bin/view/Main/Firmware%20Compile%20Instruction%20~~-~~-%20STM32/>>http://wiki.dragino.com/xwiki/bin/view/Main/Firmware%20Compile%20Instruction%20--%20STM32/]]
1627 )))
1628
1629 (((
1630 Use Keil to open project file:
1631 )))
1632
1633 (((
1634 STM32CubeExpansion_LRWAN/Projects/Multi/Applications/LoRa/DRAGINO-LRWAN(AT)/MDK-ARM/STM32L072CZ-Nucleo/Lora.uvprojx
1635 )))
1636
1637 (((
1638
1639 )))
1640
1641 (((
1642 In Keil, you can see what frequency band the code support.
1643 )))
1644
1645 [[image:image-20220627162417-15.png]]
1646
1647
1648 **~1. If you want to change frequency, modify the Preprocessor Symbols.**
1649
1650
1651 For example, change EU868 to US915
1652
1653 [[image:1656318662202-530.png]]
1654
1655
1656 **2. Compile and build**
1657
1658 [[image:image-20220627163212-17.png]]
1659
1660
1661 = 6.  FAQ =
1662
1663 == 6.1  Why there is 433/868/915 version? ==
1664
1665
1666 (((
1667 Different countries have different rules for the ISM band for LoRa. Although the LoRa chip can support a wide range of Frequencies, we provide different versions of the hardware for best tune of the LoRa hardware part.
1668 )))
1669
1670
1671 == 6.2 What is the frequency range of LT LoRa part? ==
1672
1673
1674 Different LT version supports different frequency range, below is the table for the working frequency and recommend bands for each model:
1675
1676 [[image:image-20220627155456-9.png]]
1677
1678
1679 == 6.3  How to change the LoRa Frequency Bands/Region? ==
1680
1681
1682 You can follow the instructions for [[how to upgrade image>>||anchor="H2.7200BFirmwareChangeLog"]].
1683 When downloading the images, choose the required image file for download.
1684
1685
1686 == 6.4  Can I use Private LoRa protocol? ==
1687
1688
1689 (((
1690 (((
1691 The stock firmware is based on LoRaWAN protocol. You can use a private LoRa protocol in LSN50. This section describes an example for base LoRa transfer. It is a reference/demo and we do not provide further software development support on this topic.
1692 )))
1693
1694 (((
1695 In this demo, we will show the communication between LoRa Shield and LSN50, both of them using the basic LoRa library. LSN50 will send a message to a LoRa Shield and the LoRa Shield will print it to the console.
1696 )))
1697
1698
1699 )))
1700
1701 (% style="color:#4472c4" %)**LoRa Shield + UNO**:
1702
1703 Use the [[LoRa Library>>url:http://www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/LoRa_Raw_Example/Arduino/&file=LoRa.zip]] and upload the [[LoRa Receive>>http://www.dragino.com/downloads/downloads/LSN50-LoRaST/LoRa_Raw_Example/Arduino/LoRaReceiver.ino]] Sketch to Arduino.
1704
1705
1706 Refs:  [[https:~~/~~/www.dropbox.com/sh/u9s41qdx5yujwcb/AAAT5r4QkMaeOogWrzJt7Wn4a?dl=0>>https://www.dropbox.com/sh/u9s41qdx5yujwcb/AAAT5r4QkMaeOogWrzJt7Wn4a?dl=0]]
1707
1708
1709 Open the serial monitor to Arduino. The device acts as a LoRa Receiver and listen on the frequency 868.3Mhz by default.
1710
1711
1712 (% style="color:#4472c4" %)**LSN50**:
1713
1714 Use the <[[LoRa RAW code>>url:http://www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/LoRa_Raw_Example/LSN50/&file=lora_send.zip]]> . The project file is in: MDK-ARM\STM32L072CZ-Nucleo\ Lora.uvprojx
1715
1716 Compile it and Upload it to LSN50, the LSN50 will transfer on the frequency 868.3Mhz.
1717
1718 In the Arduino Console, it will see the received packets as below.
1719
1720
1721 [[image:image-20220627160116-10.png]]
1722
1723
1724 == 6.5  How to set up LSN50 to work in 8 channel mode ==
1725
1726
1727 (((
1728 By default, the frequency bands US915, AU915, CN470 work in 72 frequencies. Many gateways are 8 channel gateways, and in this case, the OTAA join time and uplink schedule is long and unpredictable while the end node is hopping in 72 frequencies.
1729 )))
1730
1731 (((
1732 You can configure the end node to work in 8 channel mode by using the AT+CHE command. The 500kHz channels are always included for OTAA.
1733 )))
1734
1735 (((
1736
1737 )))
1738
1739 (((
1740 For example, in (% style="color:blue" %)**US915**(%%) band, the frequency table is as below. By default, the end node will use all channels (0~~71) for OTAA Join process. After the OTAA Join, the end node will use these all channels (0~~71) to send uplink packets.
1741 )))
1742
1743 [[image:image-20220627160940-13.png]]
1744
1745
1746 (((
1747 When you use the TTN V3 network, the US915 frequency bands use are:
1748 )))
1749
1750 * (((
1751 903.9 - SF7BW125 to SF10BW125
1752 )))
1753 * (((
1754 904.1 - SF7BW125 to SF10BW125
1755 )))
1756 * (((
1757 904.3 - SF7BW125 to SF10BW125
1758 )))
1759 * (((
1760 904.5 - SF7BW125 to SF10BW125
1761 )))
1762 * (((
1763 904.7 - SF7BW125 to SF10BW125
1764 )))
1765 * (((
1766 904.9 - SF7BW125 to SF10BW125
1767 )))
1768 * (((
1769 905.1 - SF7BW125 to SF10BW125
1770 )))
1771 * (((
1772 905.3 - SF7BW125 to SF10BW125
1773 )))
1774 * (((
1775 904.6 - SF8BW500
1776 )))
1777
1778 (((
1779 Because the end node is now hopping in 72 frequency, it makes it difficult for the devices to Join the TTN V3 network and uplink data. To solve this issue, you can access the device via the AT commands and run:
1780 )))
1781
1782 (((
1783 (% style="color:blue" %)**AT+CHE=2**
1784 )))
1785
1786 (((
1787 (% style="color:blue" %)**ATZ**
1788 )))
1789
1790
1791 (((
1792 to set the end node to work in 8 channel mode. The device will work in Channel 8-15 & 64-71 for OTAA, and channel 8-15 for Uplink.
1793 )))
1794
1795 (((
1796 The (% style="color:blue" %)**AU915**(%%) band is similar. Below are the AU915 Uplink Channels.
1797 )))
1798
1799 [[image:image-20220627161124-14.png]]
1800
1801
1802 == 6.6  How to set up LSN50 to work with Single Channel Gateway such as LG01/LG02? ==
1803
1804
1805 (((
1806 In this case, users need to set LSN50 to work in ABP mode and transmit in only one frequency.
1807 )))
1808
1809 (((
1810 Assume we have a LG02 working in the frequency 868400000 now, below is the steps.
1811 )))
1812
1813
1814 (((
1815 (% style="color:blue" %)**Step1: **(%%)Log in TTN V3, Create an ABP device in the application and input the network session key (NETSKEY), app session key (APPSKEY) from the device.
1816 )))
1817
1818
1819 [[image:image-20220627160542-11.png]]
1820
1821
1822 (((
1823 (% style="color:red" %)**Note: You need to make sure the above three keys match in the device and in TTN V3. You can change them either in TTN V3 or in the Device to make them match. In TTN V3, NETSKEY and APPSKEY can be configured in the setting page, but the Device Addr is generated by TTN V3.**
1824 )))
1825
1826
1827 (((
1828 (% style="color:red" %)**You can also change the Device ADDR in TTN V3 by using the [[The Things Network CLI>>url:https://www.thethingsnetwork.org/docs/network/cli/quick-start.html]].**
1829 )))
1830
1831
1832 (((
1833 (% style="color:blue" %)**Step2:  **(%%)Run AT commands to make the LSN50 work in Single frequency and ABP mode. Below are the AT commands:
1834 )))
1835
1836
1837 (((
1838 (% style="background-color:#dcdcdc" %)AT+FDR(%%)  :  Reset Parameters to Factory Default, Keys Reserve
1839 )))
1840
1841 (((
1842 (% style="background-color:#dcdcdc" %)AT+NJM=0(%%) : Set to ABP mode
1843 )))
1844
1845 (((
1846 (% style="background-color:#dcdcdc" %)AT+ADR=0(%%) : Set the Adaptive Data Rate Off
1847 )))
1848
1849 (((
1850 (% style="background-color:#dcdcdc" %)AT+DR=5(%%)  : Set Data Rate (Set AT+DR=3 for 915 band)
1851 )))
1852
1853 (((
1854 (% style="background-color:#dcdcdc" %)AT+TDC=300000(%%)  :  Set transmit interval to 5 minutes
1855 )))
1856
1857 (((
1858 (% style="background-color:#dcdcdc" %)AT+CHS=868400000(%%) : Set transmit frequency to 868.4Mhz
1859 )))
1860
1861 (((
1862 (% style="background-color:#dcdcdc" %)AT+DADDR=26 01 1A F1(%%)  :Set Device Address to 26 01 1A F1
1863 )))
1864
1865 (((
1866 (% style="background-color:#dcdcdc" %)ATZ(%%)  :  Reset MCU
1867 )))
1868
1869
1870 (((
1871 As shown  below:
1872 )))
1873
1874 [[image:image-20220627160542-12.png]]
1875
1876
1877 == 6.7  How to configure the EUI keys in LSN50? ==
1878
1879
1880 (((
1881 The early version of LSN50 firmware doesn't have pre-configured keys.
1882 It is recommended that you update the image to the latest version before configure the keys. Refer [[upgrade_image>>||anchor="H2.7200BFirmwareChangeLog"]] to update the firmware to the latest version.
1883
1884 Run AT commands to set the keys to desired keys; refer [[AT Command manual>>https://www.dragino.com/downloads/downloads/LSN50-LoRaST/DRAGINO_LSN50_AT_Commands_v1.6.3.pdf]].
1885
1886
1887 (((
1888
1889 )))
1890
1891 == 6.8 Why can't users switch working modes? ==
1892
1893
1894 LSN50v2 and LSNS0v2-S31B use different firmware. If the user purchased LSN50V2-S31B, the working mode cannot be switched according to this manual.
1895
1896 LSN50v2 and LSN50V2-S31b use the same motherboard, users can refer to the following burning instructions to change the LSN50V2-S31B firmware to LSN50v2.
1897
1898 [[Firmware Upgrade Instruction for STM32 base products - DRAGINO>>url:http://wiki.dragino.com/xwiki/bin/view/Main/Firmware%20Upgrade%20Instruction%20for%20STM32%20base%20products/#H3.1.2LSN50v22FLSN50v2-D222FLSN50v2-D232FLSN50v2-S31B]]
1899
1900
1901 )))
1902
1903 = 7.  Trouble Shooting =
1904
1905 == 7.1  Connection problem when uploading firmware. ==
1906
1907
1908 (((
1909 (% style="color:red" %)**Issue**(%%): While using USB to TTL to upload firmware via UART interface. It works for several times but most of times it fails.
1910 )))
1911
1912 (((
1913
1914 )))
1915
1916 (((
1917 (% style="color:green" %)**Checklist**:
1918 )))
1919
1920 (((
1921 ~1. Double check if follow up exactly the steps as manual.
1922 )))
1923
1924 (((
1925 2. Check if hardware works fine: a) check if AT command works, b) check if ISP / flash switch works: PA12 will have different output level while set the ISP/Flash Switch in different position. c) check if reset button works.
1926 )))
1927
1928 (((
1929 3. If you use Windows10 system. Please change the flash loader to run in Windows7 compatibility mode.
1930 )))
1931
1932 [[image:image-20220627153421-8.png]]
1933
1934
1935 (((
1936 4. We have seen cases where the FT232 USB TTL adapter has a reliability issue with the PC USB chipset (Intel). In this case, even though points 1 and 2 above work, it still has a reliability issue for uploading. If this happens, change to a different PC or change the USB to TTL adapter to solve the issue.
1937 )))
1938
1939
1940 == 7.2  Why I can't join TTN V3 in US915 / AU915 bands? ==
1941
1942
1943 It is due to channel mapping. Please see the [[Eight Channel Mode>>doc:Main.End Device AT Commands and Downlink Command.WebHome||anchor="H7.19EightChannelMode"]] section above for details.
1944
1945
1946 == 7.3  AT Command input doesn't work ==
1947
1948
1949 In the case if user can see the console output but can't type input to the device. Please check if you already include the (% style="color:red" %)**ENTER**(%%) while sending out the command. Some serial tool doesn't send (% style="color:red" %)**ENTER**(%%) while press the send key, user need to add ENTER in their string.
1950
1951
1952 = 8.  Order Info =
1953
1954
1955 Part Number: (% style="color:blue" %)**LSN50-XX-YY  **(%%)**or  (% style="color:blue" %)LSN50v2-XX-YY-ZZ(%%)**
1956
1957 (% style="color:blue" %)**XX**(%%): The default frequency band
1958
1959 * (% style="color:red" %)**AS923 **(%%)**:** LoRaWAN AS923 band
1960 * (% style="color:red" %)**AU915 **(%%)**:** LoRaWAN AU915 band
1961 * (% style="color:red" %)**EU433 **(%%)**:** LoRaWAN EU433 band
1962 * (% style="color:red" %)**EU868 **(%%)**:** LoRaWAN EU868 band
1963 * (% style="color:red" %)**KR920 **(%%)**:** LoRaWAN KR920 band
1964 * (% style="color:red" %)**US915 **(%%)**:** LoRaWAN US915 band
1965 * (% style="color:red" %)**IN865 **(%%)**:**  LoRaWAN IN865 band
1966 * (% style="color:red" %)**CN470 **(%%)**:** LoRaWAN CN470 band
1967
1968 (% style="color:blue" %)**YY**(%%)**: **Hole Option
1969
1970 * (% style="color:red" %)**12**(%%): With M12 waterproof cable hole
1971 * (% style="color:red" %)**16**(%%): With M16 waterproof cable hole
1972 * (% style="color:red" %)**20**(%%): With M20 waterproof cable hole (LSN50 v2 doesn't have this version)
1973 * (% style="color:red" %)**NH**(%%): No Hole
1974
1975 (% style="color:blue" %)**ZZ**(%%)**: **Battery Option ( Only valid for v2 model)
1976
1977 * (% style="color:red" %)**4**(%%): with 4000mAh battery
1978 * (% style="color:red" %)**8**(%%): with 8500mAg battery
1979
1980 = 9. ​ Packing Info =
1981
1982
1983 (% style="color:blue" %)**For LSN50**(%%)**:**
1984
1985 **Package Includes**:
1986
1987 * LSN50 LoRa Sensor Node x 1
1988
1989 **Dimension and weight**:
1990
1991 * Device Size: 8 x 6.5 x 5 cm
1992 * Device Weight: 137g
1993 * Package Size / pcs : 9 x 7 x 6cm
1994 * Weight / pcs : 160g
1995
1996 (% style="color:blue" %)**For LSN50 v2**(%%)**:**
1997
1998 **Package Includes**:
1999
2000 * LSN50v2 LoRa Sensor Node x 1
2001 * External antenna x 1
2002 * Spring Antenna (evaluate purpose)
2003
2004 **Dimension and weight**:
2005
2006 * Device Size: 9.7 x 6.5 x 4.7 cm
2007 * Device Weight: 150g
2008 * Package Size / pcs : 14.0 x 8x 5 cm
2009 * Weight / pcs : 180g
2010
2011 = 10.  ​Support =
2012
2013
2014 * 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.
2015 * 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>>url:http://../../../../../../D:%5C%E5%B8%82%E5%9C%BA%E8%B5%84%E6%96%99%5C%E8%AF%B4%E6%98%8E%E4%B9%A6%5CLoRa%5CLT%E7%B3%BB%E5%88%97%5Csupport@dragino.com]].
2016
2017 = 11.  References =
2018
2019
2020 * [[Product Page>>url:http://www.dragino.com/products/lora/item/128-lsn50.html]]
2021 * [[Data Sheet, Document Base>>https://www.dropbox.com/sh/djkxs7mr17y94mi/AABVlWbM9uzK9OA3mXyAT10Za?dl=0]]
2022 * [[Image Download>>url:https://github.com/dragino/LoRa_STM32/tree/master/LSN50.hex]]
2023 )))
Copyright ©2010-2024 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0