Arduino ORP Sensor Calibration

Arduino ORP Sensor Calibration © CC BY-NC

Calibrating Atlas Scientific's EZO ORP (oxidation-reduction potential) sensor using Arduino Uno.

  • 39 views
  • 0 comments
  • 2 respects

Components and supplies

Apps and online services

About this project

Calibration Theory

The most important part of calibration is watching the readings during the calibration process. It is easiest to calibrate the device in its default state (UART mode, with continuous readings enabled). Switching the device to I2C mode after calibration will not affect the stored calibration. If the device must be calibrated in I2C mode, be sure to continuously request readings so you can see the output from the probe. In this tutorial, the calibration will be done in UART mode.

The Atlas EZO ORP circuit has a flexible calibration protocol, allowing single point calibration to any off the shelf calibration solution. However, if this is the first time calibrating the circuit, Atlas Scientific recommends using the 225mV calibration solution.

Assemble Hardware

The kit includes 1 EZO ORP circuit, 1 ORP probe, 1 female BNC connector, 1 4oz 225mV calibration solution, 1 4oz ORP storage solution, 1 optional inline voltage isolator.

Ensure that the ORP circuit is in UART mode. For instructions on switching between protocols, refer to the following LINK.

Use the breadboard to mount the circuit and BNC connector. Wire the ORP circuit to the Arduino Uno as shown in the schematic above and connect the probe to the BNC connector.

Load Program Onto Arduino Uno

a) Download the sample code from this LINK. It will be in a folder titled "arduino_UNO_ORP_sample_code".

b) Connect the Arduino to your computer.

c) Open the code downloaded from step a, in your Arduino IDE. If you do not have the IDE you can download it from HERE.

d) Compile and upload the code to Arduino.

c) Open the serial monitor. For access go to Tools -> Serial Monitor or press Ctrl+Shift+M on your keyboard. Set the baud rate to 9600 and select "Carriage return". You should now be able to communicate with the ORP circuit. As a test, enter the command I which will return the device information.

Single Point Calibration

a) Remove the soaker bottle and rinse off the pH probe.

b) Insert the ORP probe directly into the 225mV calibration solution bottle. Let the probe sit in the solution until the readings stabilize (small movement from one reading to the next is normal).

c) Once the readings have stabilized issue the calibration command cal, n where n is the value of the calibration solution. In this case, it is cal, 225

Note: Calibration should be done at least once per year. If the ORP that's being read is continuously on the extremes of the scale ( ~ -900mV or ~ +900mV) calibration may have to be done more often. The exact frequency of calibration will have to be determined by your engineering team.

Code

orp sensor calibration codeC/C++
//This code was written to be easy to understand.
//Modify this code as you see fit.
//This code will output data to the Arduino serial monitor.
//Type commands into the Arduino serial monitor to control the ORP circuit.
//This code was written in the Arduino 1.8.9 IDE
//An Arduino UNO was used to test this code.
//This code was last tested 6/2019


#include <SoftwareSerial.h>                           //we have to include the SoftwareSerial library, or else we can't use it
#define rx 2                                          //define what pin rx is going to be
#define tx 3                                          //define what pin tx is going to be

SoftwareSerial myserial(rx, tx);                      //define how the soft serial port is going to work


String inputstring = "";                              //a string to hold incoming data from the PC
String sensorstring = "";                             //a string to hold the data from the Atlas Scientific product
boolean input_string_complete = false;                //have we received all the data from the PC
boolean sensor_string_complete = false;               //have we received all the data from the Atlas Scientific product
float ORP;                                            //used to hold a floating point number that is the ORP



void setup() {                                        //set up the hardware
  Serial.begin(9600);                                 //set baud rate for the hardware serial port_0 to 9600
  myserial.begin(9600);                               //set baud rate for the software serial port to 9600
  inputstring.reserve(10);                            //set aside some bytes for receiving data from the PC
  sensorstring.reserve(30);                           //set aside some bytes for receiving data from Atlas Scientific product
}


void serialEvent() {                                  //if the hardware serial port_0 receives a char
  inputstring = Serial.readStringUntil(13);           //read the string until we see a <CR>
  input_string_complete = true;                       //set the flag used to tell if we have received a completed string from the PC
}


void loop() {                                         //here we go...

  if (input_string_complete == true) {                //if a string from the PC has been received in its entirety
    myserial.print(inputstring);                      //send that string to the Atlas Scientific product
    myserial.print('\r');                             //add a <CR> to the end of the string
    inputstring = "";                                 //clear the string
    input_string_complete = false;                    //reset the flag used to tell if we have received a completed string from the PC
  }

  if (myserial.available() > 0) {                     //if we see that the Atlas Scientific product has sent a character
    char inchar = (char)myserial.read();              //get the char we just received
    sensorstring += inchar;                           //add the char to the var called sensorstring
    if (inchar == '\r') {                             //if the incoming character is a <CR>
      sensor_string_complete = true;                  //set the flag
    }
  }


  if (sensor_string_complete == true) {               //if a string from the Atlas Scientific product has been received in its entirety
    Serial.println(sensorstring);                     //send that string to the PC's serial monitor
    /*                                                //uncomment this section to see how to convert the ORP reading from a string to a float 
    if (isdigit(sensorstring[0])) {                   //if the first character in the string is a digit
      ORP = sensorstring.toFloat();                   //convert the string to a floating point number so it can be evaluated by the Arduino
      if (ORP >= 500.0) {                             //if the ORP is greater than or equal to 500
        Serial.println("high");                       //print "high" this is demonstrating that the Arduino is evaluating the ORP as a number and not as a string
      }
      if (ORP <= 499.9) {                             //if the ORP is less than or equal to 499.9
        Serial.println("low");                        //print "low" this is demonstrating that the Arduino is evaluating the ORP as a number and not as a string
      }
    }
   */
    sensorstring = "";                                //clear the string
    sensor_string_complete = false;                   //reset the flag used to tell if we have received a completed string from the Atlas Scientific product
  }
}

Schematics

orp sensor calibration wiring diagram
Orp probe calibration wiring diagram fm45sjfe0t

Comments

Similar projects you might like

Arduino pH Sensor Calibration

by Atlas Scientific

  • 1,333 views
  • 4 comments
  • 4 respects

DIY pH Dosing Pump

by Atlas Scientific

  • 2,285 views
  • 2 comments
  • 19 respects

Smoke Detection using MQ-2 Gas Sensor

by Aritro Mukherjee

  • 273,094 views
  • 47 comments
  • 173 respects
Add projectSign up / Login