Skip to main content

AgrolabX for Dragino

Connecting Dragino NB-IoT and LoRaWAN devices: SE0X-NB, WSC2-N, LSE01, SE0X-LB

AgrolabX is a farm platform for irrigation and soil monitoring. This guide shows how to connect Dragino soil sensors and dweather stations to it, from the box to the first readings. It works with stock Dragino firmware: you only send standard AT commands or use the keys that ship with each sensor.

1. Supported devices​

AgrolabX decodes the Dragino payload itself, so you do not need a decoder, a converter, a TTN account or a network server.

DeviceNetworkPath to AgrolabXWhat you set up
SE0X-NBNB-IoTMQTT over TLS to mqtt.agrolabx.com:8883AT commands generated by AgrolabX
WSC2-NNB-IoTMQTT over TLS to mqtt.agrolabx.com:8883AT commands generated by AgrolabX
LSE01LoRaWAN EU868Your gateway → lns.agrolabx.comGateway server address; sensor keys from the box
SE0X-LBLoRaWAN EU868Your gateway → lns.agrolabx.comGateway server address; sensor keys from the box

The NSE01, LoRaWAN bands other than EU868, and sensors already registered on TTN or another network server are not supported yet.

2. Create an AgrolabX account​

Go to app.agrolabx.com, select Create account and confirm your email address. AgrolabX asks for the confirmation before you add the first gateway or sensor. The app is in English and Spanish; you choose the language at sign-up and can change it in Settings.

If the IMEI or DevEUI of a sensor is already active in another AgrolabX account, a claim is opened: the current owner has a period to veto it, and the sensor moves to your account only if they do not.

3. NB-IoT sensors: SE0X-NB and WSC2-N​

The sensor sends its data over MQTT, encrypted with TLS, to the AgrolabX server. AgrolabX creates the credentials for each sensor and gives you the AT commands already filled in. About 10 minutes per sensor.

3.1 Before you start​

  • An SE0X-NB or WSC2-N. The -GE version has no SIM card and no server set up: first insert the SIM and set the APN, as described in its manual (SE0X-NB §2.1 · WSC2-N §2.2)
  • An NB-IoT SIM with coverage at the field and its APN, for example AT+APN=iot.1nce.net for 1NCE (NB guide §2.1)
  • A phone or computer to send AT commands by Bluetooth (recommended) or UART (SE0X-NB §3.1 · WSC2-N §3.1)
  • The serial access password, printed on the box label as AT+PIN=xxxxxx (SE0X-NB §3.2 · WSC2-N §3.2)

3.2 Connect the sensor​

Step 1 · Add the sensor​

Select New → Sensor. On Add sensor, choose By IMEI or DevEUI, give the sensor a name, pick the model and type the 15-digit IMEI from the box label, or use Scan label QR. You can also read the IMEI with AT+CFG.

nb-add-sensor.png Add sensor, By IMEI or DevEUI: name, model and IMEI.

Step 2 · Set where it is​

Choose the farm and the field (for the WSC2-N, the farm only), switch on each probe that is buried and enter its depth, and tap the map where the post is, or use Use my location in the field. Select Install sensor.

nb-where.png Farm and field, the depth of each buried probe, and the post on the map.

Step 3 · Get the AT commands​

AgrolabX creates a username, a password and topics for this sensor and shows the AT commands, already filled in. Use Copy all, or Email me to have them at hand in the field.

nb-commands.png After Install sensor, AgrolabX shows the commands for this sensor, already filled in.

For an SE0X-NB they look like this:

AT+PRO=3,5 // MQTT, General JSON payload
AT+SERVADDR=mqtt.agrolabx.com,8883 // AgrolabX MQTT server, TLS port
AT+CLIENT=<username> // as shown in AgrolabX
AT+UNAME=<username> // as shown in AgrolabX
AT+PWD=<password> // as shown in AgrolabX
AT+PUBTOPIC=agrolabx/nbiot/se0x/<username>/uplink
AT+SUBTOPIC=agrolabx/nbiot/se0x/<username>/downlink
AT+TLSMOD=1,0 // TLS without certificate authentication
ATZ // Restart and connect

For the WSC2-N the topics use wsc2 instead of se0x, and AgrolabX adds AT+COUNTMOD=1 so the rain gauge reports rainfall (WSC2-N §8.4)

The commands stay in Sensor settings → Connection. Generate new password replaces the password if it is lost; the sensor then needs the new commands.

nb-connection-card.png Sensor settings → Connection: the same commands, Copy all, Email me and Generate new password.

Step 4 · Send the commands to the sensor​

A new sensor ships in deep sleep. Hold the button for more than 3 seconds to activate it: the green LED blinks 5 times and Bluetooth turns on (SE0X-NB §1.5–1.6 · WSC2-N §5.4–5.5)

