tds_dupont

TDS sensor

The TDS sensor is a smart solution for measuring water quality through Total Dissolved Solids. It allows you to easily connect to the micro:bit and instantly display the results on the LCD display.

Description

The analog TDS sensor is designed to measure water quality by measuring the amount of dissolved substances (Total Dissolved Solids). The TDS value indicates how many solids are contained in one liter of water - the higher the value, the more polluted the water. The sensor can be easily connected via Dupont wires. It is suitable for home and educational use, for example when testing tap water, well water or in hydroponics.

A waterproof probe is included in the package, but it must not be used in water warmer than 55°C or too close to the walls of the container to avoid distorting the results. The electronic parts outside the probe are not waterproof.

Specifications

  • Distributor: OMG Robotics
  • Input voltage: 3,3 to 5,5V
  • Output voltage: 0 to 2,3V
  • Working current: 3 to 6 mA
  • TDS measurement range: 0 to 1000 ppm
  • Endurance: Waterproof probe
  • Number of needles: 2
  • Module size: 42 × 32 mm
  • Total length: 83 cm

Connection

The probe contains a connection wire with three pins connected. Connecting it to the extension is therefore very simple - you just need to distinguish the polarity correctly.

We connect everything to the expansion board only when it is turned off. After connecting, we test the correctness of the connection.

  • A (blue) – connect to the analog input of the micro:bit.
  • + (red) – positive power supply 3,3 V.
  • – (black) – ground GND.
TDS_LCD_Connection

Program

Measurement

The principle of the program is that we read 10 values from the analog-to-digital converter (ADC), from which we calculate the arithmetic average. This eliminates random fluctuations caused by interference. The resulting analog value is then converted to voltage - the micro:bit uses a reference voltage of 3,3 V and a resolution of 10 bits (1024 steps). The measured voltage is then converted to a TDS value according to the formula recommended by the sensor manufacturer. The resulting TDS value is displayed on the LCD display, or it can be easily displayed directly on the micro:bit or other output device with a modified program.

Tasks

Task 1: Water quality assessment

Display a smiley face on the micro:bit display based on the TDS value. If the water is clean (TDS below 200 ppm), display a smiling face. If the water quality is average (200-500 ppm), display a neutral expression. If the water is dirty (above 500 ppm), the micro:bit frowns.

Task 2: TDS Bar Graph

Display a bar graph of the current TDS value on the micro:bit. Show the measured range from 0 to 1000 ppm on the display using the height of the bar.

Task 3: Pollution alert

Schedule a program to sound an alarm or flash an LED if the TDS value exceeds a specified hygienic limit – for example, 500 ppm. It is useful as a simple warning system for monitoring drinking water quality.