element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Just Encase
  • Challenges & Projects
  • Design Challenges
  • Just Encase
  • More
  • Cancel
Just Encase
Blog Blog 7 - Sensors, connections and starting some code - draft / wip
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Just Encase to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: christophesky
  • Date Created: 30 Dec 2021 5:00 PM Date Created
  • Views 1031 views
  • Likes 10 likes
  • Comments 0 comments
Related
Recommended

Blog 7 - Sensors, connections and starting some code - draft / wip

christophesky
christophesky
30 Dec 2021
Blog 7 - Sensors, connections and starting some code - draft / wip

Project Requirements to Sensing Solutions.

To recap, I want to know about the water quality of my pond, so measurement of TDS, pH, Turbidity, Temperature, and dissolved oxygen (and perhaps Oxidation reduction potential) are all things I am interested in.

Water quality and the parameters of interest will vary throughout the day, for example algae and photosynthesis only happens when it is light. Algae will use carbon dioxide in the water which in turn would increase the alkalinity (carbon dioxide dissolved in water creates carbonic acid, CO2(g)+H2O(l)⇌H2CO3(aq)). Good planting in the pond, particularly with oxygenating plants will be a massive boost to water quality, too little dissolved oxygen and living things in the pond will suffer.

At the moment and from observation only, I am expecting the water quality of my pond to be OK, not great, not awful. I suspect that as I continue with my winter clean-up it will be worse before it gets better. With autumn having passed and now well into winter here there has been a lot of leaf drop, some of which sunk before I could scoop out with a net, where in the deeper parts of the pond this will have accumulated and started to breakdown. Where organic matter breaks down, especially in low oxygen conditions hydrogen sulphide will form (H2S), this is toxic to aquatic life and not great for humans either. Now what makes me think I am going to find this? When lifting sediment / old organic matter from the deeper parts of the pond I had (1) bubbles come to the surface and (2) the smell of rotten eggs, that’s Hydrogen Sulphide. Finally, there is an awful lot of fine sediment which my net lifting activities has stirred up and will continue to do so.

This is all based on observation (and smell!) Time to measure.

Total Dissolved Solids Meter.

What is it a measure of?

Basically, a measure of how much organic and inorganic materials, such as minerals, salts, and ions you have in a given water sample. The amount of TDS in your water will very much affect water quality, from its taste to how much shampoo you need to use in the shower to get a good lather on, through to limescale deposits in your pipes, appliances and efflorescence on your shower screen.

Broadly speaking <500ppm is OK to drink >501 <1000 you don’t want to be drinking and >1001 you really do not want to be drinking.

To compare, when running a reverse osmosis, 4 stage filter to make up RO water for my reef tank, TDS would measure at <3ppm, when it increased this told me that it was time to change over the resin filters.

My fresh tap water measures between 150 – 400 ppm, living in a relatively hard water area which comes from the chalk of the South Downs and these contain the hardness salts of calcium and magnesium along with traces of other minerals.

Why measure it?

So taking TDS as a general measure of water quality / cleanliness I do not actually know what my pond water quality is like, whilst this is a garden pond for nature purposes, it is equally applicable for example in aquaculture. (There is also the consideration that my dog is quite partial to a pond drink during the summer / early autumn months, which can result in some fairly aggressive wind).

So lets measure.

The sensor

I have opted to make use of the Gravity TDS Meter, Version 1. Good reviews when benchmarked against most expensive equipment, a good price point, demonstrable longevity, Arduino friendly. Importantly this also has scope for temperature compensation in the measurement, given I am also using a couple of temp probes in the pond, this is idea.

The probe connects to the Signal Transmitter Board, specs on this are:

  • Input Voltage: 3.3 ~ 5.5V
  • Output Voltage: 0 ~ 2.3V
  • Working Current: 3 ~ 6mA
  • TDS Measurement Range: 0 ~ 1000ppm
  • TDS Measurement Accuracy: ± 10% F.S. (25 ℃)
  • So, we are good to go with this using the MKR 1300 as the Output Voltage: 0 ~ 2.3V is less than the max of 3V

Ahhhh, the one thing I wish I had known up front is that the sensor is not calibrated, so will definitely need to look into this further. The lower half of the sensor which will go into the pond is waterproof, single piece housing, the top is open which exposes the connector and PCB. I will need to make up an upper assembly for the sensor which