The sensor must be able to attach to the NB-IoT network (NB guide §2). Connect by Bluetooth within 60 seconds, unlock with the AT+PIN password and paste the commands. Each one answers OK. After ATZ the sensor restarts and attaches to the network (SE0X-NB §1.7, §3.2)

Step 5 · Check the first reading​

The sensor page shows a Connection card that says Waiting for the first reading until the first message arrives, then First reading received. To send a reading right away, press the button for 1 to 3 seconds (SE0X-NB §1.6, §3.4)

nb-waiting.png The sensor page until the first reading arrives.

3.3 Troubleshooting​

AgrolabX checks each message and says on the sensor page what to change:

  • ThingSpeak payload: send AT+PRO=3,5 (SE0X-NB §2.2.4)
  • Raw values (AT+CFGMOD=1): send AT+CFGMOD=0 (SE0X-NB §2.2.1.1)
  • The sensor reports a different model from the one chosen (for example a WSC2-N added as SE0X-NB): correct the model.

If nothing arrives, check coverage and the APN, lock the band with AT+QBAND and let it search longer with AT+CSQTIME=10 (NB guide §2.2)

3.4 Supported settings​

Setting on the sensorIn AgrolabXDetails
AT+PRO=3,5 MQTT · JSONSupported · recommendedThe commands AgrolabX generates use it.
AT+PRO=3,0 MQTT · HEXSupportedDecoded the same way as JSON. On the WSC2-N, only with the WSS-09 head (payload_ver 1, the format in WSC2-N §2.3); with the newer heads use JSON.
AT+PRO=3,3 MQTT · ThingsBoardSupportedSame fields as JSON.
AT+TLSMOD=1,0 on port 8883Supported · recommendedEncrypted connection. Included in the generated commands.
AT+PRO=3,1 ThingSpeakDetectedThe sensor page asks for AT+PRO=3,5.
AT+CFGMOD=1 raw valuesDetectedThe sensor page asks for AT+CFGMOD=0.
AT+PRO=2,x UDP · 4,x TCP · 1,x CoAPNot supportedUse MQTT.

3.5 Model notes​

SE0X-NB

  • Up to 4 probes, each with its own address 01 to 04 (SE0X-NB §2.1)
  • Uplinks every 2 hours by default; change it with AT+TDC in seconds (SE0X-NB §3.4)
  • AgrolabX shows available water per depth, soil temperature, conductivity, battery and signal.

WSC2-N

  • Installed on a farm instead of a field.
  • The commands add AT+COUNTMOD=1: in the default mode the rain gauge sends no rainfall (WSC2-N §3.3.7, §8.4)
  • Set AT+PMMOD to the air sensor you have: 1 for PM2.5 and PM10, 0 for CO2 (WSC2-N §3.3.2)
  • With the first message, the station page lists the components it found. Third-party RS485 sensors and customised extras are not shown (WSC2-N §3.3.11, §3.4)

4. LoRaWAN sensors: LSE01 and SE0X-LB​

AgrolabX has its own LoRaWAN network server. Your gateway forwards packets to it, and AgrolabX registers the sensor with the keys from the box. About 15 minutes, including the gateway.

Sensor → Your gateway (packet forwarder) → lns.agrolabx.com → AgrolabX

4.1 Before you start​

  • An LSE01 or SE0X-LB for EU868. Each frequency band uses its own firmware (LSE01 §6 · SE0X-LB §2.7)
  • A LoRaWAN gateway that can forward packets to an external server with LoRa Basics Station or the Semtech UDP packet forwarder. A gateway with a built-in network server has to be switched to its packet-forwarder mode.
  • The sensor box. Its QR code holds the DevEUI, AppEUI and AppKey, which are also printed on the box label. The QR on the sensor itself only holds the DevEUI.

4.2 Connect the gateway and the sensor​

Step 1 · Add the gateway​

Select New → Gateway, or open Sensors → Gateways and select Add gateway. Enter the Gateway EUI from the label or the gateway's web page, a name, and the protocol, then select Register.

lw-gateway-add.png New gateway: Gateway EUI, name and protocol.

Step 2 · Point the gateway to AgrolabX​

Copy the server shown on the gateway card into the gateway's LoRaWAN settings:

LoRa Basics Station (recommended)
LNS server wss://lns.agrolabx.com:3002
Credentials certificate, private key and CA from "Generate certificate"

Semtech UDP packet forwarder
Server lns.agrolabx.com
Port up 1700
Port down 1700
  • Basics Station: on the gateway card, select Generate certificate and download Certificate, Private key and CA. Save them at once: the private key is not stored and cannot be shown again. Load the three files in the gateway.
  • Semtech UDP: set the server and the two ports; no files are needed.

lw-gateway-card.png The gateway card: server, protocol and the certificate files for Basics Station.

The card turns Online when AgrolabX hears from the gateway. Until then it says Not connected yet.

Step 3 · Add the sensor​

