Creating a Conductivity Probe Out of Common Items.

by wrightaddison53 in Circuits > Arduino

198 Views, 0 Favorites, 0 Comments

Creating a Conductivity Probe Out of Common Items.

20220425_174149.jpg

Created a conductivity probe using wires, arduino nano, 2 1k ohm resistors, and a temperature probe.

Supplies

20220425_175215.jpg
unknown.png

5 wires (anything that can conduct electricity, breadboard (https://www.adafruit.com/product/64), temperature probe (https://www.amazon.com/gp/product/B07MR71WVS/ref=ox_sc_rp_title_rp_1?smid=&psc=1&pf_rd_p=77d38535-0464-4004-a970-094326897d2a&pd_rd_wg=phTPL&pd_rd_i=B07MR71WVS&pd_rd_w=LHAHP&pd_rd_r=73126df8-8c25-4817-8f9f-41770209cdb9), arduino nano (https://store-usa.arduino.cc/products/arduino-nano/), Arduino program, usb cable, and 2 1k ohm resistors (https://www.amazon.com/1k-ohm-resistor/s?k=1k+ohm+resistor).

Setting Up Base of the Project

20220425_174931.jpg

Attach the arduino nano to the breadboard, preferably near the end of the board.

Setting Up Wires and Resistors

20220425_180312.jpg
20220425_180343.jpg
20220425_174149.jpg

To attach the 1k ohm resistors, place one resistor in the slot below the labeled section "D8 and D10", and then for the other resistor attach it to the slots below "A4 and A0". To set up the wires, take 3 of the wires and solder them to the temperature probe and let them solidify. Take the 3 wires then attach them, below the 1k ohm resistor, to "D8, D9, and D10". Then take the other two wires and combine them, without the tips on both ends touching, using heat shrink wrap, and attach them, also below the resistor, on the "A1 and A0" slots. Then attach the USB to the designated slot, and run the program.

Making and Running the Solutions

20220421_132218.jpg

Any solutions can be used, but the ones that I ran included, from left to right, water, Dr. Pepper, Arizona Tea Watermelon, Earl Grey Tea, and salt water. To attach the wires/probe, all that is needed is the tips of the wires to be inserted and the temperature probe to be submerged in the liquid.

Code Used

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 *****************************************************************// 

  

  

  

  

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 

 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 *******************// 

  

  

  

  

//************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 ********* 

*/ 

};

Finding/running the Data

unknown.png
unknown.png

On the top of the program go to the top of the screen and find the magnifying glass, right of the screen, and click it. From there the data should pull up and be running. Once the data is recorded that all is needed to find the conductivity of whatever solution is needed to be ran!