LoRa TDS Sensor

From MakerFabsWiki
Revision as of 03:37, 3 November 2021 by Hefang (talk | contribs) (Introduce)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduce

TDS (Total Dissolved Solids) indicates how many milligrams of soluble solids are dissolved in one liter of water. From the Instructables TDS-Measuring-in-Aquarium, we got more focus on how to monitor the TDS and thus make this Lora TDS with Arduino, for Makers to create TDS monitor applications easily.

Makerfabs Lora TDS sensor monitors the water status, includes TDS/ temperature, and send the data remotely via Lora, to create a local Lora network, so users can easily create multiple TDS node and process/display them in one Lora server, suitable for applications that need multiple TDS monitor.

Makerfabs Lora TDS can be used directly with powering up, it is programmed with Makerfabs default firmware, with the spec of: 1. Unique ID. Each Lora TDS sensor has a unique ID that can be used to identify each other, so uses can have multiple TDS sensor nodes locally; 2. TDS report every 60 minutes and fall into sleep. With Makerfabs hardware/ firmware setting, the sleep mode current 18.1uA and 13.4mA in working, theoretically the working lifetime up to 2 years, with 1000 mAh battery.

Of course, Uses can re-program it with Arduino IDE, we suggest a standard USB2UART converter for this. Note that the DTR in the USB2UART converter is needed to connect to the "Reset" pin for Arduino sketch downloading, if there is no DTR, you may need to press the “reset” button manually in the downloading.

Unlike other cheap TDS sensors that stress “temperate is an important factor to compensate” but not any solution for this, Makefabs Lora TDS sensor has integrated water temperature measurement, with DS18B20, so users can not only get the water temperature, which is also an important factor for the little fish, but also an important factory for TDS measuring.


Model: LoRa TDS sensor

LoRa TDS sensor 001.jpg

Features

  • ATMEL Atmega328P, Arduino Compatible
  • Onboard LoRa module(868Mhz or 915Mhz)
  • Communication distance: LoRa long range
  • Waterproof TDS Probe
  • TDS Measurement Range: 0 ~ 1000ppm
  • Waterproof Temperature Probe
  • Power supply by battery 3.7V with Charing circuit

Hardware

LoRa TDS sensor 002.jpg

Firmware

LoRa TDS sensor had been loaded the firmware before shipping, so it can be used directly to measure the TDS value and temperature in liquid after unpacking it. Besides, the firmware uploaded to the sensor could receive the specific instruction and do some operations.

1. The firmware is available on Github.
2. Device ID: every LoRa TDS sensor has an only ID for identification during the production, and the device ID is usually printed on the PCB.

LoRa TDS sensor 003.jpg
The ID had been coded in the firmware, but it can be changed to any if you want. Open the firmware by Arduino IDE, modify the number marked in red to yours, and upload the firmware to your board.
LoRa TDS sensor 004.jpg

3. When the LoRa TDS sensor started, it would measure the TDS level and transmit messages by LoRa communication, then it fall into sleep mode in about 60 minutes. The sleep time can be configured by the custom in the code.

//Set sleep time, when value is 1 almost sleep 20s, when value is 450, almost 1 hour.
#define SLEEP_CYCLE 2
LoRa TDS sensor output is as the following format:
LoRa TDS sensor 005.jpg


ID040002 REPLY : TDS INDEX:3 TDS:362 T:27.6 BAT:934.
It means the TDS value in liquid is 362ppm, the temperature is 27.6℃, and the power level is 934.


4. We tested the power consumption for this when working is 13mA and when sleeping is 18uA. Based on this firmware, if use a 1000mAh battery for power, it will be worked for more than 700 days.

Using Demo

1. Prepare a supply with 2.0mm 2-pins interface or a battery to power the LoRa TDS sensor.
2. Plug the TDS probe and DS18B20 probe into the board.
3. Put the TDS probe and temperature probe into the measured liquid.

LoRa TDS sensor 006.jpg

4. Prepare another LoRa device with the same frequency to receive the message that the LoRa TDS sensor sent. We provide 2 LoRa receiver solutions for it:

Use Maduino LoRa Radio to receive the measure that the TDS sensor sent by LoRa, and show it in the serial monitor.
LoRa TDS sensor 007.jpg
  • Prepare the Maduino LoRa Radio module, connect it to the PC with the USB cable.
  • Get the LoRa receiver sketch(LoRa_receiver.ino) from GitHub and open the sketch by Arduino IDE.
  • Install the LoRa library (RadioLib.h) to support the LoRa module working.
LoRa TDS sensor 010.jpg
  • Select the board ("Tool --> Board --> Arduino Pro or Pro Mini") and the port.
LoRa TDS sensor 009.jpg
  • The LoRa frequency configuration in the sketch must be changed to yours.
#define FREQUENCY 434.0  // 868.0 or 915.0

SX1278 radio = new Module(LORA_CS, DIO0, LORA_RST, DIO1, SPI, SPISettings());  //433Mhz
// SX1276 radio = new Module(LORA_CS, DIO0, LORA_RST, DIO1, SPI, SPISettings());   // 868Mhz or 915Mhz
  • Verify the sketch and upload it to the board.
  • Open the serial monitor of Arduino IDE. When restarting the LoRa TDS sensor, Maduino LoRa Radio will receive the measurement and print it on the serial monitor.
LoRa TDS sensor 008.jpg


Use MakePython ESP32 and MakePython LoRa as LoRa receiver to receive the measurement and display it on the screen.
LoRa TDS sensor 013.jpg
  • Prepare MakePython ESP32 and MakePython LoRa with the same frequency, and combine two boards with the pin.
  • Connect MakePython ESP32 to PC by the USB cable.
  • Get the receiver sketch from Github, and open it by Arduino IDE.
  • Select the development board "ESP32 Dev Module" and the port. (if you have not installed the ESP32 library, please check here to install)
  • Modify the LoRa frequency configuration to yours.
  • Upload the sketch to ESP32.
  • When resetting the LoRa TDS sensor, ESP32 will receive the measurement and display it on the screen.
LoRa TDS sensor 014.jpg


F&Q

You can list your question here or contact support@makerfabs.com for technology support. Detailed descriptions of your question will be helped to solve your question.

Recources