Select New → Sensor. On Add sensor, choose By IMEI or DevEUI, give the sensor a name and pick the model. Select Scan the QR on the box, or type DevEUI, AppEUI (JoinEUI) and AppKey from the box label. Select Add. AgrolabX registers the sensor in its network server with these keys.

lw-add-sensor.png Add sensor for an SE0X-LB: the keys from the box, typed or scanned.

Step 4 · Set where it is​

Choose the farm and the field, switch on each probe that is buried and enter its depth (one probe on the LSE01, several on the SE0X-LB), and tap the map where the post is, or use Use my location. Select Install sensor.

Step 5 · Power on the sensor​

The confirmation screen shows Power on the sensor with the steps for the model and the join status, which updates by itself.

  • LSE01: put the jumper on JP2, in the FLASH position. When it joins, the LED stays on for 5 seconds (LSE01 §2.2, §2.8)
  • SE0X-LB: hold the button for 5 seconds; the green LED blinks 5 times and the sensor starts joining. When it joins, the green LED stays on for 5 seconds (SE0X-LB §1.6, §2.2)

lw-power-on.png After Install sensor: the power-on steps for the model and the join status.

Step 6 · Check the first reading​

The status moves from Waiting for the sensor to join the network to Joined the network and, with the first reading, to Connected. The first reading arrives right after the join, then every 20 minutes (LSE01 §2.4 · SE0X-LB §2.4). On the SE0X-LB, a press of 1 to 3 seconds sends a reading at once (SE0X-LB §1.6)

Until the sensor is connected, the same status shows at the top of its page. It also stays in Sensor settings → LoRaWAN connection, with the profile, when the sensor was last seen and the link margin.

lw-connection-card.png Sensor settings → LoRaWAN connection, with the settings that AgrolabX sends by downlink.

4.3 Change sensor settings from AgrolabX​

In LoRaWAN connection, under Sensor settings, set the Uplink interval in minutes, or select Back to normal mode (MOD=0), and select Send. AgrolabX sends the Dragino downlink (01 for the interval). A LoRaWAN Class A sensor only receives commands right after sending a reading, so the change applies after the next one. Latest settings sent shows when the sensor confirmed it (LSE01 §2.5, §2.3.7 · SE0X-LB §3.3.1, §2.3.8)

You can also change the interval on the sensor with AT+TDC.

4.4 Troubleshooting​

  • The AppKey does not match: the sensor tried to join with a different AppKey. Select Change keys and enter the AppKey from the box label, or set the same key on the sensor with AT+APPKEY.
  • Still Waiting for the sensor to join the network: check on the Gateways page that the gateway is Online, that the sensor is in range, and that both use EU868.
  • The gateway stays Not connected yet: check the server address, the port and the protocol, and that the Gateway EUI matches the one on the gateway's web page. With Basics Station, check that the three certificate files are loaded.
  • Remove from the network stops the sensor and frees its DevEUI; its history stays in the account.

4.5 Gateway connection options​

ProtocolServer and portIn AgrolabXSecurity
LoRa Basics Stationwss://lns.agrolabx.com:3002RecommendedTLS, with a client certificate for each gateway generated by the app.
Semtech UDP packet forwarderlns.agrolabx.com, port 1700 up and downSupportedNo encryption or gateway authentication. Sensor data stays protected by its LoRaWAN keys.
Other bands (US915, AU915, AS923…)—Not supported yetEU868 only.

4.6 Model notes​

LSE01

  • One probe: AgrolabX asks for a single depth.
  • LoRaWAN 1.0.3 Class A (LSE01 §1.2)
  • Uplinks every 20 minutes by default (LSE01 §2.4)
  • Changing the work mode by downlink needs firmware v1.2.1 or later (LSE01 §2.3.7)

SE0X-LB

  • Several probes: AgrolabX asks for the depth of each one that is buried.
  • LoRaWAN 1.0.3 Class A (SE0X-LB §1.2)
  • Uplinks every 20 minutes by default (SE0X-LB §2.4)
  • Time requests (SYNCMOD=1) need a LoRaWAN 1.0.3 server, which AgrolabX is (SE0X-LB §2.6)
  • Five presses of the button put it in deep sleep (SE0X-LB §1.6)

5. References​

The section numbers in this guide refer to these Dragino manuals:

  • SE0X-NB: wiki.dragino.com/docs/NB-IoT/soil-agriculture-sensors/se0x-nb/
  • WSC2-N: wiki.dragino.com/docs/NB-IoT/weather-stations/wsc2-n/
  • NB guide (-NB & -NS models): wiki.dragino.com/docs/NB-IoT/general-configuration/nb-ns-models-nb-iot/
  • LSE01: wiki.dragino.com/docs/LoRaWAN-End-Node/soil-agriculture-sensors/lse01/
  • SE0X-LB: wiki.dragino.com/docs/LoRaWAN-End-Node/soil-agriculture-sensors/se0x-lb/