Sunday, April 13, 2014

Arduino and Vernier EC(Electroconductivity) Probe

Attaching Vernier Sensors to an Arduino rarely requires all pins, 
for the EC it requires only 3, The Ground, 5V, and A0 pins.
 
Code for the Arduino:
  
float Count;
float Voltage;
float SensorReading;
int TimeBetweenReadings = 500; // in ms
int ReadingNumber=0;
float Time;
float Intercept = -19.295;
float Slope = 175.416;
void setup()
{
Serial.begin(9600); //starts serial @ 9600 sigs per second
Serial.println("Data Set");
Serial.print("time");
Serial.println ("EC"); //Sensor Name
Serial.print("sec"); //time units
Serial.println ("μS"); //units(micro siemens=μS)
}
void loop()
{
//the print below does the division first to avoid overflow of Arduino
Serial.print(ReadingNumber/1000.0*TimeBetweenReadings);
Count = analogRead(A0);
Voltage = Count / 1024 * 5.0;// convert from count to raw voltage
SensorReading= Intercept + Voltage * Slope;
Serial.print("\t"); // tab character
Serial.println(SensorReading);
delay(TimeBetweenReadings);// delay in between reads for stability
ReadingNumber++;
}

Circuit Diagram: 
 
Data Collection
 Physical circuit, electrical tape is used to hold the pins in contact
 

No comments:

Post a Comment