Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here
Tips & Pointers

Building a Low-Cost Electrical Conductivity Sensor Using the Mayfly Platform


A low-cost electrical conductivity (EC) sensor using the Mayfly platform was developed in part to support Great Marsh Institute’s (GMI) efforts to study the effects of stormwater runoff into Great Marsh in Chester County, Pennsylvania. The main focus is road salt runoff from Route 401 and the PA Turnpike which border the marsh on the east and west sides.

Six monitoring sites are planned of which three are currently installed. This data will supplement EC data from Delaware River Watershed Initiative sensor stations SL149 and SL150 which are deployed at Moore’s Road and Fairfield Road on Marsh Creek.

Mayfly EC Sensor Details

Since EC is temperature dependent a temperature reading is necessary so readings can be corrected to 25º C. A 10 KΩ resistance temperature detector (RTD) is used to measure temperature which is then used to correct the reading to the reference temperature. Sensorex provides a probe an integrated RTD. This eliminates the need for a separate sensor which would have to be mounted with the probe and in contact with the water.

The probe signal is processed by the Atlas Scientific EZO circuit. This circuit provides calibration routines for the attached EC probe but does not correct for temperature. This is done in the Mayfly code using a 2nd order polynomial fit to the data on the test fluid bottle.

Prior to deployment the EZO Circuit needs to be configured. This includes setting up the EZO to send continuous readings at predetermined intervals and performing a probe calibration. The probe calibration can be done as single point or two point calibration depending on what calibration standards are available. Single point calibration should be adequate using 1410 µS calibration standard.

Required Hardware

  1. Sensorex CS150TC Light-Duty Contacting Conductivity / Total Dissolved Solids Sensor with Automatic Temperature Compensation, $140
  2. EnviroDIY Mayfly Data Logger Board, $60
  3. Atlas Scientific EZO-EC Embedded Conductivity Circuit 0.07 − 500,000+ μS/cm, $60
  4. Cable box, $12
  5. EnviroDIY Mayfly ProtoShield, $10
    1. 10 KΩ resistor
    2. 0.01 µF capacitor
    3. Six-position wire to board terminal block, $2
    4. Socket strip for EZO
  6. 2500 mAh lithium ion battery, $15
  7. 1 Watt solar panel, $20

Total cost: $319

Click on images to enlarge.

Mayfly Code

Initially the Atlas/Mayfly sensor needs to have the Atlas EZO circuit setup. This includes probe calibration and setting the operational mode to continuous (“C”) output rather than triggered (“R”). Refer to the Atlas EZO datasheet for details. Once this is done the operational code can be loaded which reads the EC and temperature data, corrects the EC reading to 25º C reference, and stores the data along with a time stamp on the micro SD card on board the Mayfly.

When the station wakes from a predefined sleep period the EZO is powered up and begins to take readings at two-second (recommended) intervals. It takes several readings for the results to stabilize so typically 10 readings are taken and the last reading is logged to the SD card. The station then goes to sleep for a specified time period.

Note: The code uses the D10 hardware interrupt, therefore SJ1 must be cut from A7 and connected to D10; see Mayfly schematic for details.

Mayfly Setup Procedure

  1. Using the Set Real-Time Clock Code below, set the Real-Time Clock (RTC) to local standard time for consistency. Note that opening the serial monitor will reset the time unless the rtc.setDateTime(dt) is commented out.
  2. Use the Atlas EZO Setup Code below to calibrate the EC probe per the Atlas EZO datasheet. A two-point calibration is recommended using 84 µS and 1413 µS calibration standards. Remember to use the value of the calibration standard at the ambient temperature of the standard when doing the calibration procedure. For example, if the ambient temperature of the calibration standard is 20º C, then “cal,high, 1278” should be entered.
  3. The RTD in the Sensorex probe seems to have fairly consistent calibration using the m and b coefficients in the code (float m = -.0927, b = 72.653;). The accuracy can be checked at two points; typically, an ice bath at 0º C and warm water at about 40º C with errors used to correct the coefficients.
  4. Before loading the EC Monitor Code be sure to set the EZO to continuous update of 2 seconds (“c,2”). It was found that with a one-second update some devices would produce a zero reading for unknown reasons. However, when the update was set to two seconds the problem did not reoccur.
  5. Load the EC Monitor Code with the values of sleepMinutes, FILE_NAME, and LOGGERNAME set to user preference.

Set Real-Time Clock Code

Atlas EZO Setup Code

EC Monitor Code


0 0 votes
Article Rating
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
Click to jump to comments section.x