Seals the unit from the top, provides secure and sealed cable access and that I can make on my 3D printer.

Another design consideration is that the sensor needs to be located away from the edge of the pond, as when measuring in a beaker, being too close to the edge will affect the measurement.

Set up

A small fiddle was required with the connector for the Grove shield, so with patience, scalpel, and a few minutes the sensor connector now has a grove compatible connector, which replaces the original PH2.0-3P connector.

Using the sample code provided by the vendor, as set out below, this provides a single sensor sketch for reading and then returning a serial measurement in the console for the total dissolved solids content.  

image

To find out more, I have included my own reference material and library links:

References:

https://wiki.dfrobot.com/Gravity__Analog_TDS_Sensor___Meter_For_Arduino_SKU__SEN0244

Libraries:

https://codeload.github.com/DFRobot/GravityTDS/zip/master

 

 

pH Probe

What is it a measure of?

pH stands for the “power of hydrogen”. A solution’s pH measurement is a value that reflects the acidity or alkalinity (base) of a solution (otherwise known as the hydrogen ion concentration index). On a scale of 0 to 14 where a pH of <7 is increasingly acidic and a pH >7 is increasingly alkaline; you have the pH 7 which is neutral.

Some other values:

  • Battery Acid (H2SO4) pH 0
  • Water 7 ish 
  • Human Blood pH 7.35-7.45
  • Sea Water pH 8.1
  • Caustic Soda (NaOH) pH 14

Why measure it?

Living things have a range of specific environmental parameters under which they thrive or not. With the majority of aquatic creatures having a preferred pH range of 6.5-9.0. As mentioned in the preamble of this post, pH will vary throughout the course of the day, with larger swings seen where there is an ongoing algae bloom, lots of CO2 absorbed by the algae which would normally give you an acidic solution, becomes increasingly base / alkaline.

The sensor

Signal Conversion Board (Transmitter) V2

  • Supply Voltage: 3.3~5.5V
  • Output Voltage: 0~3.0V
  • Probe Connector: BNC
  • Signal Connector: PH2.0-3P
  • Measurement Accuracy: ±0.1@25℃

pH Probe

  • Probe Type: Laboratory Grade
  • Detection Range: 0~14
  • Temperature Range: 5~60°C
  • Zero Point: 7±0.5
  • Response Time: <2min
  • Internal Resistance: <250MΩ
  • Probe Life: >0.5 year (depending on frequency of use)
  • Cable Length: 100cm

It is recommended that you use an external switching power to provide 5V to the sensor, if you do this you are promised higher accuracy in your measurements. Now, does this create me a problem with the MKR 1300 being <3.3v tolerant? I will measure before connecting BUT the spec provides for an analogue output signal Voltage: 0~3.0V

image

image

So far, that’s TDS and pH.

Water Temp

What is it a measure of?

Simply, the amount of thermal energy in matter, or how hot or cold something is. I am in the UK, so will be looking to use the more sensible Celsius, none of that Fahrenheit silliness :D ( I think going for Kelvin would be a too extreme).

Why measure it?

Water temp is important in water quality. Warm water will contain less dissolved oxygen than cold water, flora and fauna will have a range of temperatures that they can live in, too hot or too cold, that’s going to be a problem. So there is not only the life supporting considerations, but then the water chemistry and biological processes to consider as well.

The pond has shallow margins, good for planting and of course providing stepped ways into / out of the pond. Some of these are clearly stepped, 300mm wide shelf, at a depth of 300mm, which then transition into another step until the deepest part of the pond. Two of the corners have a shallow slope for birds and anything which got into the water but needs to get out (hedgehogs being the main recent example)

Lets measure

Using the included High Temp Waterproof DS18B20 Digital temperature sensor from Adafruit, this uses the MAXIM DS18B20 sensor wrapped in a PTFE wire cable, +ve, gnd and data signal lines, a tidy 3 wire solution (did I mention it is also digital? So none of that pesky signal degradation you get with analogue).

Using the sample code provided by the vendor, as set out below, this provides a single sensor sketch for reading and then returning a digital temp measurement.

 image

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube