Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

Hydros 21/Decagon CTD: reading error

Home Forums Environmental Sensors Hydros 21/Decagon CTD: reading error

Tagged: ,

Viewing 10 reply threads
  • Author
    Posts
    • #14387
      Letsid
      Participant

        This being our first year implementing our EnviroDIY unit, we are trying to keep it simple and are only using one sensor: the Hydros 21 (which, if I am not mistaken, is also known as the Decagon CTD).  Since it is so simple, compared to other units, I am slightly embarrassed to admit that I cannot seem to get any readings from the sensor.  Each time it returns the error reading of -9999.0.  I had this happen with some of the sensors used in learnEnviroDIY (e.g. the DS18B20) but after some fiddling with the connection I got it to return data successfully.  With the Hydros, I have quickly run out of ideas of ways to fiddle around with it.

        Here are my details:

        • I am using the code from the DRWI_LTE example because it used the Hydros 21. I removed all of the parts relating to the Campbell turbidity meter.  The code can be found here: https://github.com/EnviroDIY/ModularSensors/blob/master/examples/DRWI_LTE/DRWI_LTE.ino
        • My hardware has the XBee connection and battery but I do not have my solar up and running yet.  My last battery reading was 4.882 volts.  MY hydros 21 has the 3.5mm stero plug and is connected to pin 7.  See attached pictures of my setup.
        • Snippet jpeg images of the code script and output are also attached.  While not in the photos, I will mention that I made sure to check that my variable list and UUID are in the correct order.  Everything is uploading to MMW successfully.

        Any ideas?

      • #14392
        Sara Damiano
        Moderator

          Are you sure you’re SDI-12 address is set correctly?  You can use this program to check/change it:  https://github.com/EnviroDIY/ModularSensors/blob/master/tools/sdi12_address_change/sdi12_address_change.ino

        • #14393
          Shannon Hicks
          Moderator

            As Sara suggested, the issue is probably related to the SDI-12 address of the sensor. Meter Group ships all of their sensors with a default SDI-12 address of “0” (zero). They do this because it’s the channel their sensors need to be programmed to for working with their own brand of dataloggers. But Meter group sensors don’t respond to SDI-12 commands unless they are programmed to anything other than 0. The DRWI_LTE example sketch you’re using is looking for the sensor on channel 1, so the easiest thing is to use the address changing sketch Sara linked to change the sensor channel to 1. Then reprogram your Mayfly with the logging sketch and it should work.

          • #14394
            Letsid
            Participant

              It worked! Thank you, thank you!  I very much appreciate all the help.

            • #17065
              Letsid
              Participant

                Hello all. I have recently been delivered two of the newest versions of the Hydros 21 CTD sensors. They are replacing two that were destroyed after a year in the field. Anyway, with these new sensors, I am  having issues with the SDI12 address. I have run the SDI12 check code (posted earlier) and have used that to try and program the sensor so that the SDI12 address is 1 and not 0. That works great. However, each time I restart the Mayfly or try and upload the logging sketch, the sensors revert back to address 0. As such they fail to transmit the data and I get -9999 results. Thoughts?

              • #17066
                Shannon Hicks
                Moderator

                  We’ve seen this behavior with some of the new CTD sensors as well.  It seems that when you give it a new address using the b_address_change sketch, the sensor needs to be told the new address more than once in order for it to actually make the change.  Meaning, run the sketch and observe the text on the Serial Monitor.  For a new sensor it will say sensor found at address “0”.  Type “1” into the text box and press Send.   It’ll then say the sensor is now found at address “1”.   However, you should do it at least a few more times.  Enter “1” into the text box again and press Send.  It should say sensor found at address “1” again.  Try it at least 3 or 4 times, and then you should be able to unplug the sensor, upload your logging sketch, and the sensor will be found at address 1.

                  You should also make sure you’ve updated you libraries files recently.  The new version of the CTD sensors required a slight change in the SDI-12 protocol instruction timing, and those changes are incorporated in the latest version of the EnviroDIY SDI-12 library.  You can either update just that one folder, or all of them using the EnviroDIY Libraries zip file found at https://github.com/EnviroDIY/Libraries

                  If you’re still using an SDI-12 library version from prior to April of this year, it won’t work with the new CTD sensors and you’ll get -9999 for all parameters even if you’ve got the correct address programmed to the sensor.

                • #17103
                  Matt Barney
                  Participant

                    We’ve just had a failure to communicate with our newest Hydros 21 sensors (likely Gen 2). While I’ve had success setting the address with the b_address_change sketch, my standard Mayfly code can’t talk to the sensor and returns  values of -9999. It looks to me like the SDI-12 library has not changed since May 2021 (https://github.com/EnviroDIY/Arduino-SDI-12/).

                    However, MeterHydros21.h within ModularSensors was updated last month (https://github.com/EnviroDIY/ModularSensors/tree/master/src/sensors) for the new timing requirements of the Gen 2 Hydros 21, and updating that library was what fixed the communication problems I was having.

                    • #17104
                      Shannon Hicks
                      Moderator

                        Yes, it’s just one line (currently line 107) of the MeterHydros21.h file that contains the most important change, which is this line:  define HYDROS21_MEASUREMENT_TIME_MS 1000

                        The previous setting was 500 milliseconds but it turns out the new Gen 2 CTD sensors need a full second for measurement time, so changing that line will allow you to use the Gen 2 Hydros21 sensors.

                    • #18293

                      We wrote Program for Interfacing Hydros sensor 21 with Arduino Uno board using SDI-12 interface and saw the result on serial monitor . We tried a lot in implementing a program for connecting sensor directly to the digital Pin (Pin7/Pin2) of the Arduino UNO board using SDI-12 interface and viewing the result on the serial monitor. We found only garbage data coming on the serial Monitor.

                      We uploaded program here.

                      #include <SDI12.h>

                      const int dataPin = 2; // Connect the data pin to digital pin 2
                      SDI12 sdi12;

                      void setup() {
                      Serial.begin(9600);
                      sdi12.begin(dataPin);
                      }

                      void loop() {
                      // Request data from the sensor
                      sdi12.sendCommand(“0M!”);

                      // Wait for the sensor to respond
                      delay(1000);

                      // Read and print the sensor response
                      while (sdi12.available()) {
                      char c = sdi12.read();
                      Serial.print(c);
                      }

                      // Wait for a moment before taking the next reading
                      delay(5000);
                      }

                      Can you guide whether we require any digital hardware between Hydros sensor21 and Arduino Uno board?

                       

                    • #18301
                      Sara Damiano
                      Moderator

                        @bibhutibikramaditya Exactly what output are you getting?  You’re not asking for data in your script, so you should only be getting a response like “00013” not any data values.

                        Suggestions:

                      • #18307

                        Dear Sara
                        <div>      Following are the asnwers:</div>
                        <div>1.We are getting long Garbage data like some art ..square, or some numbers some times like…..for long..</div>
                        <div>2. We are not getting data like0013.</div>
                        <div>3.We already checked with change of Address  (0 to 1) and used the example program d_simple_logger but the same garbage data is coming.</div>
                        <div>4.We checked with this program(attached)…..also….<wbr />it says “NO SENSOR Found”.</div>
                        <div></div>
                        <div>Now we want to check the sensor whether it is working ..because we checked the voltage output from the Data pin ..it’s only 0.5v around when we give 5v to the power pin of the sensor. When we give a 12v power pin, it gives 0.8v sensor data output. Is this correct? Please give me some advice.</div>
                        <div>Awaiting your quick reply.</div>
                        <div></div>

                      • #18309
                        Sara Damiano
                        Moderator

                          Are you sure your serial port monitor is set to the same baud rate as the serial baud rate in your program?  Usually when there are nothing but junk characters, it’s a baud rate mis-match. I would suggest using a serial baud rate of 57600. Make sure you have that set in your program and on your serial port monitor.  The baud rate between the sensor and the Uno is different than the baud rate between the Uno and your PC.

                          Do your Uno and sensor have a common ground?  If you are powering the sensor from a separate power source than you are powering the Uno from, you need to connect the grounds. No sharing a common ground can mess up the data signaling.

                          The full specifications for SDI-12 are here:  https://www.sdi-12.org/current_specification/SDI-12%20Specification%201.4%20February%2020%202023.pdf Voltage specs are in table 1.

                      Viewing 10 reply threads
                      • You must be logged in to reply to this topic.