Non-contact Optical Turbidity Sensor/ Transmitter Arduino Wiki - DFRobot


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.


Communication Protocol

Controller(Master) Protocol Format: Frame Header Data Length Write Command Read Command Frame Trailer
Peripheral(Slave) Protocol Format Frame Header Data Length Write Command Response Data Frame Trailer
Controller reads dirty data 0X18 0X05 0X00 0X01 0X0D
Peripheral sends data 0X18 0X05 0X00/0XAA 0X00-0XFF 0X0D
Peripheral reads AD data 0X18 0X05 0X00 0X02 0X0D
Peripheral sends AD value 0X18 0X05 0X00/0XAA 0X00-0X0F/0X00-0XFF 0X0D
Controller Calibration 0X18 0X05 0X55 0X00 0X0D
Calibration transmitting succeeded 0X18 0X05 0XAA 0X00 0X0D
Controller clears calibration 0X18 0X05 0X5A 0X00 0X0D
Calibration clearing succeeded 0X18 0X05 0X00 0X00 0X0D

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 Gravity: 4Pin Sensor Adapter and Gravity-4P Cable (PH2.0 to 2.54 DuPont female). The connections are as shown in the table below.

Sensor Adapter UNO
RX IO1 11(TX)
TX IO2 12(RX)


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




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()
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++)


  1. How does the sensor output reflect the liquid turbidity?

The relation between the sensor output and turbidity is shown as the curve below.

For any other questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Turbidity Sensor from DFRobot Store or DFRobot Distributor.

Turn to the Top