A comprehensive Arduino library for interfacing with Atlas Scientific conductivity (EC) sensors via I2C communication.
This library provides both simple API calls for basic readings and a full command interface for advanced configuration and calibration.
You can explore about the sensor here https://files.atlas-scientific.com/EC_EZO_Datasheet.pdf
- Read conductivity measurements from Atlas Scientific EC sensors
- Configure sensor settings through I2C protocol
- Support for multiple calibration procedures
- Temperature compensation functionality
- Probe K-value configuration
- LED status control
- Device information retrieval
- Debug mode for development and troubleshooting
- Open Arduino IDE
- Navigate to Sketch > Include Library > Manage Libraries
- Search for Atlas_EC
- Click Install
- Download the latest release from GitHub
- Extract the ZIP file
- Copy the
Atlas_ECfolder to your Arduino libraries directory - Restart Arduino IDE
- SDA → Arduino SDA pin
- SCL → Arduino SCL pin
- VCC → 5V
- GND → GND
The default I2C address for the EC sensor is 0x64 (100 decimal).
#include <Atlas_EC.h>
AtlasEC ecSensor;
void setup() {
Serial.begin(9600);
ecSensor.begin();
}
void loop() {
float ecValue = ecSensor.readEC();
Serial.print("Conductivity: ");
Serial.print(ecValue, 4);
Serial.println(" mS/cm");
delay(2000);
}begin()– Initialize sensor and set to active modereadEC()– Read current EC value in standard units
setActiveMode(bool active)– Enable/disable sensor readingssetLED(bool on)– Control status LEDsetProbeKValue(float k_value)– Set probe K-valuesetTemperatureCompensation(float temperature)– Apply temperature compensation
clearCalibration()– Clear all calibration datadryCalibration()– Perform dry calibrationsinglePointCalibration(float value)– Single-point calibrationlowPointCalibration(float value)– Low-point calibrationhighPointCalibration(float value)– High-point calibration
setDebugMode(bool enable)– Enable/disable debug outputsetECDebugMode(bool enable)– Enable/disable EC-specific debuggetDeviceInfo()– Print device informationgetI2CAddress()– Get current I2C addressprocessCommands()– Process serial commands
The library supports an extensive set of serial commands for interactive configuration:
i– Display device type and version
adr,?– Read current I2C addressadr,unlock– Unlock address change registeradr,lock– Lock address change registeradr,new,[address]– Change I2C address
cal,?– Read calibration statuscal,clr– Clear calibrationcal,dry– Dry calibrationcal,[value]– Single-point calibrationcal,low,[value]– Low-point calibrationcal,high,[value]– High-point calibration
led,on/off– Control LEDon/off– Start/stop readingst,[value]– Set temperature compensationk,[value]– Set probe K-valuer– Take reading
#include <Atlas_EC.h>
AtlasEC ecSensor;
void setup() {
Serial.begin(9600);
ecSensor.begin();
}
void loop() {
float ec = ecSensor.readEC();
Serial.print("EC Value: ");
Serial.println(ec, 4);
delay(1000);
}#include <Atlas_EC.h>
AtlasEC ecSensor;
void setup() {
Serial.begin(9600);
ecSensor.begin();
ecSensor.setDebugMode(true);
Serial.println("Type '?' for command list");
}
void loop() {
ecSensor.processCommands();
delay(100);
}- Perform dry calibration:
cal,dry - Calibrate with known solution (example: 1413 µS/cm):
cal,1413 - Verify calibration:
cal,?
- Ensure proper I2C connections and pull-up resistors
- Verify sensor power supply stability
- Check I2C address configuration
- Confirm calibration procedure is followed
Enable debug mode for detailed communication feedback:
ecSensor.setDebugMode(true);- AVR (Uno, Mega, Leonardo)
- SAMD (Zero, MKR series)
- ESP32
- ESP8266
- STM32
- Atlas Scientific EZO-EC Circuit
- Atlas Scientific EC sensor modules
- v1.0.0 – Initial release
- Basic EC reading functionality
- Full command interface support
- Calibration procedures
- Configuration options
Contributions are welcome!
Please ensure:
- Code follows Arduino library guidelines
- Proper documentation is included
- Examples are tested and functional
This library is released under the MIT License. See LICENSE file for details.
If you encounter issues:
- Check provided examples
- Verify hardware connections
- Ensure proper calibration
- Enable debug mode for logs
Full documentation is available in the library header files and example sketches. Each method includes detailed comments explaining functionality and parameters.
- Atlas Scientific EZO-EC Datasheet
- I2C Communication Protocol
- Arduino Library Specification