Seeed-Studio / Seeed_Arduino_S2110

Source code for SenseCAP S2110 Grove to MODBUS RS485 Converter. An open-source tool to build LoRaWAN sensors
MIT License
6 stars 6 forks source link

Build Your Own LoRaWAN Sensor With SenseCAP S2110 XIAO LoRaWAN SensorBuilder

This is the source code for SenseCAP S2110 XIAO LoRaWAN SensorBuilder and it provides an open-source tool to build your own LoRaWAN sensors.

Hardware Set Up

Now you can open Arduino IDE on the PC and start tinkering!

Software Set Up

How to Add a New Sensor

Refer to the following code :

void setup()
{
  Serial.begin(9600);
  SensorBuilder.check_grove();

  /* sensor list */
  sensorUltrasonic *ultrasonic = new sensorUltrasonic();
  SensorBuilder.addSensor(ultrasonic);

  // add new sensor to sensor list
  sensorNew *newSensor = new sensorNew();
  SensorBuilder.addSensor(newSensor);

  SensorBuilder.begin();
}

NOTE: the Modbus register address for the new sensor will start from 0x0034, the register bit width for each measurement value is 32, so the register address offset between two adjacent measurement values is 2.

Modbus Register Table

Grove Sensor Name Register Name Register Address
(Hexadecimal)
Register Address
(Decimal)
Grove - CO2 & Temperature & Humidity Sensor (SCD41) Temperature 0x0004 04
Humidity 0x0006 06
CO2 0x0008 08
Grove - Light Sensor v1.2 Light 0x000A 10
Grove - Flame Sensor Flame 0x000C 12
Grove - Oxygen Sensor (MIX8410) Oxygen 0x000E 14
Grove - Sunlight sensor (SI1151) Light Intensity 0x0010 16
Visible Light 0x0012 18
UV 0x0014 20
Grove Temperature and Barometer Sensor (BMP280) Barometric Temperature 0x0016 22
Atmospheric Pressure 0x0018 24
Height 0x001A 26
Grove - Temperature Humidity Pressure Gas Sensor(BME680) Temperature 0x001C 28
Atmospheric Pressure 0x001E 30
Humidity 0x0020 32
Air Quality(VOC) 0x0022 34
Grove - Gas Sensor V2(Multichannel) N02 0x0024 36
C2H50H 0x0026 38
VOC 0x0028 40
CO 0x002A 42
Grove - UV Sensor UV Intensity 0x002C 44
Grove - Turbidity Sensor Meter V1.0 Turbidity 0x002E 46
Grove - TDS Sensor TDS 0x0030 48
Grove - Ultrasonic Ranger Distance 0x0032 50

Modbus register addresses 0x0000 to 0x0003 are reserved for storing module system information, where 0x0000 is the modbus address with a default value of 1 and a maximum value of 247, 0x0001 is the serial port baud rate with a default value of 96 (corresponding to 9600), and 0x0002 to 0x0003 are for software version.