Skip to main content

Build LoRaWAN Sensors with SenseCAP Data Logger

Overview

You can build a custom, cost-effective, industrial-grade LoRaWAN sensor using Grove sensors, to connect to SenseCAP Cloud with SenseCAP Data Logger, enabling long range wireless data transmission.

Preliminary

Hardware Preparation

This wiki requires the products like the list:

tip

In this tutorial, the Grove - Oxygen Sensor (MIX8410) is used. For more available Grove modules and the method of customizing your own Grove modules, you can check here and look for more information.

SenseCAP S2110 Sensor BuilderGrove - Oxygen Sensor (MIX8410)SenseCAP S2100 Data Logger/DTU

Software Preparation

Download and install SenseCAP Mate App on your mobile phone according to your OS.

If it is your first time to use the SenseCAP platform, please register an account first by clicking Register button and login afterwards with the newly created account

note

The fields with are required fields, and those without can be filled in optionally.

LoRaWAN network coverage Check

We are using LoRaWAN network here. Hence, it is required to check whether you are within LoRaWAN network coverage of Helium or TTN (The Things Network).

note

If you do not have coverage, you can use any gateway powered by Helium/ TTN to send the sensor data to the cloud.

Getting Started

We can get started now.

1. Connect Grove Sensor to SenseCAP S2110 Sensor Builder

  • Step 1: Unscrew the four screws on the SenseCAP S2110 Sensor Builder lid and open the lid
  • Step 2: Remove the thread cap
  • Step 3: Pass the included cable through the cap into the SenseCAP S2110 Sensor Builder
  • Step 4: Connect the wires of the cable into the screw terminal as follows
  • Step 5: Place a Grove sensor inside the SenseCAP S2110 Sensor Builder and screw it.
note

Grove with 2 holes (ex: Grove - Light Sensor v1.2)

Grove with 3 holes (Grove Temperature and Barometer Sensor (BMP280))
  • Step 6: Connect Grove cable to Grove sensor and Grove connector on SenseCAP S2110 Sensor Builder board

  • Step 7: Close lid and screw it back

  • Step 8: Tighten the thread cap and secure in place

2. Connect SenseCAP S2110 Sensor Builder to SenseCAP Data Logger

  • Step 1: Uncrew the three screws on the data logger
  • Step 2: Remove the bottom cover and take out the inside PCBA until the screw terminals are accessible. You do not need to take out the entire board
  • Step 3: Remove the thread cap by unscrewing in clockwise counter-clockwise direction
  • Step 4: Pass the included cable through the thread cap and the bottom cover
  • Step 5: Connect the wires of the cable into the screw terminal as follows
note

Since there are 5 wires inside the cable and we are only using 4, it is better to tape the extra wire to avoid accidental contacts with the screw terminals

  • Step 6: Put back the hardware unit inside the case, close it from bottom cover and screw it back
  • Step 7: Tighten the thread cap and secure the cable in place

Once all the connections are done for the SenseCAP S2110 Sensor Builder and the Data Logger, it should look like below:

3. Connect to SenseCAP Cloud via SenseCAP Mate App

  • Step 1: Open the SenseCAP Mate APP and sign in to your SenseCAP account by entering your registered email and password and clicking Login buttons
note

Keep the Server Location as Global, which is the default

a. Update Data Logger Firmware

  • Step : Under Config page, select S2100 Data Logger
  • Step 2: Press and hold the configuration button on the SenseCAP Data Logger for 3 seconds to enter bluetooth pairing mode

If it enters bluetooth pairing mode, a green LED will start to blink

  • Step 3: Click Update
  • Step 4: Now it will prompt you to turn on location services. Click GO TO to open the location services page on your phone
  • Step 5: Turn on location services. It will look as follows for Android
  • Step 6: Come back to SenseCAP Mate App and click Scan

Now it will start scanning for nearby SenseCAP Data Loggers

  • Step 7: Click on the discovered device
  • Step 8: If an update is available, click Get Updates to update to the latest version. After updating to the latest version or if it says The device is already running the latest firmware, go back to the previous set up page

b. Configure Settings for Data Logger and SenseCAP S2110 Sensor Builder Communication

  • Step 1: Enter bluetooth pairing mode on the Data Logger again and click Setup
  • Step 2: Click on the device found

It will open a page with useful information under General

  • Step 3: Go to Setting page and under Basic Setting, choose the platform either as SenseCAP for the Things Network or SenseCAP for Helium

Note: You can choose others as well, but in that case, you cannot use SenseCAP platform

  • Step 4: Choose the Frequency Plan, Uplink interval and Packet Policy
note

The default Packet Policy is 2C+1N and the below table explains more about it and others

ParameterDescription
2C+1N (default)2C+1N (2 confirm packets and 1 none-confirm) is the best strategy, the mode can minimize the packet loss rate, however the device will consume the most data packet in TTN, or date credits in Helium network.
1C1C (1 confirm) the device will sleep after get 1 received confirm packet from server.
1N1N (1 none-confirm) the device only send packet and then start to sleep, no matter the server received the data or not.
  • Step 5: Under Sensor Setting, fill as follows
ParameterDescription
ProtocolRS485 Modbus RTU
Baud RateBaud rate of communication with the sensor. Select 9600 here.
Modbus AddressSlave address of the sensor. The range is 1 to 247. Enter 1 here.
Power TypePeriodic power: Power the sensor before data collection, and power off the sensor after data collection. This mode reduces power consumption and increases battery life. Always-on: Select this mode when the sensor needs constant power supply. Generally, an external 12V DC power supply is used. If it is powered only by batteries, it may not work for long. Select periodic power here.
Power VoltageSelect the supply voltage to the sensor. It supports 3V/5V/12V. Select 5V here.
Sensor Warm-up TimeThe warm-up time denotes the amount of time it takes for the sensor to attain its highest accuracy or performance level once the voltage supply has been applied. This depends from sensor to sensor. The Grove Oxygen Sensor (MIX8410) and CO2 & Temperature & Humidity Sensor(SCD41) needs a warm-up time of 5s, which means you need to enter 5000 inside the box. The other Grove sensors supported by the SenseCAP S2110 Sensor Builder at the moment only need 0ms warm-up time.
Response TimeoutAfter Data Logger initiates a data read request to the sensor, it waits for the timeout time for a response. If this time is exceeded, the command will be resent. Enter 1 here, which means 100ms.
Startup TimeThe length of time the sensor can communicate from powered -on to communicating with Modbus. Enter 20 here, which means 2000ms=2s

A filled settings page can be seen below

  • Step 6: For the Measurement Number, refer to the table below according to the specific sensor.
Grove Sensor NameMeasure Number
Grove - Light Sensor v1.21
Grove - Flame Sensor1
Grove - Oxygen Sensor (MIX8410)1
Grove - CO2 & Temperature & Humidity Sensor (SCD41)3
Grove - Sunlight sensor (SI1151)3
Grove Temperature and Barometer Sensor (BMP280)3
note

SenseCAP Data Logger can collect 0 to 10 measurements in RS485 mode.

  • Step 7: After specifying the Measurement Number, you need to fill the Measurement Settings. Here we will choose a Grove - Light Sensor v1.2. For this sensor, we only need one measurement, which is the light level. Select 1 for the Measurement Number and click Measurement Setting
  • Step 8: Under Measurement Setting click Measurement1

If you use the Grove - CO2 & Temperature & Humidity Sensor (SCD41) we need three measurements, which is the temprature, humidity and C02 levels. Select 3 for the Measurement Number and click Measurement Setting

Also, here you need to configure the 3 measurements separately

  • Step 9: For the Register Address, refer to the table below and enter the decimal value of the register address
