Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.

EC Sensor Arduino: Electrical Conductivity Measurement

Electrical conductivity measurement plays a critical role in water quality monitoring, hydroponics, aquaculture, and environmental testing. The EC Sensor Arduino combination provides an affordable yet accurate solution for quantifying dissolved ions in water. After integrating these sensors into numerous water monitoring projects, I’ve found them remarkably capable when properly calibrated and implemented.

This guide covers everything needed to build a functional conductivity meter using Arduino, from understanding the measurement principles to implementing temperature-compensated code examples.

What Is Electrical Conductivity?

Electrical conductivity (EC) measures a solution’s ability to conduct electrical current. Pure water conducts electricity poorly, but dissolved ions like salts, minerals, and nutrients dramatically increase conductivity. The more dissolved ions present, the higher the conductivity reading.

EC is essentially the reciprocal of electrical resistance. While resistance measures how much a material opposes current flow, conductivity measures how easily current passes through. In liquid solutions, conductivity reflects the concentration of electrolytes present in the water.

Why Measure Electrical Conductivity?

ApplicationPurposeTypical EC Range
Drinking WaterPurity assessment50 – 500 µS/cm
HydroponicsNutrient concentration monitoring1000 – 3000 µS/cm
AquacultureFish tank water quality100 – 2000 µS/cm
Swimming PoolsChemical balance verification1000 – 4000 µS/cm
WastewaterTreatment process control500 – 20000 µS/cm
Soil TestingSalinity assessmentVariable

In hydroponics, EC monitoring is essential because it directly indicates nutrient concentration in the growing solution. Too low means plants aren’t receiving adequate nutrition; too high can cause nutrient burn and root damage. Similarly, in aquaculture, stable EC helps maintain healthy conditions for fish and other aquatic life.

Understanding EC Units

Electrical conductivity is commonly expressed in several units:

UnitSymbolRelationship
Siemens per centimeterS/cmBase unit
Millisiemens per centimetermS/cm1 mS/cm = 0.001 S/cm
Microsiemens per centimeterµS/cm1 µS/cm = 0.001 mS/cm
Parts per millionppmApproximate: 1 mS/cm ≈ 500-700 ppm

Most EC Sensor Arduino modules report values in mS/cm or µS/cm. The conversion to ppm (also called TDS – Total Dissolved Solids) involves a conversion factor that varies depending on the specific ions present. A commonly used factor is 0.5 to 0.7.

How EC Sensors Work

EC sensors measure conductivity by passing a small electrical current between two or more electrodes immersed in the solution. The amount of current that flows depends on the ion concentration between the electrodes.

Two-Electrode vs Four-Electrode Methods

Most affordable EC Sensor Arduino modules use a two-electrode design. Two metal plates (typically stainless steel or platinum-coated) serve as both the excitation source and measurement points. When voltage is applied, current flows through the solution, and the resulting voltage drop indicates conductivity.

More sophisticated industrial sensors use four electrodes. Two outer electrodes supply excitation current while two inner electrodes measure voltage. This configuration eliminates errors from electrode polarization and contact resistance, providing higher accuracy across wider measurement ranges.

The Cell Constant (K)

The cell constant represents the geometric relationship between electrode spacing and surface area. It’s expressed in cm⁻¹ and affects the measurement range.

Cell ConstantMeasurement RangeApplication
K = 0.10.5 – 400 µS/cmUltra-pure water
K = 1.010 – 20000 µS/cmGeneral purpose, hydroponics
K = 101 – 200 mS/cmHigh conductivity solutions

For most Arduino projects involving drinking water, hydroponics, or aquarium monitoring, K=1.0 sensors provide the optimal range and are the most commonly available.

EC Sensor Arduino Module Specifications

Understanding your sensor’s specifications ensures proper implementation and accurate results.

DFRobot Gravity EC Sensor V2 Specifications

ParameterValue
Operating Voltage3.0V – 5.0V
Output SignalAnalog (0 – 3.4V)
Measurement Range1 – 20 mS/cm (K=1.0)
Measurement Accuracy±5% F.S.
Operating Temperature5°C – 40°C
Probe TypeLaboratory grade
InterfaceGravity 3-pin analog
Board Dimensions42mm × 32mm

EC Sensor Module Pinout

PinLabelFunction
1VCCPower supply (3-5V)
2GNDGround reference
3SignalAnalog output voltage

The analog output voltage is proportional to the conductivity of the solution. Higher conductivity produces higher output voltage, which the Arduino’s ADC converts to digital values for processing.

Wiring EC Sensor to Arduino

The basic wiring for an EC Sensor Arduino setup requires only three connections.

Basic Wiring Connections

EC SensorArduino Uno
VCC5V
GNDGND
SignalA1

Complete System with Temperature Compensation

For accurate EC measurement, temperature compensation is essential. Add a DS18B20 waterproof temperature sensor to your setup:

ComponentArduino Uno
EC Sensor VCC5V
EC Sensor GNDGND
EC Sensor SignalA1
DS18B20 VCC5V
DS18B20 GNDGND
DS18B20 DataD2
4.7K ResistorBetween Data and VCC

Temperature compensation is critical because conductivity increases approximately 2% per degree Celsius. Without compensation, a reading taken at 30°C would differ significantly from the same solution measured at 20°C.

Installing EC Sensor Arduino Libraries

The DFRobot EC library simplifies calibration and measurement significantly. Install it through the Arduino Library Manager.

Required Libraries

  1. DFRobot_EC – Main EC sensor library
  2. OneWire – For DS18B20 temperature sensor
  3. DallasTemperature – Temperature sensor interface
  4. EEPROM – Stores calibration values

Installation Steps

  1. Open Arduino IDE
  2. Navigate to Sketch → Include Library → Manage Libraries
  3. Search for “DFRobot_EC” and install
  4. Search for “OneWire” and install
  5. Search for “DallasTemperature” and install

The DFRobot_EC library stores calibration parameters in Arduino’s EEPROM, so calibration persists across power cycles.

Calibrating the EC Sensor Arduino

Proper calibration is essential for accurate EC measurements. The sensor requires two-point calibration using standard buffer solutions.

Required Calibration Solutions

SolutionEC ValuePurpose
Low Standard1.413 mS/cmLower calibration point
High Standard12.88 mS/cmUpper calibration point

These standard solutions are available from sensor suppliers or scientific supply companies. Keep them sealed when not in use, as evaporation can change their concentration.

Two-Point Calibration Procedure

  1. Upload the calibration code to Arduino
  2. Open Serial Monitor at 115200 baud
  3. Rinse probe with distilled water and dry with lint-free tissue
  4. Type “enterec” to enter calibration mode
  5. Immerse probe in 1.413 mS/cm solution
  6. Wait for readings to stabilize (approximately 30 seconds)
  7. Type “calec” to calibrate the low point
  8. Rinse and dry the probe
  9. Immerse probe in 12.88 mS/cm solution
  10. Wait for stable readings
  11. Type “calec” to calibrate the high point
  12. Type “exitec” to save and exit calibration mode

The library automatically identifies which standard solution the probe is in and applies the appropriate calibration.

EC Sensor Arduino Code Examples

Let me share the code patterns that have worked reliably across my projects.

Basic EC Measurement with Temperature Compensation

#include “DFRobot_EC.h”

#include <EEPROM.h>

#include <OneWire.h>

#include <DallasTemperature.h>

#define EC_PIN A1

#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature tempSensor(&oneWire);

DFRobot_EC ec;

float voltage, ecValue, temperature;

void setup() {

  Serial.begin(115200);

  ec.begin();

  tempSensor.begin();

  Serial.println(“EC Sensor Arduino – Ready”);

}

void loop() {

  static unsigned long timepoint = millis();

  if (millis() – timepoint > 1000U) {

    timepoint = millis();

    // Read temperature

    tempSensor.requestTemperatures();

    temperature = tempSensor.getTempCByIndex(0);

    // Read EC with temperature compensation

    voltage = analogRead(EC_PIN) / 1024.0 * 5000;

    ecValue = ec.readEC(voltage, temperature);

    Serial.print(“Temperature: “);

    Serial.print(temperature, 1);

    Serial.print(“°C  EC: “);

    Serial.print(ecValue, 2);

    Serial.println(” mS/cm”);

  }

  // Handle calibration commands

  ec.calibration(voltage, temperature);

}

EC Meter with LCD Display

#include “DFRobot_EC.h”

#include <EEPROM.h>

#include <OneWire.h>

#include <DallasTemperature.h>

#include <LiquidCrystal_I2C.h>

#define EC_PIN A1

#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature tempSensor(&oneWire);

DFRobot_EC ec;

LiquidCrystal_I2C lcd(0x27, 16, 2);

float voltage, ecValue, temperature;

void setup() {

  Serial.begin(115200);

  ec.begin();

  tempSensor.begin();

  lcd.init();

  lcd.backlight();

  lcd.setCursor(0, 0);

  lcd.print(“EC Meter Ready”);

  delay(2000);

  lcd.clear();

}

void loop() {

  static unsigned long timepoint = millis();

  if (millis() – timepoint > 1000U) {

    timepoint = millis();

    tempSensor.requestTemperatures();

    temperature = tempSensor.getTempCByIndex(0);

    voltage = analogRead(EC_PIN) / 1024.0 * 5000;

    ecValue = ec.readEC(voltage, temperature);

    // Display on LCD

    lcd.setCursor(0, 0);

    lcd.print(“EC: “);

    lcd.print(ecValue, 2);

    lcd.print(” mS/cm  “);

    lcd.setCursor(0, 1);

    lcd.print(“Temp: “);

    lcd.print(temperature, 1);

    lcd.print(” C    “);

    // Serial output for logging

    Serial.print(temperature);

    Serial.print(“,”);

    Serial.println(ecValue);

  }

  ec.calibration(voltage, temperature);

}

Converting EC to TDS (PPM)

float ecToTDS(float ecValue, float conversionFactor) {

  // conversionFactor typically 0.5 to 0.7

  // 0.5 for sodium chloride

  // 0.64 for hydroponics nutrients (common default)

  // 0.7 for mixed ions

  return ecValue * conversionFactor * 1000;  // Returns ppm

}

// Usage in loop:

float tds = ecToTDS(ecValue, 0.64);

Serial.print(“TDS: “);

Serial.print(tds, 0);

Serial.println(” ppm”);

Probe Care and Maintenance

EC probes require proper care to maintain accuracy and longevity.

Handling Guidelines

The platinum black coating on quality EC probes is delicate. Never touch the electrode surfaces with fingers or abrasive materials. Clean only with distilled water and allow to air dry or use lint-free tissue.

Storage Recommendations

Storage DurationMethod
Short-term (hours)Keep in distilled water
Long-term (days+)Store dry in protective cap
Extended storageRecalibrate before use

Important Precautions

Laboratory-grade probes should not remain submerged continuously. For 24/7 monitoring applications, use industrial-grade probes specifically designed for continuous immersion. The platinum black layer can degrade if left in solution indefinitely.

Useful Resources for EC Sensor Arduino Projects

ResourceURLDescription
DFRobot Wikiwiki.dfrobot.comOfficial documentation and tutorials
DFRobot_EC Librarygithub.com/DFRobotArduino library source code
Arduino Referencearduino.cc/referenceProgramming documentation
Seeed Studio Wikiwiki.seeedstudio.comGrove EC sensor guide
Cave Pearl Projectthecavepearlproject.orgIn-depth EC measurement theory

Component Sources:

  • DFRobot (dfrobot.com) – Gravity EC Sensor kits with calibration solutions
  • Seeed Studio (seeedstudio.com) – Grove EC Sensor Kit
  • Arduino Store (store.arduino.cc) – Official sensor availability
  • Amazon – Various compatible modules

FAQs About EC Sensor Arduino Projects

Why does my EC Sensor Arduino show different readings at different temperatures?

Temperature significantly affects electrical conductivity. Ions move faster in warmer water, increasing conductivity approximately 2% per degree Celsius. Without temperature compensation, a solution measuring 2.0 mS/cm at 25°C might read 2.4 mS/cm at 35°C despite no change in actual ion concentration. Always use a temperature sensor alongside your EC probe and apply the compensation algorithm included in the DFRobot_EC library for accurate, comparable readings.

Can I use the same EC Sensor Arduino setup for both hydroponics and drinking water testing?

Yes, but you may need to consider the measurement range. A K=1.0 sensor covers 1-20 mS/cm, suitable for hydroponics nutrients (typically 1-3 mS/cm) but potentially too insensitive for ultra-pure drinking water (50-500 µS/cm). For drinking water testing, a K=0.1 probe provides better resolution at lower conductivity levels. However, for general household tap water quality assessment, a K=1.0 probe works adequately.

How often should I calibrate my EC sensor?

Calibrate your EC sensor before first use and whenever readings seem inconsistent with expected values. For regular use, calibration every 1-2 months maintains accuracy. If you notice drift in readings, visible contamination on the probe, or have stored the sensor for an extended period, recalibrate before taking measurements. Keep calibration solutions sealed and replace them if they appear contaminated or have been open for more than six months.

My pH and EC readings change when both sensors are in the same solution. What’s happening?

This common issue results from electrical interference between sensors. When both pH and EC probes share the same solution, ground loops and stray currents can affect readings, particularly the high-impedance pH sensor. Solutions include using isolated signal conditioners, switching sensors on/off alternately rather than simultaneously, maintaining adequate physical distance between probes, or using optically isolated interface boards. The DFRobot library includes timing that helps minimize this interference.

What’s the difference between EC and TDS measurements?

EC (Electrical Conductivity) directly measures a solution’s ability to conduct electricity, expressed in mS/cm or µS/cm. TDS (Total Dissolved Solids) estimates the mass of dissolved substances per unit volume, expressed in ppm (parts per million) or mg/L. TDS is calculated from EC using a conversion factor that varies depending on the dissolved substances (typically 0.5-0.7). EC is the actual measured value, while TDS is a derived estimate. For hydroponics and aquarium use, either unit works as long as you’re consistent.

Conclusion

The EC Sensor Arduino combination provides an accessible path into electrical conductivity measurement for water quality monitoring, hydroponics, aquaculture, and educational projects. With proper calibration and temperature compensation, these affordable sensors deliver accuracy sufficient for most non-laboratory applications.

Start with the basic code example to verify your hardware functions correctly, then implement temperature compensation for accurate, repeatable measurements. Remember that calibration is essential, probe care affects longevity, and temperature has a significant impact on readings.

For comprehensive water quality monitoring systems, consider combining EC measurement with pH and turbidity sensors to create a complete solution that provides multiple indicators of water condition. The standardized interfaces from manufacturers like DFRobot make building multi-parameter systems straightforward.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.

  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.

Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.