OpenCTD Introduction and Build Guide
Conductivity, temperature, and depth (CTD). These three measurements allow scientists to unlock ocean patterns hidden beneath the sea's surface. The ocean is not uniform, it its filled with swirling eddies, temperature boundaries, layers of high and low salinity, changing densities, and other physical characteristics invisible to an observer floating upon its surface. To reveal these patterns oceanographers employ the CTD--an oceanographic instrument that, at its core, measures temperature, salinity, and depth for a water column. The CTD is the workhorse of oceanographic research.
CTDs are expensive, and that expense can is a barrier-to-entry for formal and informal researchers with limited budgets, scientists from developing nations, citizen oceanographers, and students of all levels interested in learning more about their local coasts and waterways.
The OpenCTD is a low-cost, open-source CTD suitable for both educators and researchers. The platform is built using reasonably accessible parts and is powered by an Arduino-based microcontroller. Source codes and building instructions are freely available. The device, sufficiently accurate for scientific research, can be constructed for approximately $300, and is effective to 100 meters depth.
Why 100 meters? For many coastal regions, 100 meters depth covers the majority of the ocean that is accessible by small boat and generally the average depth of the outer continental shelf. The OpenCTD is targeted to people working in this niche, where entire research projects can be conducted for less than the cost of a commercial CTD. The OpenCTD is scalable and someone with the inclination and expertise can adapt an OpenCTD to operate in deeper waters.
If you build an OpenCTD please let the team at Oceanography For Everyone know. We love to keep up with the community of people building and using these devices. During your build session, or while using an OpenCTD or other Oceanography for Everyone tools, please consider tweeting using the #HackTheOcean hashtag so the community can follow your efforts!
1.1 Skills Needed
Building an OpenCTD requires some basic soldering and coding knowledge but it is also a great opportunity to learn those skills. With an hour or two of practice, you can develop the soldering skills needed to build an OpenCTD. This descriptive, illustrative comic from Mighty Ohm presents soldering fundamentals in an accesible and approachable format.
Arduino is a relatively intuitive coding environment, but it can still seem daunting to first-time users. Practically, we have already created the code you will need to run the OpenCTD, but it is extremely beneficial, particularly for end users, to understand what the software is doing. The book Environmental Monitoring with Arduino: Building Simple Devices to Collect Data About the World Around Us is short, easy to understand, and will provide you with some ideas for expanding your inventory of open-source environmental sensors.
2.0 Project Status
The OpenCTD is stable on the Qduino Mini platform with comprehensive build instructions provided and a growing user community. We have validated the OpenCTD against commercial CTDs and are confident in the quality of the data. Users around the world are building and testing their own units and helping with instrument validation.
2.1 Field Trials
As we test and refine the design of the OpenCTD, critical field trials with essential data for assessing the quality, accuracy, and durability of the device are archived in the Field_Trials repository.
Lake Superior, R/V Blue Heron: Initial field trials were completed in October of 2015 and analysis of the data from the first several casts confirms the accuracy of OpenCTD at it was cast against a commercial CTD. Additionaly, OpenCTD was successfully deployed to a depth of 140 meters. All data and field notes from the first Field Trial can be found in the Blue Heron 15-11 repository.
Gloucester Point, VA, Hurricane Hermine: Hurricane Hermine is a tropical cyclone that passed over our field site in coastal Virginia on September 4, 2016. To test the longevity of the batteries and the durability of the OpenCTD during long term deployments, Andrew placed two units in our Test Ditch (a tidally influence drainage ditch connected to the Mobjack Bay estuary), where they remained for 74 hours. Notes and data files can be found in the HermineDeployment_9-2016 respository.
3.0 Bill of Materials
We try to source as many parts as possible from accesible distibutors. NOTE: As Amazon is in the process of phasing out its aStore program, the Parts Depot is no longer being maintained. Please consult the below list for the most recent part recommendations. Many components can also be purchased directly through the supplier, found on AliExpress, or sourced through auction sites for significantly less. Quality across suppliers for most parts has been generally consistent, though we have noticed a defect rate of about 10% with the sealed temperature sensors.
Please be aware: Part availability varies from month to month, and some components may become permanently unavailble or listed under a new manufacturer and product name. We do our best to keep the bill of material up to date, If you find any discrepancies, please email us.
|Qduino Mini||Sparkfun/Amazon||$29.95||https://www.sparkfun.com/products/13614 / http://amzn.to/2wS8YUp|
|SD Card Reader Module||Amazon||$5.66||http://amzn.to/2jXSNnv|
|3.7V 2000mAh LiPo||Amazon||$14.98||http://amzn.to/2y3nDRQ|
|Conductivity K 1.0 Kit||Atlas Scientific||$195.71||https://www.atlas-scientific.com/product_pages/kits/ec_k1_0_kit.html|
|DS18B20 Temperature Sensor||Amazon||$9.88||http://amzn.to/2yoBUo6|
|SOIC to DIP Adapter||Sparkfun||$2.95||https://www.sparkfun.com/products/13655|
|10k Ohm Resistor||Amazon||$4.19||http://amzn.to/2yoCjqC|
|Heat shrink tubing||Amazon||$5.99||http://amzn.to/2wRQtPO|
|2" Gripper Plug||Amazon||$9.41||http://amzn.to/2jWVjdz|
|MicroSD Card Read Module||Amazon||$9.49||http://amzn.to/2y4nSvS|
|Pressure Sensor Breakout - MS5803-14BA||SparkFun||$59.95||https://www.sparkfun.com/products/12909|
|3" Gripper Plug||Amazon||$4.99||http://amzn.to/2wS9qlC|
Some parts, such as resistors and capacitors, are very cheap but hard to source individually. We have tried to find the smallest lots that aren't excessively overpriced, but you may have better luck finding cheaper options, especially "intro to electronics"-type kits, which include many standard resistors and capacitors in small lots.
Additional components, like a pre-fabricated pressure sensor module, LiPo batteries, SMD boards, and the qDuino Mini can be found at Sparkfun. The MS5803-14BA pressure sensor previously needed to be special ordered from a parts supplier, but SparkFun has a (much more expensive) commercial 14-bar unit using the same sensor.
Servoflo sells the raw, calibrated pressure sensor in both 14Bar and 30Bar modules. These are surface mounted sensors and require significant soldering skills to mount properly. Detailed descriptions of the differeces and benefits between the two pressure sensors is discussed in section 5.2. Mouser now sells individual MS5803-14BA sensor modules for a reasonable cost.
PVC pipe can be found at most home supply stores. If you want to get fancy, a clear acrylic tube can add some flare to your build. Though the first OpenCTDs were built using 3" PVC pipe, we now recommend using 2" pipe for a more durable, compact device.
- wire cutter
- wire stripper
- soldering iron
- solder tip cleaner
- helping hands soldering station
- epoxy gun
- needle-nosed pliers
- utility knife
- hot glue gun
- heat gun
- 1" bit (for holes in PVC)
- micro-USB cable
- coffee maker (because coffee)
- sand paper
- Hysol E90-FL epoxy
- venturi mixing nozzles for epoxy
- desoldering braid
- electical tape
- hot glue
- mineral oil
- calibration standard for conductivity
3.3 3D printed parts
Several useful parts that will significantly improve the build process are 3D printable: 3D Printer Files. While 3D printing allows rapid fabricating of small custom parts for very low cost, we recognize that access to a 3D printer is not universal. The OpenCTD can be entirely constructed without 3D printed parts. The sensor plate can be fabricated from cardboard if necessary (its purpose is to hold the sensors in place while the expoxy cures, once the epoxy is set, the plate serves no further function). The wire jig helps keep everything organized but is not necessary. The Jaunty CTD Cap is funny, but not particularly useful. If you would like to build an OpenCTD but do not have access to a 3D printer, please contact either Andrew or Russell and we will print the parts for you. If you're on Thingiverse, please Like, Collect, or Make our designs to help boost our profile in the 3D-printing community.
3.4 Required Arduino Libraries
- Included with Arduino IDE:
- Need to download and install (How to install Arduino libraries):
- SD. For reading and writing to a standard SD card reader.
- SparkFun_MS5803_I2C. For the MS5803 14 Bar pressure sensor (Note: if you decide to use a different pressure sensor, you will need to update this library)
- Dallas Temperature Control. Allows you to communicate with the DS18B20 thermistor.
- OneWire. For controlling the Dallas 1-wire family of devices.
3.5 Other Useful Software
- Qduino.h and Qduino fuelGauge allows you to measure the charge on you battery.
- simple_serial_for_EC_calibration is a basic serial monitor program to help you calibrate the conductivity probe.
- TempProbeTester allows you to test up to 26 temperature probes simultaneously and is useful for quality control and temperature calibrations.
- MS5803_14_test For testing the pressure sensor prior to installation.
4.0 Arduino Qduino Pinouts
- SD Card Reader: CS (D4), SCK (D15), MOSI (D16), MISO (D14*)
- Pressure Sensor: SDA (D2), SCL (D3)
- Temperature Sensors: Data (D6)
- Conductivity Circuit: TX (D8), RX (D9)
*older Qduinos may have this labeled D17
It is possible to use other Arduino-based single board computers, but please check the pinouts and schematics. Different Arduino boards may use various pins for internal functions which can interfere with signals to and from the sensors (for example, using this pinout on an Arduino Uno will result in failed conductivity readings).
5.0 Build Instructions
We are continously updating and improving OpenCTD prototypes. These instuctions are subject to change. Please read through the entire guide before you make any irreversible changes to the hardware. Most manufacturers will consider the warranty void once you begin soldering.
Important note about power consumption: All sourced modules are rated to work at 3.3V, however, when two or more are running simultaneously, the 3.3V output on most Arduinos yield inconsistent results and the SD card reader may not function at all. We recommend powering the entire system with a minimum of 3.7V. On standard Arduino's, the 5V output should be used. On the Qduino Mini, VCC with a 3.7V battery is sufficient. You can save yourself a lot of headache if you make sure the LiPo battery is fully charged and leave it connected to the Qduino Mini throughout the build.
We strongly encourage you to test all the components one by one on a breadboard before soldering modules together. If you're planning to build multiple CTDs, we recommend that you use a dedicated Qduino, with header pins, for breadboard testing.
A complete OpenCTD system mounted to a breadboard for testing before soldering and potting.
Before you begin, set up you Qduino Mini following this helpful quickstart guide from Qtechknow and flash the OpenCTD software to your Qduino Mini so that you can test each component during the build.
5.1 SD Card Reader
The SD card reader we recommend is a 'plug and play' module. Connect each pin following the pinout guide above. For fitting into a tight housing, you may want to bend each header pin 90 degrees (using needle-nosed pliers) or remove the headers completely. Hookup wires should be at least 60 mm long, though you may eventually shorten them to suit your preference. For SD card readers with two sets of pins, bend the 6 pins you need 90 degrees and snip the others flush with the board. Make sure you're connecting to the 3.3V terminal, not the 5V terminal.
To prepare the SD card, format the card and create a single, empty text file called datalog.txt.
5.2 Pressure Sensor
There are several options and configurations for the pressure sensor, all of which rely on the MS5803-14BA sensor module. The simplest solution is a prefabricated model that requires no additional modificaion, just solder headers or connectors to Gound, Vin, SCL, and SDA and connect to the Qduino (we strongly recommend this option for people who do not have extensive experience with surface mounted soldering).
Three possible pressure modules.
Other solutions require a small 100nF (104) capacitor and 10kOhm pull-up resistor. The resistor bridges pin 3 and 6 on the pressure module. The capacitor bridges pins 2 and 5. SCLK is pin 1, Ground is pin 2, VCC in pin 5, and SDI/SDA is pin 7. Pins 5 and 6 need to be bridged with a jumper wire.
Layout for pressure module. From The Cave Pearl Project.
Back view of one DIY pressure module.
Front view of a small DIY pressure module.
Back view of the same DIY pressure module.
Hookup wires for the pressure sensor should be about 5 cm longer than the length of pipe used for the housing. You may end up shortening these depending on your preference. The MS5803_14_test code can be used to test the pressure sensor after assembly.
5.3 Temperature Sensors
The temperature probes use an off-the-shelf DS18B20 digital thermistor in a stainless steel housing. We use a battery of 3 probes averaged together for more consistent readings. The OneWire protocol allows mutliple probes to be queried on the same pin, so all three probes feed into a single data pin. With these low-cost thermistors, we've found the failure rate to be about 10% out of the box. It's worth testing each thermistor on a breadboard before proceeding to save yourself frustration down the line. To prepare the probes, cut the wire length to 30 cm. Solder three data strands, three power strands, and three ground strands together and attach a single solid core wire to each.
We recommend sealing each solder joint with waterproof heat shrink tubing for increased reliability and to protect connections in the event of a flooded housing.
Three temperature probes prepped for soldering.
Temperature probes connected.
Temperature probes treated with heat shrink.
Temperature probes treated with additional heat shrink.
Finally, you will need to bridge the Vcc and Data pin (Vcc and D6 on the Qduino) with a 4.7 kOhm pull-up resisitor. This should be done when you solder everything directly to the Arduino.
5.4 Conductivity Sensor
There are a variety of options for conductivity probes, but we recommend using the Atlas EC EZO circuit to drive these probes. Different conductivity probes will have different configurations. In many cases, there will be more wires than are used. Use a multimeter to trace which wires are actually connected to each electrode. Once you have the electrodes traced, cut the wire to approximately 25cm and set the probe aside for potting.
The Atlas conductivity circuit needs very little preparation. Solder hook-up wires to all contacts except the two probe contacts. The conductivity probe will eventually be attached to these.
Conductivity circuit with heat-shrink to protect contacts.
5.5 Prepare the housing.
Cut a 2" PVC pipe to 25 cm in length. At one end of the pipe drill 2 equidistant holes to allow water flow around the sensors. The center of each hole should be 2.5 cm from the bottom edge. The position of the holes does not need to be precise, and you can get creative with their placement, provided you leave enough room for the sensor plate to sit above the holes.
2" and 3" OpenCTDs highlighting position of flow-through holes and probes
5.6 Connecting the electronics.
The 3D printed hardware frame and wire guide will make it easier to produce a nice, clean, easy to access brain for your open CTD. Each space is designed to hold one of the three PCB components, with the SD card reader located at the top, the qDuino mini in the middle, and the conductivity circuit on the bottom. The d-loop allows for wire routing using zipties to lock wire in place and take strain off of solder joints.
OpenCTD hardware frame and wire guide.
Note: Please test all electronics on a breadboard before permanently soldering to the Qduino.
Note: Depending on how tight your OpenCTD housing is, you may want to pot the probes first, and then connect them.
Create a power bus by soldering the four Vcc wires from each component to a single solid core wire so that they can all be connected to a single Vcc pin. Do the same with ground wires. Cover the connections with heat-shrink tubing.
Power bus, without heatshrink.
Slot a 4.7 kOhm pullup resistor between Vcc and D6. Feed the Vcc and Ground power buses into their corresponding pinouts. Feed to temperature probe data connection into pin D6. With the pullup resistor, D6 and Vcc may be a tight fit. Solder all three pins.
Vcc, Ground, and D6 with pullup resistor
Solder the SD card reader and pressure sensor to the Qduino Mini following the pinout guide. Solder the conductivity probe to the PRB headers on the Atlas circuit, then connect the Atlas circruit to the Qduino Mini following the pinout guide.
Depending on the size of the housing and how much wire you used in your build, fitting all of the electronics into the housing may require some creative placement.
2-inch and 3-inch OpenCTDs, highlighing electronics placement in the housing
This is the point of no return, after this step, there's no going back!
Note: Depending on how tight your OpenCTD housing is, you may want to pot the probes first, and then connect them.
3D print the OpenCTD baseplate. The outside of the baseplate is the portion of the base plate that will be exposed to the water--this is the side w/o the indentation for the pressure sensor.
Place a small amount of heatshrink tubing on the pressure sensor to prevent epoxy from coming in contact with the membrane. Affix the pressure sensor to the center indentation in the base plate. Lightly cover the edge of the indentation with 2-ton epoxy, taking care not to let any come in contact with the membrane. Seat the sensor in the indentation and apply more epoxy (This will provide added protection for this circuit). Let the epoxy cure for 20 minutes. Trim away the exposed heat shrink taking care not to damage the pressure sensor. Optional: Apply a small amount of electrical tape over the membrane of the pressure sensor to protect it while you work.
Pressure sensor seated in baseplate.
Pressure sensor with heat shrink extending out through baseplate.
Place the three temperature sensors into the 3 small holes. The waterproofing around these probes is not always uniform. Make sure that some stainless steel is exposed on the inside surface of the baseplate and than at least 1 cm extends out into the water.
Temperature probes extending out through the baseplate.
Apply hot glue around the inside of the base plate around each temperature sensor to hold them in place and prevent epoxy from leaking out. Once the hot glue hardens, place the conductivity probe in the only hole big enough for it. Make sure the conductivity probe extends further from the baseplate than the temperature probes (to avoid any interference from these metal probes). Apply hot glue to the inside of the base plate around the conductivity sensor.
All probes extending out through the baseplate.
Align the baseplate such that it is lightly recessed into the tube (when standing upright [i.e. sensors facing down], none of the sensors should touch the ground) and that it sits just above the top of each flow-through hole. Remove the baseplate and apply hot glue around the edges of the plate. Quickly and carefully slide the plate back into the PVC pie while slowly rotating it. This will create a tight seal to prevent epoxy from leaking out.
Baseplate seated in the housing.
Once you are satisfied with everything's position, it's time for EFL-90 epoxy. Using the epoxy gun apply the epoxy on the inside of the tube around the sensors. We recommend using an entire cartridge. Check periodically to make sure that nothing is leaking out of the bottom. Let it cure overnight.
Epoxy potting on the inside of the housing.
6.0 Calibration and Data Conversion
Proper calibration of the OpenCTD requires access to already calibrated validation instruments. These can be commercial CTD, handheld systems, or bench-mounted laboratory systems. As the community grows, properly calibrated OpenCTDs can be used to benchmark newly-built instruments.
The pressure sensor outputs absolute pressure, which means that it is self-calibrating. At sea level, pressure should be approximiately 1016 millibars, though local weather and small changes in altitude will affect this baseline. In order to minimize the amount of processing that happens onboard the OpenCTD, pressure is measured in millibars (the default output for the current pressure sensor). To convert pressure to depth use the following equation:
D = (P(depth) - P(surface) * 100) / (g * 1000)
Where D is depth in meters; P(depth) is the pressure (in millibars) at depth); P(surface) is the pressure at the surface in millibars; and g is acceleration due to gravity (9.81 m/s^2).
The Cave Pearl Project has provided an excellent guide to thorough temperature sensor calibration: DS18B20 Calibration: Finally nailed it!. This process may be overkill for most users, but anyone intending to produce replicatable, peer-review ready results should put in the extra time for a comprehensive calibration.
Calibrating the temperature sensors requires access to an already calibrated instrument. Allow both the OpenCTD and the validation instrument to equilibrate in water for 15 minutes. Take the average of the three OpenCTD temperature outputs and note the difference between that average and the validation instrument. Repeat for a fluid that is at least 15 degrees hotter or colder than the test fluid. There should be a linear relationship between the OpenCTD temperature sensors and the validation instrument, which will give you a calibration constant. Take the average of the three temperature readings and use the calibration constant to adjust temperature measurements when processing raw data.
This should remain steady for many casts, but it is always good practice to check you temperature calibration whenever you have access to a validation instrument. We recommend recalibrating temperature at the beginning of each expedition and once a month for prolonged deployments.
Calibration of the coductivity meter requires a calibration standard--a bottle of water of precise, known salinity. Calibration is done through software and is explained in detail here. You can perform either a one or two solution calibration depending on how many standards you have access to.
To increase the ease of calibration, we have created a small program for accessing the serial monitor. Flash this simple serial program to your Qduino Mini.
Open the serial monitor through the Arduino IDE. You should see a stream of unprecessed data.
- Enter c,0 into the command line and hit enter. This will turn off continuous monitorring.
- Enter k,? this will tell you what the K-value of you probe is set to. It should ke set to K=1.0 for most use cases.
- To change the K-value, enter k,x where x is the new K-value of the probe.
- With the probe dry (be sure there is abosolutely no water on the electrodes) enter cal,dry. This will dry calibrate the probe.
- For 1-point calibration, suspend the probe in calibration solution. Enter cal,one,y, where y is the known value of the standard.
- For two point calibration, suspend the probe in the less conductive solution and enter cal,low,y, where y is the known value of the standard. Then suspend in the more conductive solution and enter cal,high,z, where z is the known value of the solution.
- Now enter c,1 to turn continuous monitorring back on.
Don't forget to reflash the OpenCTD software to the Qduino Mini after calibration is done. Conductivity should be recalibrated at least once per year.
Converting conductivity to PSU is a complex equation that is temperature dependent. This UNESCO paper outlines the basic equations. We are working on an Excel template that will perform those conversions for you. The OpenCTD_DataConversion_Template will take raw data from the OpenCTD and make these conversions for you.
7.0 Your first cast.
This is the fun part.
For shallow deployments (<100 m), the test cap will keep water out. For deeper deployments (<100 m), pressure compensate the housing with mineral oil or similarly no-conductive fluid.
No Mineral Oil: Ensure that the inside surface of the PVC pipe is clean and free of debris. Hairs can be particularly difficult to see. Seat the test cap onto the housing and tighten the wingnut. Wingnut should be as tigh as possible without tool assistance and the cap should not move or turn.
Mineral Oil: Fill to a few centimeters below the top. There may be some spillover to avoid bubbles in the housing. Turn on the CTD. Gently lower the test cap down and screw it into place. It should be tight enought that it cannot be removed without unscrewing. Your CTD is now sealed and logging. Wipe down any spilled oil. These microfiber cloths from Amazon do a great job of sopping up small amounts of mineral oil.
Your OpenCTD is now ready to take the plunge! Gently lower into the water and descend no more than 1 meter per second. The slower the better. For the first cast, descend to 5 meters, then recover and check that no leakage has occured. With mineral oil, it will be very clear if the device is leaking. Once it passes the first soak test, you're ready to go forth and collect ocean data.
Welcome to the Oceanography for Everyone community!
9.0 Partners and Projects
If you are building you're own OpenCTD or have recieved one of ours, please add yourself to the following list.
|Partner||Affiliation||Project||Location||Link||Other Contact Info|
|Ian Black||Oregon State University||CTDizzle||USA||http://blogs.oregonstate.edu/ianblack/||@Ian_CTDizzle|
|Jonny Teague||University of Bristol||England||@jonny_teague|
This software has been compiled by Andrew Thaler, based on code from Walt Holm, arduino.cc samples, Atlas Scientific, Vhati, and Russell Neches. OpenCTD was initially designed by Andrew Thaler, Kersey Sturdivant, and Russell Neches.
11.0 Code of Conduct
Please review our Contributor Code of Conduct prior to your first contribution.