Grove Sensor NameRegister NameRegister Address
(Hexadecimal)
Register Address
(Decimal)
Grove - Oxygen Sensor (MIX8410)Oxygen0x000E14
Atmospheric Pressure0x001824
Height0x001A26
Grove - Temperature Humidity Pressure Gas Sensor(BME680)Temperature0x001C28
Atmospheric Pressure0x001E30
Humidity0x002032
Air Quality(VOC)0x002234
Grove - Gas Sensor V2(Multichannel)N020x002436
C2H50H0x002638
VOC0x002840
CO0x002A42
Grove - UV SensorUV Intensity0x002C44
Grove - Turbidity Sensor Meter V1.0Turbidity0x002E46
Grove - TDS SensorTDS0x003048
Grove - Ultrasonic RangerDistance0x003250

A filled register address for the Grove - Light Sensor v1.2 can be seen below

Filled register addresses for the Grove - CO2 & Temperature & Humidity Sensor (SCD41) can be seen below

  • Step 10: The rest of the settings are common to all the Grove sensors and fill them as follows
Function CodeModbus function code. Select 03 here
Data TypeThe data type determines the number of registers read from the sensor and how the data should parse the value. Select Signed 32bit integer, 0xABCD here.
PrecisionPrecision of the value. You can choose the decimal place of the measurement value. If 1 is selected, one decimal place is reserved. Select 2, #.## here.
Y= Ax + B“Y”: It is the value of Data Logger will upload. “x”: It is the original current value. Factory A: Custom values that can be scaled up or down by multiples of the “x”. Factory B: A custom value that increments or diminishes the value of the “x”. By setting the values of A and B, you can calculate the desired value. If only raw values need to be uploaded, set A=1 and B=0. Here we set Factory A is 0.001 and Factory B is 0.
Write StrategyThis function is enabled only for some special sensors and is generally disabled by default After reading the value of the register, special instructions can be issued to the sensor, such as the instruction to empty the register after reading register 0. None: Off by default. After Read: Send the RS485 command to sensor after reading the register. On New Data: Send the RS485 command to sensor every 24 hours. We don’t need to write strategy so we select None here

A filled Measurement Setting page can be seen below

  • Step 11: Click Confirm to save the changes and it will go back to the Setting page
  • Step 12: Click Send to send the changes to the Data Logger

c. Test and View the Sensor Data Locally

Now we need to test whether the SenseCAP S2110 Sensor Builder is properly sending the sensor data to the Data Logger.

  • Step 1: Go to General and click Measure

Now it will display the sensor value and you will see the LEDs of the Seeed Studio XIAO RP2040 on the SenseCAP S2110 Sensor Builder lighting up.

The below is for Grove - Oxygen Sensor (MIX8410). This indicates oxygen concentration of air which is 21.36%.

The below is for Grove Temperature and Barometer Sensor (BMP280). This indicates barometric temperature as 30.55°C, atmospheric pressure as 101401Pa, and height as 53.08m.

d. Add Newly Created Sensor to SenseCAP Platform

  • Step 1: Go back to the app home page and Data Logger Red LEDs will start blinking for a couple of seconds followed by Green LEDs blinking for a brief amount of time to indicate that the LoRaWAN connection is successful and the data is sent. Alternatively you can click the button on the data logger once, to force this data sending.

You will also see the LEDs of the Seeed Studio XIAO RP2040 on the SenseCAP S2110 Sensor Builder lighting up

Now we need to add this sensor to SenseCAP platform in order to view the data on the cloud

  • Step 2: Go to Device page, click the + symbol and click Add device
  • Step 3: Scan the QR code located on the Data Logger
  • Step 4: Enter a Device name according to the connected Grove sensor and click Next
  • Step 5: Enter a Device Location and click Confirm

4. Visualize Sensor Data on SenseCAP Mate App

Now you will see the Data Logger online on the SenseCAP Mate App

Click on it to display the sensor values

Below is for Grove Temperature and Barometer Sensor (BMP280).

5. (optional) Visualize Sensor Data on SenseCAP Dashboard

You can also use the SenseCAP Web Dashboard to visualize the sensor data.

  • Step 1: Visit sensecap.seeed.cc and sign in to your SenseCAP account that you created inside the SenseCAP Mate App before.
  • Step 2: Click Sensor Node and select the sensor that we created before inside the SenseCAP Mate App.
  • Step 3: Click Data tab and you will see all sensor data displayed from the connected Grove sensor.

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...