DRAGINO SN50V3 LoRaWAN Sensor Node User Manual
- June 14, 2024
- DRAGINO
Table of Contents
DRAGINO SN50V3 LoRaWAN Sensor Node
INTRODUCTION
The payload decoder function for TTN V3 are here: SN50v3-LB TTN V3 Payload Decoder: https://github.com/dragino/dragino-end-node- decoder
Battery Info
Check the battery voltage for SN50v3-LB.
- Ex1: 0x0B45 = 2885mV
- Ex2: 0x0B49 = 2889mV
Temperature (D518B20}
If there is a DS18B20 connected to PC13 pin. The temperature will be uploaded in the payload. More DS18B20 can check the 3 DS18B20 mode Connection :
Example:
- If payload is: 0105H: (0105 & 8000 == 0), temp= 0105H /1 0 = 26.1 degree
- If payload is: FF3FH : (FF3F & 8000 == 1) , temp = (FF3FH – 65536)/10 = -19.3 degrees. (FF3F & 8000: Judge whether the highest bit is 1, when the highest bit is 1, it is negative)
Digital Input
The digital input for pin PB15,
- When PB15 is high, the bit 1 of payload byte 6 is 1.
- When PB15 is low, the bit 1 of payload byte 6 is 0.
When the digital interrupt pin is set to AT +INTMODx= 0, this pin is used as a digital input pin.
Note: The maximum voltage input supports 3.6V.
Analogue Digital Converter (ADC)
The measuring range of the ADC is only about 0.1 V to 1.1 V The voltage
resolution is about 0.24mv. When the measured output voltage of the sensor is
not within the range of 0.1 V and 1.1 V, the output voltage terminal of the
sensor shall be divided The example in the following figure is to reduce the
output voltage of the sensor by three times If it is necessary to reduce more
times, calculate according to the formula in the figure and connect the
corresponding resistance in series.
Note: If the ADC type sensor needs to be powered by SN50_v3, it is recommended to use +5V to control its switch.Only sensors with low power consumption can be powered with VDD. The position of PA5 on the hardware after LSN50 v3.3 is changed to the position shown in the figure below, and the collected voltage becomes one-sixth of the original.
Digital Interrupt
Digital Interrupt refers to pin PAS, and there are different trigger
methods. When there is a trigger, the SN50v3-LB will send a packet to the
server.
Interrupt connection method:
Example to use with door sensor :
The door sensor is shown at the right. It is a two-wire magnetic contact
switch used for detecting the open/close status of doors or windows.
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 SN50v3-LB interrupt interface to detect the status for the door or window.
Below is the installation example:
Fix one piece of the magnetic sensor to the door and connect the two pins to
SN50v3-LB as follows:
- One pin to SN50v3-LB’s PAS pin
- The other pin to SN50v3-LB’s VDD pin
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 PAS will be at the VCC voltage. Door sensors have two types: NC (Normal close) and NO (normal open). The connection for both types of sensors are the same. But the decoding for payload are reversed, user needs to modify this in the loT Server decoder. When the door sensor is shorted, there will be extra power consumption in the circuit, the extra current is 3v3/R14 = 3v3/1 Mohm = 3uA which can be ignored.
The above photos shows the two parts of the magnetic switch fitted to a door. 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. The command is:
- AT +I NTMOD1 :1 II (For more info about INMOD please refer to AT Command Manual.) Below are some screen captures in TTN V3:
In MOD:1, the user can use byte 6 to see the status of the door open or closing. TTN V3 decoder is as below: door= (bytes[6] & 0x80)? “CLOSE”:”OPEN”;
I2C Interface (SHT20 & SHT31)
The SDA and SCK are I2C interface lines. You can use these to connect to an
I2C device and get the sensor data. We have made an example to show how to use
the I2C interface to connect to the SHT201 SHT31 Temperature and Humidity
Sensor.
Notice: Different I2C sensors have different I2C commands set and initiate the process, if the user want to use other I2C sensors, the User need to re-write the source code to support those sensors. SHT20/ SHT31 code in SN50v3-LB will be a good reference.
Below is the connection to SHT20/ SHT31. The connection is as below:
The device will be able to get the I2C sensor data now and upload it to the loT Server.
Convert the read byte to decimal and divide it by ten.
Example
- Temperature: Read:0116(H) = 278(0) Value: 278 /10=27.8″C;
- Humidity: Read:0248(H)=584(D) Value: 584 / 10=58.4, So 58.4% If you want to use another I2C device, please refer the SHT20 part source code as a reference.
Distance Reading
Refer Ultrasonic Sensor section.
Ultrasonic Sensor
The fundamental Principles of this sensor can be found at this link:
https://wiki.dfrobot.com/Weather – proof Ultrasonic Sensor with Separate
Probe SKU SEN0208 The SN50v3-LB detects the pulse width of the sensor and
converts it to mm output. The accuracy will be within 1 centimetre. The usable
range (the distance between the ultrasonic probe and the measured object) is
between 24cm and 600cm. The working principle of this sensor is similar to the
HC-SR04 ultrasonic sensor. The picture below shows the connection:
Connect to the SN50v3-LB and run AT +MOD:2 to switch to ultrasonic mode (ULT). The ultrasonic sensor uses the 8th and 9th byte for the measurement value.
Example:
Distance: Read: 0C2D(Hex) = 3117(0) Value: 3117 mm=311.7 cm
Battery Output – BAT pin
The BAT pin of SN50v3-LB is connected to the Battery directly. If users want
to use a BAT pin to power an external sensor. Users need to make sure the
external sensor is of low power consumption. Because the BAT pin is always
open. If the external sensor is of high power consumption. the battery of
SN50v3-LB will run out very soon.
3.10 +5V Output
SN50v3-LB will enable +5V output before all sampling and disable the +5v after
all sampling. The 5V output time can be controlled by AT Command.
- AT+SVT:1000
This means set 5V valid time to have 1 000ms. So the real 5V output will have 1 000ms + sampling time for other sensors. By default the AT +5VT =500. If the external sensor which requires 5v and requires more time to get a stable state, the user can use this command to increase the power ON duration for this sensor.
H1750 Illumination Sensor
MOD=1 support this sensor. The sensor value is in the 8th and 9th bytes
.
PWM MOD
- The maximum voltage that the SDA pin of SN50v3 can withstand is 3.6V, and it cannot exceed this voltage value, otherwise, the chip may be burned.
- If the PWM pin connected to the SDA pin cannot maintain a high level when it is not working, you need to remove the resistor R2 or replace it with a resistor with a larger resistance, otherwise a sleep current of about 360uA will be generated. The position of the resistor is shown in the figure below:
- The signal captured by the input should preferably be processed by hardware filtering and then connected in. The software processing method is to capture four values, discard the first captured value, and then take the middle value of the second, third, and fourth captured values.
- Since the device can only detect a pulse period of 50ms when AT +PWMSET =0 (counting in microseconds), it is necessary to change the value of PWMSET according to the frequency of input capture.
Working MOD
The working MOD info is contained in the Digital in & Digital Interrupt byte (?’h Byte). User can use the 3rd ~ ?’h bit of this byte to see the working mod: Case ?’h Byte » 2 & 0x1 f:
- 0: MOD1
- 1: MOD2
- 2: MOD3
- 3: MOD4
- 4: MODS
- 5: MOD6
- 6: MOD?
- 7: MOD8
- 8: MOD9
- 9: MOD10
Payload Decoder file
In TTN, users can add a custom payload so it shows friendly reading In the page Applications –> Payload Formats –> Custom –> decoder to add the decoder from: https://github.com/dragino/dragino-end-node-decoder/tree/main/SN50 v3-LB
Frequency Plans
The SN50v3-LB uses OT AA mode and below-frequency plans by default. If the
user wants to use it with a different frequency plan, please refer to the AT
command sets.
Configure SN50v3-LB
Configure Methods
SN50v3-LB supports the below configure method:
- AT Command via Bluetooth Connection (Recommended): BLE Configure Instruction.
- AT Command via UART Connection: See UART Connection.
- LoRaWAN Downlink. Instruction for different platforms: See loT LoRaWAN Server section.
General Commands
These commands are to configure:
- General system settings like uplink interval.
- LoRaWAN protocol & radio-related command.
They are the same for all Dragino Devices that support the DLWS-005 LoRaWAN
Stack. These commands can be found on the wiki:
http://wiki.dragino.com/xwiki/bin/view/Main/End%20Device%20AT%20Commands%20and%20Downlink%20Command/
Commands special design for SN50v3-LB
These commands are only valid for SN50v3-LB, as below:
Set Transmit Interval Time
Feature: Change LoRaWAN End Node Transmit Interval.
AT Command: AT+TDC
Downlink Command: 0x01
Format: Command Code (0x01) followed by 3 bytes time value. If the downlink
payload=0100003C, it means set the END Node’s Transmit Interval to
0x00003C=60(S), while type code is 01.
- Example 1: Downlink Payload: 0100001 E II Set Transmit Interval (TDC)= 30 seconds
- Example 2: Downlink Payload: 0100003C II Set Transmit Interval (TDC)= 60 seconds
Get Device Status
Send a LoRaWAN downlink to ask the device to send its status.
Downlink Payload: 0x26 01
Sensor will upload Device Status via FPORT =5. See payload section for detail.
Set Interrupt Mode
Feature, Set Interrupt mode for GPIO_EXIT.
AT Command: AT+ INTMODl, AT+ INTMOD2, AT +INTMOD3
Downlink Command: 0x06
Format: Command Code (0x06) followed by 3 bytes. This means that the interrupt
mode of the end node is set to 0x000003=3 (rising edge trigger), and the type
code is 06.
-
Example 1: Downlink Payload: 06000000
- –> AT +INTMOD1 =0
-
Example 2: Downlink Payload: 06000003
- –> AT +INTMOD1 =3
-
Example 3: Downlink Payload: 06000102
- –> AT +INTMOD2=2
-
Example 4: Downlink Payload: 06000201
- –> AT +INTMOD3=1
Set Power Output Duration
Control the output duration 5V . Before each sampling, the device will
- first enable the power output to the external sensor,
- keep it on as per duration, read sensor value and construct an uplink payload
- final, close the power output.
AT Command: AT+5VT
Downlink Command: 0x07
Format: Command Code (0x07) followed by 2 bytes. The first and second bytes are the time to turn on.
- Example 1: Downlink Payload: 070000 —> AT +5VT =0
- Example 2: Downlink Payload: 0701 F4 —> AT +5VT =500
Set Weighing parameters
Feature: Working mode 5 is effective, weight initialization and weight factor setting of HX711.
AT Command: AT+WEIGRE,AT+WEIGAP
Downlink Command: 0x08
Format: Command Code (0x08) followed by 2 bytes or 4 bytes. Use AT +WEIG
RE when the first byte is 1, only 1 byte. When it is 2, use AT +WEI GAP, there
are 3 bytes. The second and third bytes are multiplied by 1 0 times to be the
AT +WEIGAP value.
- Example 1: Downlink Payload: 0801 —> AT +WEIGRE
- Example 2: Downlink Payload: 08020FA3 —> AT +WEIGAP=400.3
- Example 3: Downlink Payload: 08020FA0 —> AT +WEIGAP=400.0
Set Digital pulse count value
Feature: Set the pulse count value. Count 1 is the PAS pin of mode 6 and mode 9. Count 2 is PA4 pin of mode 9.
AT Command: AT+SETCNT
Downlink Command: 0x09
Format: Command Code (0x09) followed by 5 bytes. The first byte is to select which count value to initialize, and the next four bytes are the count values to be initialized.
- Example 1: Downlink Payload: 090100000000 —> AT +SETCNT =1,0
- Example 2: Downlink Payload: 0902000003E8 —> AT +SETCNT =2, 1000
Set Workmode
Feature: Switch working mode.
AT Command: AT+MOD
Downlink Command: 0x0A
Format: Command Code (0x0A) followed by 1 bytes.
- Example 1: Downlink Payload: 0A01 —> AT +MOD= 1
- Example 2: Downlink Payload: 0A04 —> AT +MOD=4
PWM setting
Feature: Set the time acquisition unit for PWM input capture.
AT Command: AT+PWMSET
Downlink Command: 0x0C
Format: Command Code (0x0C) followed by 1 bytes.
- Example 1: Downlink Payload: 0C00 —> AT +PWMSET =
- Example 2: Downlink Payload: 0C010 —> AT +PWMSET =1
Battery & Power Consumption
SN50v3-LB use ER26500 + SPC1520 battery pack. See the below link for detail information about the battery info and how to replace.
Battery Info & Power Consumption Analyze.
OTA Firmware update
Users can change firmware SN50v3-LB to:
- Change Frequency band/ region.
- Update with new features.
- Fix bugs.
Firmware and changelog can be downloaded from: the Firmware download link
Methods to Update Firmware:
- (Recommended way) OT A firmware update via wireless: http://wiki.dragino.com/xwiki/bin/view/Main/Firmware%20OTA%20Update%20for%20Sensors/
- Update through UART TTL interface: Instruction.
FAQ
Where can I find the source code of SN50v3-LB?
- Hardware Source Files.
- Software Source Code and compile instruction.
How to generate PWM Output in SN50v3-LB?
See this document: Generate PWM Output on SN50v3.
How to put several sensors to an SN50v3-LB?
When we want to put several sensors to A SN50v3-LB, the waterproofing at the
grand connector will become an issue. Users can try to exchange the grand
connector to the below type. Reference Supplier.
Cable Gland Rubber Seal
Size: the size is suitable for YSC cable glands, special sizes can be ordered. We can make new models as per your requirements. Material: EPDM
Order Info
- Part Number: SN50v3-LB-XX-YY
- XX: The default frequency band
- AS923: LoRaWAN AS923 band
- AU915: LoRaWAN AU915 band
- EU433: LoRaWAN EU433 band
- EU868: LoRaWAN EU868 band
- KR920: LoRaWAN KR920 band
- US915: LoRaWAN US915 band
- IN865: LoRaWAN IN865 band
- CN470: LoRaWAN CN470 band
- YY: Hole Option
- 12: With M 12 waterproof cable hole
- 16: With M 16 waterproof cable hole
- 20: With M20 waterproof cable hole
- NH: No Hole
Packing Info
Package Includes:
- SN50v3-LB LoRaWAN Generic Node
Dimension and weight:
- Device Size: cm
- Device Weight: g
- Package Size I pcs: cm
- Weight/ pcs: g
Support
- Support is provided Monday to Friday, from 09:00 to 18:00 GMT +8. Due to different time zones, we cannot offer live support. However, your questions will be answered as soon as possible in the before-mentioned schedule.
- Provide as much information as possible regarding your enquiry (product models, accurately describe your problem and steps to replicate it etc) and send a mail to support@dragino.cc
FCC Warning
Any Changes or modifications not expressly approved by the party responsible for compliance could void the user’s authority to operate the equipment. This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) This device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.
Note: This equipment has been tested and found to comply with the limits for a Class B digital device, under part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference in a residential installation. This equipment generates, uses and can radiate radio frequency energy and, if not installed and used per the instructions, may cause harmful interference to radio communications. However, there is no guarantee that interference will not occur in a particular installation. If this equipment does cause harmful interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one or more of the following measures:
- Reorient or relocate the receiving antenna.
- Increase the separation between the equipment and receiver.
- Connect the equipment to an outlet on a circuit different from that to which the receiver is connected.
- Consult the dealer or an experienced radio/TV technician for help.
This equipment complies with FCC radiation exposure limits set forth for an uncontrolled environment. This equipment should be installed and operated with minimum distance 20cm between the radiator& your body. This transmitter must not be co-located or operating in conjunction with any other antenna or transmitter.
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>