Introduction

This non-contact turbidity sensor detects water quality by measuring the level of turbidity. Based on optics principle, it is capable of detecting light transmittance and scattering rate of the liquid in transparent cylinder containers with a diameter of 40-50mm, which then will be output as an analog value within a certain range that reflects the level of liquid turbidity.
The turbidity sensor comes with two infrared probes, which should be oppositely installed on a container. And it starts to detect when the liquid level inside is higher than the two probes. The sensor can do measuring without contacting liquid, thus means less prone to damage caused by water or chemical corrosion.

Specification

  • Operating Voltage: 5V

  • Operating Current: <10mA(Max)

  • Response Time: <1s (VDD=5V Ta=25℃)

  • Operating Temperature: 5-60℃

  • Storage Temperature: 0-65℃

  • Service Life: 50000h (VDD=5V Ta=25℃)

  • Communication Mode: TTL

    1.Baud rate: 9600

    2.Data bit: 8bit

    3.Parity bit: none

    4.Stop bit: 1bit

Communication Protocol

Controller(Master) Protocol Format:Frame HeaderData LengthWrite CommandRead CommandFrame Trailer
Peripheral(Slave) Protocol FormatFrame HeaderData LengthWrite Command ResponseDataFrame Trailer
Controller reads dirty data0X180X050X000X010X0D
Peripheral sends data0X180X050X00/0XAA0X00-0XFF0X0D
Peripheral reads AD data0X180X050X000X020X0D
Peripheral sends AD value0X180X050X00/0XAA0X00-0X0F/0X00-0XFF0X0D
Controller Calibration0X180X050X550X000X0D
Calibration transmitting succeeded0X180X050XAA0X000X0D
Controller clears calibration0X180X050X5A0X000X0D
Calibration clearing succeeded0X180X050X000X000X0D

Connection Diagram

The sensor communicates with MCU via TTL and transmits the data through serial port after detecting different turbidity data.

Sensor Wiring Sequence Definition

Black=GND Blue=TX Red=VCC White=RX

Recommended connection diagram

Here we connect the sensor to the UNO board using 4Pin Sensor Adapter and 4P Cable (PH2.0 to 2.54 DuPont female). The connections are as shown in the table below.

SensorAdapterUNO
GNDGNDGND
VCCVOUTVCC
RXIO111(TX)
TXIO212(RX)

Installation

The two probes should be oppositely fixed on a transparent container.


Tutorial

Hardware Required

  • Arduino UNO R3 (or similar) × 1
  • Turbidity Sensor × 1
  • 4Pin Sensor Adapter × 1
  • Micro USB Cable × 1
  • 4P Cable (PH2.0 to 2.54 DuPont female) × 1

Sample Code

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
unsigned char str[5] = { }; //Serial receives data
unsigned char col;
unsigned int distance = 0;
unsigned char a[5] = {
  0x18,0x05, 0x00, 0x01 ,0x0D
};
void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}
void loop() {
  mySerial.write(a, 5);
  while (!mySerial.available());
  while (mySerial.available() > 0) //Detect if there is data on serial port 
  {
      for (int i = 0; i < 5; i++)
      {
        str[i]=mySerial.read();
        delay(5);
      }
      Serial.println(str[3],DEC);
      mySerial.flush();
  } 
  delay(500);
}