Measure Electrical Conductivity in Siemens, Total Dissolved Solids in PPM, and Salinity in PSU.
- EC range: 0.6-5.0 mS/cm and 40-60 mS/cm
- Salinity range: 2 - 42
- Accuracy: ± 7%
- Temperature range: -2 - 35C
- Interface: I2C
- Current use: ~10mA peak, low idle current ~1mA
- Voltage range: 3.3 - 5.5V
The device is optimized for measuring in two ranges: 0.6 to 5.0 mS/cm (hydroponics and pools), referred to as EC, and 40 to 60 mS/cm (seawater), referred to as SW.
If you use the Qwiic connector, it is keyed and can only be inserted one way.
A 2.54mm through-hole header is also available. The pins are labeled as follows:
|EC-Salinity Interface||Master device|
Temperature Probe Connections
The temperature probe comes with a 3-wire connector that can only be connected one way.
I2C Bus Pull-ups
There only needs to be one device with active pull-up resistors. Each board comes with the resistors active. Several boards can typically be connected with active resistors, however if connection problems seem present, choose one board to keep the resistors active and disable to rest.
Each device comes with 4.7k resistor pullups on the I2C bus. They pass through a 3-pad solder paste jumper. The outer pads are connected to the middle by thin traces. To disable the pullups, use a utility knife to cut both traces. To re-enable the pullups, connect all three pads together with solder.
EC Probe Connections
A BNC connection is used to connect the conductivity probe to the EC-Salinity Interface.
Any 2-electrode probe with a BNC connector can be used. The device has been optimized to use a K1 probe for hydroponic solutions and pools and a K10 probe for seawater.
To start using the device, you need to install a library for your board/platform.
Arduino IDE: go to the library manager (Sketch / Include Library / Manage Libraries...) and search for EC Salinity.
PlatformIO: install the library using the library manager (PlatformIO / PlatformIO Home / Libraries) and search for EC Salinity.
Particle.io: search for EC_Salinity in the Libraries section of the IDE.
MicroPython: clone the GitHub repo. The library is located in the
python/MicroPythondirectory. Have a look at the README for instructions.
Raspberry Pi: clone the GitHub repo. The library is located in the
python/RaspberryPidirectory. Have a look at the README for instructions. Be sure to read the section below for instructions.
Rust: Download/install/documentation for the crate
Before you can begin, you will need to enable software I2C. The Pi's hardware I2C implementation has a clock-stretching bug that will prevent it from working reliably.
sudo nano /boot/config.txtand scroll to the bottom
<pin>with whatever pin you'd like to use. Refer here for the pin functions, you will need to use the orange GPIO xx labels in the picture to locate the pins.
ctrl + xto exit,
yto save, and
enterto confirm the filename.
The shell Example
An interactive shell interface is provided with all frameworks and is a quick and easy way to get started using the device. You will find the equivalent commands in the code area when applicable. Upload it to your master device, start a serial terminal and you will be presented with a
> prompt where you can enter commands and receive a response, similar to a shell command line or REPL. It is often quicker to experiment with things this way rather than rewriting, compiling, and uploading new versions every time.
Changing the I2C Address
If needed, the I2C address can be changed programatically by calling setI2CAddress. The device will permanently change the address and continue to use it after a power reset. If you forget the new address, you will need to use an I2C bus scanner to recover it.
- C++: There are several class constructors available.
- Custom I2C Address:
- ESP32 I2C Pins (SDA, SCL):
EC_Salinity ec(19, 23);
- ESP32 I2C Pins and I2C Address:
EC_Salinity ec(19, 23, 0x4C);
- Raspberry Pi Python: You can optionally pass the I2C address and/or bus.
ec = ecsalinity()
- Custom I2C Address:
ec = ecsalinity(address=0x4C)
- I2C System Bus:
ec = ecsalinity(i2c_bus=3)
- MicroPython: Always pass the I2C pins, optionally pass a custom I2C address.
ec = ecsalinity(sda=19, scl=23)
- Custom I2C Address:
ec = ecsalinity(sda=19, scl=23, address=0x4C)
- Rust: Always pass the I2C system bus, and I2C address.
let mut ec = EcProbe::new("/dev/i2c-3", 0x3c);
The devices are made with specific intent to measure between 0.6 to 5.0 mS/cm and 40 to 60 mS/cm. This allows for the full range of hydroponics and pool monitoring and also seawater. If you want to measure outside either of those two ranges, you should send an email for more information. These two ranges are referred to as EC and SW in the documentation.
Calibration can be done with only one calibration solution. For the EC range, choose a calibration solution closest to the point you want to measure. If you are most interested in the lower end of the EC range, a 2.0 mS/cm solution would be most appropriate. If you are interested in the high range, 4.0 mS/cm might be a better choice. For the SW range, a 53 mS/cm (or 35 PSU) calibration solution can be used with good results.
Keep in mind that you must routinely clean the probes for consistent measurements. While cleaning the probes, it is also a good time to calibrate to a different point.
If you plan to use temperature compensation, make sure it is enabled (useTemperatureCompensation) prior to calibrating your device.
If you plan to use other probes in conjunction with this device or will be using any isolation components, make sure your complete circuit is assembled and connected when you calibrate your device.
Avoid using a small plastic container to calibrate your probe. Ideally, a large amount of calibration solution will be poured into a glass jar to calibrate the probe. The solution shouldn't be reused.
Once the probe has been calibrated, a reading can be taken.
After the measurement is taken, the following class variables are updated:
If temperature compensation is enabled:
Conductivity naturally changes with temperature. When the temperature drops, the solution condenses, molecules move closer together and allow a charge to more easily pass. The opposite occurs when the temperature increases.
Temperature compensation is used to calculate what the measured conductivity would be if it were measured at a different temperature. This is just an approximation and is determined by a standard formula which is implemented in the device's firmware.
To set the temperature used for compensation, call setTempConstant and pass the temperature to use; the temperature probe must be connected for this measurement. Calling measureEC or measureSW will also call measureTemp before taking a measurement if usingTemperatureCompensation has been set to true.
Using Temperature from Another Device
If there is an alternate source of temperature information, it can be provided to the device by calling setTemp. It should be called before each call to measureEC or measureSW. Be sure to call measureEC
Each EC measurement takes 250ms. A temperature measurement takes 750ms.
Isolation and Interference
Using any water quality measuring probe with another probe will likely cause interference. There are many factors that determine the amount, to include the grounding of the solution, the type of probes, the solution itself, chemical reactions that may take place, etc. The only way to ensure interference doesn't cause faulty measurements is to isolate the circuit. The I2C Sensor Isolator board has been designed to work with both the EC-Salinity board and the ISE Probe Interface.