Close

Three Dollar EC - PPM Meter [Arduino]

A project log for Hacking the way to growing food

Using Technology And A Hackers Mindset To Grow Food. Last Updated [16/01/2021]

michael-ratcliffeMichael Ratcliffe 09/04/2015 at 13:56154 Comments

This Blog will Cover How to build a cheap EC meter for your aquaponics/Hydroponics or water quality related projects. We are not going to get into what the ideal value of PPM or EC is, Just cover how to measure and quantify a fluid.

We will be using this for the Urine based aquaponics unit, we need to be able to control the strength of the growing fluid in the system but for the person on a budget a EC meter is just to much money. the Solution a $3 EC Meter for any Arduino.

You can use this to measure drinking water quality to with a small change to the code and changing R1 [see below].

Parts:

-MCU of your choice with ADC

-DS18B20 waterproof temperature sensor

-500 ohm [or 1kohm resistor]

-Type A Two Prong american plug to Figure 8

-Female Socket for Figure 8 connector

So why are we using a plug:

-Cheap

-Available worldwide

-Standard size [makes calibration easy]

Use the solid prong one like below and not the one with holes:

images.jpg

Wiring it up:

Note: You want the Solid Prong type plug

Do not Plug the pronged plug into the mains

Pinout.png

Operating Principal

PPM is calculated from the EC of a fluid, EC is the inverse of the electrical resistance of the fluid. We are estimating the EC or PPM of a fluid by measuring the resistance between two probes [The plug pins] when the plug is submerged in the liquid of interest.

Ec measurement needs to be done using AC or the liquid of interest is polarised and will give bad readings. This has got to be a great example of asking why instead of just accepting a statement as fact, it turns out we can take a very fast DC reading without suffering polarisation. meaning we can make a really cheap EC sensor.

Want to use it and dont care how it works? Skip to the main EC code and using the wiring diagram it will work.

Temperature Compensation

Temperature has an effect on the conductivity of fluids so it is essential that we compensate for this.

It is common to use a liner approximation for small temperature changes[1] to convert them to their equivelant EC at 25*C:

EC25 = EC /( 1 + a (T - 25) )

EC25- Equivelant EC at 25'C

EC - Measured EC

T- Temperature [Decgrees C] of Measurment

a = 0.019 °C [Commonly used for nutrient solutions]

Deciding on Value of R1

//##################################################################################

//----------- Do not Replace R1 with a resistor lower than 300 ohms ------------

//##################################################################################

We can change the Value of R1 in the voltage divider to change the range of EC we want to measure. Below is the Equivalent Voltage divider circuit.

Voltage Divider.png

Ra

Ra the resistance of the digital pins is not stated in the data sheet instead we need to pull it out from a graph.

Going off the graph on page [387] of the atmel 2560 Data Sheet “Figure 32-25. I/O Pin Output Voltage vs. Source Current (VCC = 5V)”

V=IR

Ra= V/I [From Figure] V=0.4 I=1.5e-4 R=25 ohms estimated

Rc


Rc will change with EC [PPM] of the measured fluid. we will calculate the maximum and minimum values we expect to see for the range of fluids we wish to measure taking into account temperature changes and the cell constant K. [We will estimate K to be 3 for the plug probe, estimate from previous tests]

EC = EC25*( 1 + a (T - 25))

R=(1000/(EC*K)) +Ra

Min temp=0 [we arnt going to care about EC if the pond is frozen]

Max Temp = 40 *C [I doubt a pond should be above this]

