In this project, we will be automatically temperature compensating the salinity sensor from Atlas Scientific. Temperature changes have an impact on the conductivity/total dissolved solids/salinity of fluids and by compensating for it, we are ensuring that our reading is what it actually is at that specific temperature. Atlas's temperature sensor is used.
The temperature readings are passed to the conductivity sensor after which the compensated conductivity readings are outputted. Operation is via I2C protocol and readings are displayed on the Arduino serial plotter or monitor.
- Atlas Scientific does not make consumer electronics. This equipment is intended for electrical engineers. If you are not familiar with electrical engineering or embedded systems programming, these products may not be for you.
- This device was developed and tested using a Windows computer. It was not tested on Mac, Atlas Scientific does not know if these instructions are compatible with a Mac system.
- The temperature is automatically accounted for, enabling accurate conductivity readings.
- Real-time conductivity and temperature output.
a) Calibrate the sensors: Each sensor has a unique calibration process. Refer to the following: Ezo EC datasheet, Ezo RTD datasheet
b) Set sensors' protocol to I2C and each sensor needs a unique I2C address. In accordance with the sample code for this project, the following addresses are used: salinity sensor address is 100, and temperature sensor address is 102. For information on how to change between protocols, refer to this LINK.
The calibration and the switch to I2C MUST be done before implementing the sensors into this project.Step 2: Assemble Hardware
Connect the hardware as shown in the schematic.Step 3: Load Program Onto Arduino
The code for this project makes use of a customized library and header file for the EZO circuits in I2C mode. You will have to add them to your Arduino IDE in order to use the code. The steps below include the process of making this addition to the IDE.
a) Download Ezo_I2c_lib, a zip folder from GitHub onto your computer.
b) On your computer, open the Arduino IDE (You can download the IDE from HERE if you do not have it). If you would like to use the serial plotter be sure to download the most recent version of the IDE.
c) In the IDE, go to Sketch -> Include Library -> Add.ZIP LIbrary -> Select the Ezo_I2c_lib folder you just downloaded. The appropriate files are now included.
There are two sample codes that will work for this project. You can choose either.
The "temp_comp_example" code works by setting the temperature in the EC sensor and then take a reading. As for the "temp_comp_rt_example" code, the temperature is set and a reading is taken in one shot. Both will give the same result.
f) In your IDE, go to Tools -> Serial Plotter or press Ctrl+Shift+L on your keyboard. The plotter window will open. Set the baud rate to 9600. The real-time graphing should now begin.
h) To use the serial monitor, go to Tools -> Serial Monitor or press Ctrl+Shift+M on your keyboard. The monitor will open. Set the baud rate to 9600 and select "Carriage return". The EC and temperature readings should display.Demonstration
Part 1: No temperature compensation
Initially, the water is at a temperature of about 30°C. It is then heated to about 65°C while the conductivity (green graph) and temperature (red graph) readings are observed on the serial plotter. (For Arduino sample code that permits the reading of multiple circuits without automatic temperature compensation refer to this LINK).
Part 2: Temperature compensation
The Arduino code that accounts for automatic temperature compensation is uploaded to the board. See this LINK for the code. Once more, the starting point of the water is around 30°C. It is gradually raised to about 65°C while the conductivity (green graph) and temperature (red graph) readings are observed on the serial plotter.