Analog Electrical Conductivity Sensor


DFRobot Gravity: analog electrical conductivity meter V2 is specially used to measure the electrical conductivity of aqueous solutions, and then to evaluate the water quality. This sensor is often used in water culture, aquaculture, environmental water detection and other fields.

This product, as an upgraded version of electrical conductivity meter V1, which greatly improves the user experience and measurement precision. It supports 3~5v wide voltage input, and is compatible with 5V and 3.3V main control board. The output signal is filtered by hardware and has low jitter. The excitation source adopts an AC signal, which effectively reduces the polarization effect, improves the precision and prolongs the life of the probe. The software library uses a two-point calibration method, and can automatically identify the standard buffer solution, giving the user a simple and convenient sensor.

With this product, a main control board (such as Arduino) and the software library, you can quickly build an electrical conductivity meter annd immeditly begin plug and play without welding or soldering. DFRobot provides a variety of water quality sensor products with uniform sizes and interfaces, which not only meet the needs of various water quality testing but are also suitable for the DIY of multi-parameter water quality tester.

Conductivity is the reciprocal of an objects resistivity, which is related to the ability of the material to carry the current. In a liquid, the solution's conductivity is a measure of its ability to conduct electricity. Conductivity is an important parameter of water quality. It can reflect the extent of electrolytes present in water.

The probe is a laboratory-grade probe. Do not immerse in liquid for a long time. Otherwise this will shorten the life of the probe.
Platinum black layer is attached to the surface of the sheet metal in the probe. It should avoid any object touching it. It can only be washed with distilled water, otherwise, the platinum black layer will be damaged, resulting in the inaccurate measurement.


Board Overview

Num Label Description
1 - Power GND(0V)
2 + Power VCC(3.0~5.0V)
3 A Analog Signal Output(0~3.4V)
4 BNC Probe Connector


This tutorial will demonstrate how to use this electrical conductivity meter for calibration and measurement. Please read each step carefully.

1. In order to ensure the measurement accuracy, it is strongly recommended to add a temperature sensor to measure the temperature and achieve automatic temperature compensation. DS18B20 waterproof temperature sensor can be used.
2. Before measuring another liquid, be sure to wash the probe and absorb residual water-drops with paper to prevent contamination of the liquid. You can flush the probe with distilled water.


Connection Diagram


To ensure accuracy, the probe needs to be calibrated for its first use and after not being used for an extended period of time. This tutorial uses two-point calibration and therefore requires standard buffer solutions of 1413us/cm and 12.88ms/cm. The following tutorial shows how to operate two-point calibration.




Sample Code

Please download DFRobot_EC Library first,then install it. How to install Libraries in Arduino IDE

 * file DFRobot_EC.ino
 * @
 * This is the sample code for Gravity: Analog Electrical Conductivity Sensor / Meter Kit V2 (K=1.0), SKU: DFR0300.
 * In order to guarantee precision, a temperature sensor such as DS18B20 is needed, to execute automatic temperature compensation.
 * You can send commands in the serial monitor to execute the calibration.
 * Serial Commands:
 *   enterec -> enter the calibration mode
 *   calec -> calibrate with the standard buffer solution, two buffer solutions(1413us/cm and 12.88ms/cm) will be automaticlly recognized
 *   exitec -> save the calibrated parameters and exit from calibration mode
 * Copyright   [DFRobot](, 2018
 * Copyright   GNU Lesser General Public License
 * version  V1.0
 * date  2018-03-21

#include "DFRobot_EC.h"
#include <EEPROM.h>

#define EC_PIN A1
float voltage,ecValue,temperature = 25;
DFRobot_EC ec;

void setup()

void loop()
    static unsigned long timepoint = millis();
    if(millis()-timepoint>1000U)  //time interval: 1s
      timepoint = millis();
      voltage = analogRead(EC_PIN)/1024.0*5000;   // read the voltage
      //temperature = readTemperature();          // read your temperature sensor to execute temperature compensation
      ecValue =  ec.readEC(voltage,temperature);  // convert voltage to EC with temperature compensation
      Serial.print("^C  EC:");
    ec.calibration(voltage,temperature);          // calibration process by Serail CMD

float readTemperature()
  //add your code here to get the temperature from your temperature sensor


Q. How long does the probe need to be calibrated?
A. The calibration interval is determined by the frequency of use. Normally, you can calibrate it once a month. If used frequently, it can be calibrated once a week. When calibrating, fresh standard buffer solution is recommended.
Q. How to achieve automatic temperature compensation?
A. The temperature compensation algorithm has been integrated in the DFRobot_EC library.You only need to transfer the voltage and temperature to float readEC (float voltage, float temperature) at the same time, to obtain the electrical conductivity with temperature compensation.
Q. During the calibration, is it necessary to complete two points calibration? Can I complete only one point calibration?
A. The two points calibration must be completed because the two points respectively correspond to standard buffer solution 1413us/cm and 12.88ms/cm. The two points calibration ensure the accuracy of the entire measurement range. Therefore, two points calibration must be completed.
Q. During the first calibration, the calibration always failed. What could be the reason?
A. When calibrating, the relevant parameters are stored in the specified position in EEPROM. If other data previously saved in the same position in EEPROM, there may be a conflict, resulting in an inability to calibrate properly. Use the following code to erase the contents in the specified position in EEPROM. Run it once, then upload the sample code again to restart the calibration.
 This code will reset the corresponding EEPROM used by DFRobot Gravity EC Meter K=1. SKU:DFR0300
 When uploaded this code, please open the serial monitor of the Ardino IDE. The correct value of the EEPROM block should be 255. 
#include <EEPROM.h>
#define ECADDR 0x0A
void setup()
  for(int i = 0;i < 8; i++ )
     EEPROM.write(ECADDR+i, 0xFF);// write defaullt value to the EEPROM
void loop()
  static int a = 0, value = 0;
  value =;
  Serial.print(value);// print the new value of EEPROM block used by EC meter. The correct is 255. 
  a = a + 1;
  if (a == 8)

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

More Documents