Electrical conductivity reading with DFrobot EC-meter

Hi friends :slight_smile:

can anybody tell me why my Blynk app and serial monitor in Arduino IDE keep getting the same EC value? It’s only printing a value of 20,117. I have tried with two different functions (one is commented out in the Void sendSensor. the result of both functions is still 20,117…

hope someone knows what to do! :smile:
best Frederik

#define BLYNK_PRINT Serial

#include "DFRobot_ESP_EC.h"
#include "EEPROM.h"

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

DFRobot_ESP_EC ec;
#define ESPADC 4096.0   //the esp Analog Digital Convertion value
#define ESPVOLTAGE 3300 //the esp voltage supply value
#define ECPIN 15

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";

BlynkTimer timer;

float voltage, ecValue, temperature = 25;

void sendSensor()

  float  temperature = 25;
  float voltage = analogRead (ECPIN)/4095*3300;
  float  ecValue = ec.readEC(voltage , temperature);

  if (isnan (ecValue)){
    Serial.println("Failed to read from EC Probe!");
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
 Blynk.virtualWrite(V7, ecValue); //// another try out :-D


  static unsigned long timepoint = millis();
  if (millis() - timepoint > 1000U) //time interval: 1s
    timepoint = millis();
    //voltage = rawPinValue / esp32ADC * esp32Vin
    voltage = analogRead(ECPIN) / ESPADC * ESPVOLTAGE; // read the voltage
    ecValue = ec.readEC(voltage, temperature); // convert voltage to pH with temperature compensation
    Serial.println(ecValue, 4);
    Blynk.virtualWrite(V7, ecValue);
  ec.calibration(voltage, temperature); // calibration process by Serail CMD

void setup()
  EEPROM.begin(32);//needed EEPROM.begin to store calibration k in eeprom
  ec.begin();//by default lib store calibration k since 10 change it by set ec.begin(30); to start from 30

   Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);

void loop()


GPIO15 is an ADC2 pin…




Hi Pete,

thanks for the support and the quick respond :smile:

I have tried using pin 27 instead but the values are still constant… I have also tried to do the same sketch (with modification) for my pH meter. there the values are also constant showing value on -3,137

Have you actually read and understood the link I provided?

If so, then I can’t understand why you would switch from one ADC2 pin to another ADC2 pin, when you need to use an ADC1 pin instead.


Ohh I’m sorry I thought that pin27 was ADC1 :open_mouth: I will try with GPIO32.
thank you so much.

Hi Pete, its up and running and working as it should. You really made my day!

1 Like

hi frederik, is it possible to get from you the schematic diagram for the connection of ec sensor to esp 32. I am currently a newbie here, thanks in advance