Minimum EC 25=0.3 EC= 0.3*(1+0.019*(0-25) Min EC= 0.16 S/sm

Maximum EC 25= 3 EC= 0.3*(1+0.019*(40-25) Max EC = 3.9 S/cm

Min Resistance = 1000/(MaxEC*K)+25 = 1000(3.9*2.88) =114 ohms

Max Resitance = 1000/(MinEC*K)+25 = 1000/(0.16*2.88) = 2195 ohms

R1

Now we have enough information to calculate a good value for R1 to get the best resolution over our intended measuring range. We could sum it all up mathematically and differentiate to find the peak, but that hurts my head so I just did a quick excel spreadsheet for the Voltage divider for the EC I expect to see:

Exel.png


As we can see we get the largest difference using a value for R1 of 500 ohm, I only had 1Kohm to hand so I will have to live with a little less range.

So we chose a 500 ohm resistor

EC – Range /Voltage Range * (5/ADC steps)

(3.9-0.16)/3.14 * 5/1024 = 5.8e-3 resolution so that is a resolution of 0.0058

To put this is PPM [Tranchen [Australia] PPMconversion: 0.7] this is a resolution of 4ppm.

Much more than we need for aquaponics or hydroponics.

If you want to measure the quality of drinking water you will need to calculate the expected Ec values and increase R1 accordingly.


Calibration Code

If you want the best readings from your system it is advisable to calibrate your sensor with some known fluid. But If you dont need to if you use the plug probe shown above, it will still work well.

>Add your EC in S/cm into the definitions

>Plug your K value from the terminal window into the main EC code

you will need to use the modified one wire and Dallas library [download from www.michaelratcliffe.com] or add a pull up for the temperature probe data line [google it]

/*
  ElCheapo Arduino EC-PPM measurments Calibration
 
  This Script is used for calibration of the sensor and fine tuning of the Cell Constant K
  Submerge the sensor and temperature probe in the calibration solution and leave for a while so the temperature probe can settle
  Change the value of the calibration solution to suit the solutiton strength
  Stir the probe to make sure the solution is well mixed and upload the code to the arduino
  Open the terminal for an update of the estimated Cell Constant K [should be around 3] and use this new value in the main EC code.
 
 
  28/8/2015  Michael Ratcliffe  Mike@MichaelRatcliffe.com
 
 
          This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see .
 
    Parts:
    -Arduino - Uno/Mega
    -Standard American two prong plug
    -1 kohm resistor
    -DS18B20 Waterproof Temperature Sensor
 
 
    See www.MichaelRatcliffe.com/Projects for a Pinout and user guide or consult the Zip you got this code from
 
*/
 
 
//************************** Libraries Needed To Compile The Script [See Read me In Download] ***************//
// Both below Library are custom ones [ SEE READ ME In Downloaded Zip If You Dont Know how To install Use them or add a pull up resistor to the temp probe
 
 
#include <OneWire.h>
#include <DallasTemperature.h>
 
 
 
 
 
 
//************************* User Defined Variables ********************************************************//
 
 
float CalibrationEC=1.38; //EC value of Calibration solution is s/cm
 
 
 
 
//##################################################################################
//-----------  Do not Replace R1 with a resistor lower than 300 ohms    ------------
//##################################################################################
 
 
int R1= 1000;
int Ra=25; //Resistance of powering Pins
int ECPin= A0;
int ECGround=A1;
int ECPower =A4;
 
 
//*************Compensating for temperature ************************************//
//The value below will change depending on what chemical solution we are measuring
//0.019 is generaly considered the standard for plant nutrients [google "Temperature compensation EC" for more info
float TemperatureCoef = 0.019; //this changes depending on what chemical we are measuring
 
 
 
 
//************ Temp Probe Related *********************************************//
#define ONE_WIRE_BUS 10          // Data wire For Temp Probe is plugged into pin 10 on the Arduino
const int TempProbePossitive =8;  //Temp Probe power connected to pin 9
const int TempProbeNegative=9;    //Temp Probe Negative connected to pin 8
 
 
 
 
//***************************** END Of Recomended User Inputs *****************************************************************//
 
 
OneWire oneWire(ONE_WIRE_BUS);// Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire);// Pass our oneWire reference to Dallas Temperature.
 
 
float TemperatureFinish=0;
float TemperatureStart=0;
float EC=0;
int ppm =0;
 
 
float raw= 0;
float Vin= 5;
float Vdrop= 0;
float Rc= 0;
float K=0;
 
 
 
 
int i=0;
float buffer=0;
 
 
//*********************************Setup - runs Once and sets pins etc ******************************************************//
void setup()
{
  Serial.begin(9600);
  pinMode(TempProbeNegative , OUTPUT ); //seting ground pin as output for tmp probe
  digitalWrite(TempProbeNegative , LOW );//Seting it to ground so it can sink current
  pinMode(TempProbePossitive , OUTPUT );//ditto but for positive
  digitalWrite(TempProbePossitive , HIGH );
  pinMode(ECPin,INPUT);
  pinMode(ECPower,OUTPUT);//Setting pin for sourcing current
  pinMode(ECGround,OUTPUT);//setting pin for sinking current
  digitalWrite(ECGround,LOW);//We can leave the ground connected permanantly
 
  delay(100);// gives sensor time to settle
  sensors.begin();
  delay(100);
  //** Adding Digital Pin Resistance to [25 ohm] to the static Resistor *********//
  // Consule Read-Me for Why, or just accept it as true
  R1=(R1+Ra);
 
  Serial.println("ElCheapo Arduino EC-PPM measurments Calibration");
  Serial.println("By: Michael Ratcliffe  Mike@MichaelRatcliffe.com");
  Serial.println("Free software: you can redistribute it and/or modify it under GNU ");
  Serial.println("");
  Serial.println("Make sure Probe and Temp Sensor are in Solution and solution is well mixed");
  Serial.println("");
  Serial.println("Starting Calibration: Estimated Time 60 Seconds:");
 
 
 
};
//******************************************* End of Setup **********************************************************************//
 
 
 
 
//************************************* Main Loop - Runs Forever ***************************************************************//
//Moved Heavy Work To subroutines so you can call them from main loop without cluttering the main loop
void loop()
{
 
 
  i=1;
  buffer=0;
sensors.requestTemperatures();// Send the command to get temperatures
TemperatureStart=sensors.getTempCByIndex(0); //Stores Value in Variable
 
 
//************Estimates Resistance of Liquid ****************//
while(i<=10){
 
 
 
digitalWrite(ECPower,HIGH);
raw= analogRead(ECPin);
raw= analogRead(ECPin);// This is not a mistake, First reading will be low
digitalWrite(ECPower,LOW);
buffer=buffer+raw;
i++;
delay(5000);
};
raw=(buffer/10);
 
 
 
 
sensors.requestTemperatures();// Send the command to get temperatures
TemperatureFinish=sensors.getTempCByIndex(0); //Stores Value in Variable
 
 
//*************Compensating For Temperaure********************//
EC =CalibrationEC*(1+(TemperatureCoef*(TemperatureFinish-25.0))) ;
 
//***************** Calculates R relating to Calibration fluid **************************//
Vdrop= (((Vin)*(raw))/1024.0);
Rc=(Vdrop*R1)/(Vin-Vdrop);
Rc=Rc-Ra;
K= 1000/(Rc*EC);
 
 
 
 
Serial.print("Calibration Fluid EC: ");
Serial.print(CalibrationEC);
Serial.print(" S  ");  //add units here
Serial.print("Cell Constant K");
Serial.print(K);
 
 
if (TemperatureStart==TemperatureFinish){
  Serial.println("  Results are Trustworthy");
  Serial.println("  Safe To Use Above Cell Constant in Main EC code");
 
}
else{
  Serial.println("  Error -Wait For Temperature To settle");
 
}
 
 
}
//************************************** End Of Main Loop **********************************************************************//

EC PPM Measurement Code

>If you are using PPM and not EC make sure you note what conversion factor you are using [it isnt universal]

>Dont call the read function more than once every 5 seconds or you will get bad readings and a damaged probe

I tested this code in a solution for 48 hours reading at 5 second intervals without any polarisation or probe damage, the longer you leave between readings the longer your probe will last. 5 seconds is the minimum wait between readings not the maximum.

you will need to use the modified one wire and Dallas library [download from www.michaelratcliffe.com] or add a pull up for the temperature probe data line [google it]

/*
  ElCheapo Arduino EC-PPM measurments
 
  This scrip uses a common USA two prong plug and a 47Kohm Resistor to measure the EC/PPM of a Aquaponics/Hydroponics Sytem.
  You could modift this code to Measure other liquids if you change the resitor and values at the top of the code.
 
  This Program will give you a temperature based feed controller. See Read me in download file for more info.
 
  28/8/2015  Michael Ratcliffe  Mike@MichaelRatcliffe.com
 
 
          This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see .
 
    Parts:
    -Arduino - Uno/Mega
    -Standard American two prong plug
    -1 kohm resistor
    -DS18B20 Waterproof Temperature Sensor
 
    Limitations:
    -
    -
 
    See www.MichaelRatcliffe.com/Projects for a Pinout and user guide or consult the Zip you got this code from
 
*/
 
 
//************************** Libraries Needed To Compile The Script [See Read me In Download] ***************//
// Both below Library are custom ones [ SEE READ ME In Downloaded Zip If You Dont Know how To install] Use them or add a pull up resistor to the temp probe
 
 
#include <OneWire.h>
#include <DallasTemperature.h>
 
 
 
 
 
 
//************************* User Defined Variables ********************************************************//
 
 
//##################################################################################
//-----------  Do not Replace R1 with a resistor lower than 300 ohms    ------------
//##################################################################################
 
 
int R1= 1000;
int Ra=25; //Resistance of powering Pins
int ECPin= A0;
int ECGround=A1;
int ECPower =A4;
 
 
//*********** Converting to ppm [Learn to use EC it is much better**************//
// Hana      [USA]        PPMconverion:  0.5
// Eutech    [EU]          PPMconversion:  0.64
//Tranchen  [Australia]  PPMconversion:  0.7
// Why didnt anyone standardise this?
 
 
float PPMconversion=0.7;
 
 
//*************Compensating for temperature ************************************//
//The value below will change depending on what chemical solution we are measuring
//0.019 is generaly considered the standard for plant nutrients [google "Temperature compensation EC" for more info
float TemperatureCoef = 0.019; //this changes depending on what chemical we are measuring
 
 
 
 
//********************** Cell Constant For Ec Measurements *********************//
//Mine was around 2.9 with plugs being a standard size they should all be around the same
//But If you get bad readings you can use the calibration script and fluid to get a better estimate for K
float K=2.88;
 
 
 
 
//************ Temp Probe Related *********************************************//
#define ONE_WIRE_BUS 10          // Data wire For Temp Probe is plugged into pin 10 on the Arduino
const int TempProbePossitive =8;  //Temp Probe power connected to pin 9
const int TempProbeNegative=9;    //Temp Probe Negative connected to pin 8
 
 
 
 
//***************************** END Of Recomended User Inputs *****************************************************************//
 
 
OneWire oneWire(ONE_WIRE_BUS);// Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire);// Pass our oneWire reference to Dallas Temperature.
 
 
float Temperature=10;
float EC=0;
float EC25 =0;
int ppm =0;
 
 
float raw= 0;
float Vin= 5;
float Vdrop= 0;
float Rc= 0;
float buffer=0;
 
 
 
 
//*********************************Setup - runs Once and sets pins etc ******************************************************//
void setup()
{
  Serial.begin(9600);
  pinMode(TempProbeNegative , OUTPUT ); //seting ground pin as output for tmp probe
  digitalWrite(TempProbeNegative , LOW );//Seting it to ground so it can sink current
  pinMode(TempProbePossitive , OUTPUT );//ditto but for positive
  digitalWrite(TempProbePossitive , HIGH );
  pinMode(ECPin,INPUT);
  pinMode(ECPower,OUTPUT);//Setting pin for sourcing current
  pinMode(ECGround,OUTPUT);//setting pin for sinking current
  digitalWrite(ECGround,LOW);//We can leave the ground connected permanantly
 
  delay(100);// gives sensor time to settle
  sensors.begin();
  delay(100);
  //** Adding Digital Pin Resistance to [25 ohm] to the static Resistor *********//
  // Consule Read-Me for Why, or just accept it as true
  R1=(R1+Ra);// Taking into acount Powering Pin Resitance
 
  Serial.println("ElCheapo Arduino EC-PPM measurments");
  Serial.println("By: Michael Ratcliffe  Mike@MichaelRatcliffe.com");
  Serial.println("Free software: you can redistribute it and/or modify it under GNU ");
  Serial.println("");
  Serial.println("Make sure Probe and Temp Sensor are in Solution and solution is well mixed");
  Serial.println("");
  Serial.println("Measurments at 5's Second intervals [Dont read Ec morre than once every 5 seconds]:");
 
 
};
//******************************************* End of Setup **********************************************************************//
 
 
 
 
//************************************* Main Loop - Runs Forever ***************************************************************//
//Moved Heavy Work To subroutines so you can call them from main loop without cluttering the main loop
void loop()
{
 
 
 
 
GetEC();          //Calls Code to Go into GetEC() Loop [Below Main Loop] dont call this more that 1/5 hhz [once every five seconds] or you will polarise the water
PrintReadings();  // Cals Print routine [below main loop]
 
 
delay(5000);
 
 
}
//************************************** End Of Main Loop **********************************************************************//
 
 
 
 
//************ This Loop Is called From Main Loop************************//
void GetEC(){
 
 
//*********Reading Temperature Of Solution *******************//
sensors.requestTemperatures();// Send the command to get temperatures
Temperature=sensors.getTempCByIndex(0); //Stores Value in Variable
 
 
 
 
//************Estimates Resistance of Liquid ****************//
digitalWrite(ECPower,HIGH);
raw= analogRead(ECPin);
raw= analogRead(ECPin);// This is not a mistake, First reading will be low beause if charged a capacitor
digitalWrite(ECPower,LOW);
 
 
 
 
//***************** Converts to EC **************************//
Vdrop= (Vin*raw)/1024.0;
Rc=(Vdrop*R1)/(Vin-Vdrop);
Rc=Rc-Ra; //acounting for Digital Pin Resitance
EC = 1000/(Rc*K);
 
 
//*************Compensating For Temperaure********************//
EC25  =  EC/ (1+ TemperatureCoef*(Temperature-25.0));
ppm=(EC25)*(PPMconversion*1000);
 
 
;}
//************************** End OF EC Function ***************************//
 
 
 
 
//***This Loop Is called From Main Loop- Prints to serial usefull info ***//
void PrintReadings(){
Serial.print("Rc: ");
Serial.print(Rc);
Serial.print(" EC: ");
Serial.print(EC25);
Serial.print(" Simens  ");
Serial.print(ppm);
Serial.print(" ppm  ");
Serial.print(Temperature);
Serial.println(" *C ");
 
 
/*
//********** Usued for Debugging ************
Serial.print("Vdrop: ");
Serial.println(Vdrop);
Serial.print("Rc: ");
Serial.println(Rc);
Serial.print(EC);
Serial.println("Siemens");
//********** end of Debugging Prints *********
*/
};

Got any questions let me know.

The next tutorial will be on coding a self learning nutrient doser.

References:

[1]

John J. Barron & Colin Ashton "The Effect of Temperature on Conductivity Measurement" Technical Services Department, Reagecon Diagnostics Ltd

http://www.reagecon.com/pdf/technicalpapers/Effect_of_Temperature_TSP-07_Issue3.pdf

Discussions

Lino Zimmermann wrote 04/07/2022 at 18:28 point

Hello, I'm trying the same thing for ages... Currently I'm using two 12bit ADCs and one OpAmp and I hardly get good readings... Even when I touches the pins the EC reading changes a lot. Any Ideas what's wrong?

  Are you sure? yes | no

Carl Bartlett wrote 02/19/2022 at 04:40 point

I know it has been quite a while since you worked on this project but I was wondering to prevent polarization could you reverse the direction of the current such that it flows one say from pin D5 (High) throw the circuit measuring the resistance(A0) then to  D4(LOW/Ground)  Then D5 goes low and D4 goes High.  You can measure the resistance using the previous resistance and you should come up with something near the 1K resistor.  But ignore that value.  The purpose is to drive the current the other direction move the ions away from the probe.  Neutralizing their movement.  Thoughts?

  Are you sure? yes | no

Carl Bartlett wrote 02/19/2022 at 15:52 point

Also after running the equations, the voltage in doesn't matter.  In the equation it ends up being meaningless.  So simplified it is Vdrop = raw/1024.0, and Rc = Vdrop*R1/(1-Vdrop). 

Also, can you calibrate the Ra with a known resistor?  I measure R1 and then measure known resistors and get an actual Ra that matches with the known R.  

  Are you sure? yes | no

Yedidya wrote 01/18/2022 at 10:18 point

Hey. Thanks for sharing!

Trying to get this work with an esp32, using the input output GPIO pins.

Changed the voltage-in to 3.3v. Though I don't get correct values. 

Anybody get this working on the esp32?

Thanks!

  Are you sure? yes | no

Michael Ratcliffe wrote 01/27/2022 at 00:20 point

Hi, 

The ESP32 is a strange beast for a few reasons:
-The ADC is particularly bad [ non linear] 
-Only one of the ADC's can be used when the wifi is running 
-The breakout boards have a lot of pullup and down resistors on the breakout board connected to pins , reading their data sheet for the particular board is needed to find bare pins
-The pin resistance can be changed depending on what mode it is set to

Its not impossible and I have had the EC probe running on a few different esp32's.

As an example for a randomly selected esp32 dev board: https://www.jaycar.com.au/esp32-main-board-with-wifi-and-bluetooth-communication/p/XC3800?pos=2&queryId=e8e8982ebf98b5d9fc19b40d2e156741&sort=relevance

Schematic: https://www.jaycar.com.au/medias/sys_master/images/images/9628794421278/XC3800-dataSheetMain.pdf

You will need to choose Three pins for the board: 
-Two that are digital pins with no other connections on the board 
-An adc pin that is connected to ADC1 [ the second ADC doesnt work with IOT] 
Please double check as I only quickly pulled theses pin numbers:
22                   ECGround
21                  ECPower
35                 ECPin

Other things to be considered: 
-The esp32 is a very quick board and you may need to take and discard a few ADC readings to give the ADC capacitor a chance to charge and get a steady ADC reading. 
-The resistance of the ESP32 digital pins is not the same as for the arduino uno.  https://www.esp32.com/viewtopic.php?t=5840  from here I worked out 32 ohms. 
-Your Pin voltage is 3.3v [ not 5] and your ADC range is 4096 [ not 1024]. 

You may also prefer this probe:
https://www.thingiverse.com/thing:2590723

Hope this helps,
Mike

  Are you sure? yes | no

NicolasPingitzer wrote 11/05/2022 at 13:33 point

Hi Michael, I know it's been a while since you posted this, but I wonder if you have the schematic (for ESP32), since the page where it was loaded doesn't work. I'll tell you that it works perfectly on Arduino, but it's time to migrate to ESP32, and I'm having some problems with the ADC. Thank you for being so generous with this community, this project has been VERY USEFUL.

  Are you sure? yes | no

christer.siesing wrote 01/08/2022 at 20:56 point

.

Hello; Michael thank you for the job you did, I use i2c display so pins A4, A5 are occupied on my Arduino Nano, it is possible to use A0, A1 and A6 for the Ec probe, if possible it is enough to change A4 to A6 in the program or it is required more cod.
Thanks in advance Christer

  Are you sure? yes | no

Michael Ratcliffe wrote 01/08/2022 at 21:33 point

Should work with the single definition change. 

  Are you sure? yes | no

Wesley Matheus A Silva wrote 04/28/2021 at 18:51 point

hello everyone, congratulations and thank you very much Michael, I would like a great help, I am working with a liquid that varies between 4 ~ 7mS / cm I would like to know what changes I have to apply to the system to work correctly.  ps: i am using arduino uno and the ds18b20 temperature sensor

  Are you sure? yes | no

pcnel4 wrote 01/17/2021 at 03:11 point

Hi,

Thanks for the informative program. 2 questions though.


I have an UNO  and don’t have pins A8,9 & 10. Any help on this or am I missing something basic?

Do you still need a resistor in parallel between data and ground on the thermometer.

Thanks an regards.

  Are you sure? yes | no

Wesley Matheus A Silva wrote 04/28/2021 at 19:53 point

Você pode usar qualquer pino do arduino, claro respeitando as características dele, digital-digital e analógico com analógico.

  Are you sure? yes | no

Carl Bartlett wrote 02/19/2022 at 18:33 point

So a comment about the program, you can free up more pins by linking components directly to vin/5v/3.3v where appropriate as well as directly to ground.  For the thermometer you need a 4.7k resistor between 5v and the data pin.

  Are you sure? yes | no

Timmy wrote 08/29/2020 at 13:36 point

Hey there,

First, thx so much for this thread.

Can anyone help me with converting ? The calibration is done with S/cm but usual fluid has a range between 0,3-2,5mS/cm. The calibration in S/cm is exactly enough to measure mS/cm ? Where I can adjust the code to get mS/cm. Thanks all for any advice.

Greets
gerrul3r

  Are you sure? yes | no

damodarvajja wrote 05/25/2020 at 12:08 point

where can i download modified one wire and Dallas library

  Are you sure? yes | no

ninthtrade wrote 05/06/2020 at 11:49 point

Thank you for a wonderful attempt.
It worked in my environment.

However, it cannot be measured with "XBee".
Any advice on this?

  Are you sure? yes | no

Jakub wrote 04/20/2020 at 00:08 point

Hello, Thanks for this project! I was making something similar, but I got lost in calculation of the result value, u helped me a lot!

I would like to ask, if I have a self made probe, where I got 2 electrodes where A = 1 cm^2 and distance is 1 cm, do I have to calibrate it to get cell constant or can I just calculate it? (well... K = 1) The thing is, I dont have any easy way to make calibration solutions (I only have a scale with resolution of 1g, which is kinda not accurate enough) and I kinda dont want to spend more money.. 

also, I am using Raspberry pi and adc MCP3208, I want accurate results, but I cant seem to rly find some values... do u think that Raspberry pi GPIO pins have high enough resistance that it influences result? also, by some chance, do u know if I have to take in consideration some resistance from MCP3208 (3008)??

Thank you!

  Are you sure? yes | no

FrancoIQ wrote 04/05/2020 at 16:10 point

Hi, first, thank you for this project, i have been using it for 2 years now, and works great, now i have a problem, i would appreciate your help since i couldn't find a solution for my new problem. I want to use this EC meter with a pH probe on my arduino mega 2650, i cannot use it at same time in the same solution because my pH probe takes wrong measures, when i put the EC meter in the solution the pH measures add some numbers, for example changes from 7 to 12 or 14. Do you have any solution for this, adding some component or modify the circuit? Thank you in advance. Franco.

EDIT: I saw the reply in another thread of this forum where you replied to another with the solution, i made that and worked. Thank you very much!!!!! you are the best.

  Are you sure? yes | no

Megan Johnson wrote 07/26/2020 at 22:52 point

Hi @FrancoIQ - I had the same question but I haven't been able to track down the answer-- could you post the link?? Thanks!

EDIT: I found the solution on another site- you have to set power and ground for the sensor as input when reading pH, this solves the issue for the close proximity sensing.

  Are you sure? yes | no

Hast Zimmer wrote 03/30/2020 at 10:58 point

Can someone offer a Raspberry Pi setup of this with a ADC such as  MCP3008?

  Are you sure? yes | no

Pinya wrote 03/03/2020 at 03:18 point

Hello can someone explain how he got the Rc values? I know it is based on the graph but I do not know how he got V= 0.4 and I=1.5e-4. Any help is appreciated

  Are you sure? yes | no

cardenalblue wrote 01/25/2020 at 15:23 point

How can we convert the result of S / cm to microS / cm?
Greetings

could we use?
EC = CalibrationEC * 100000 * (1+ (TemperatureCoef * (TemperatureFinish-25.0)));

  Are you sure? yes | no

Mirko wrote 12/02/2019 at 17:17 point

Thank your so much for your manual!
I created my own EC electrode. When I calibrate it I get in one solution (EC 0.45) a K0.57 as result and with the same electrode in another solution (EC 0.84) a K0.42. How do I get a stable result in different solutions?

I'm using a K2 resistor, before I was using a K1, but with worse results. Should I use a bigger resistor then K2 or what is the solution? 

  Are you sure? yes | no

arkfreestyle95 wrote 02/17/2020 at 14:12 point

Bump, struggling with the same issue, can not calibrate in aqueous solutions. Works fine for resistors. Please help @Michael Ratcliffe

  Are you sure? yes | no

Brandon Piner wrote 11/12/2019 at 04:53 point

Hi there. I do not have an E.C meter for calibration. I am looking to borrow one so I can meaure some calibration liquids. 

Please can you let me know how many different liquids are needed? 

Can I just mix water and salt to make different calibration liquids?

  Are you sure? yes | no

Michael Ratcliffe wrote 11/12/2019 at 15:32 point

You can make some calibration liquids yourself with some distilled water and table salt, or buy pre made ones. for relatively cheap [a dollar or two in the uk].  

Its a single calibration sensor, that is only one know ec is needed. It is best to choose a liquid that has an ec right in the middle of your planned fluid. Personally I use two fluids [ec1.2, ec 2.0] the first one to calibrate and the second one to confirm its reading correctly. 

  Are you sure? yes | no

Tony Castle wrote 10/27/2019 at 23:39 point

I am getting no temperature  input and the EC reading is about 3 times that of a commercial probe I was comparing with. I am concerned that I do not have the correct One Wire and Dallas Temperature libraries. The comments in the code refer to 'modified' libraries but I have been unable to locate these. Can anyone share a location for them?  I have used the libraries from Github but I assume these are different somehow?   Thanks if anyone can help. 

  Are you sure? yes | no

Michael Ratcliffe wrote 11/12/2019 at 15:42 point

Hi Tony, sorry for the delayed reply. 
If your using the normal library the temperature probe needs a pullup resistor on the data pin. I believe if you google "Ds18B20 pullup" it will explain it better. 

After getting the temp reading the values will be closer/ 

  Are you sure? yes | no

stedes_dev wrote 08/13/2019 at 22:48 point

Hi, how is life Michael

What is the reading range in ppm of this design...

Thanks in advance...

Steph

  Are you sure? yes | no

rahul.kumar wrote 07/10/2019 at 10:40 point

EC must be divided by cell constant to get conductance. As resistance is reciprocal of conductance. But you used product of conductivity and cell constant. Can you elaborate this?

  Are you sure? yes | no

Michael Ratcliffe wrote 11/12/2019 at 15:40 point

I calculate the inverse of the cell constant during the calibration. Ie the K in the code is 1/K.
Im not sure why I did it this way, it could have been a mistake during the maths that propagated into the final code.   So long as the calibration is the same mistake it cancels out and gives good results. 

  Are you sure? yes | no

rahul.kumar wrote 07/10/2019 at 08:16 point

So i'm looking at the AMTEL to calculate the resistance internal to the pins. How did you determine your values from the chart? there is no 0.4 volts

  Are you sure? yes | no

Michael Ratcliffe wrote 11/12/2019 at 15:37 point

I belive there is a chart thats shows pin voltage vs current, the slope [dV/dI] of the line is the pin resistance. But it was a while ago so I could be mistaken. 

  Are you sure? yes | no