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

Optical dissolved oxygen solutions?

Home Forums Environmental Sensors Optical dissolved oxygen solutions?

Viewing 15 reply threads
  • Author
    • #1924
      Thomas Parr

      Hi, I am trying to put together a cost effective lab and (supervised) field instrument for measuring DO in STREON metabolism chambers. The STREON chambers are currently designed for YSI PRODO sensors, each of which is ~$1200. This gets a little expensive if you plan on running multiple chambers at different sites simultaneously. I saw recently that Yosemitech offers a USB powered optical DO sensor (Y1002) at a reasonable price (~$355) that specs out (for my purposes) about the same as the PRODO. Arduino or RPi seem like they might be a reasonable solution for building a multiple ODO sensor ‘instrument.’ I have two questions for now.

      -Does anyone have a optical DO sensor that costs less than ~$350 and can be wired into an Arduino or RPi ?

      -Does anyone here has experience with the Y1002 specifically or with Yosemitech in general? Thoughts, best way/person to talk to at Yosemitech?

      -If anyone has experience with the Y1002, do you know the exact current draw (Yosemitech is communicating, albeit slowly)? Would 4 (2×2 multiplexed) sensors exceed the 5v 200 mA power supply on the Mayfly?

      Thanks for you thoughts,

    • #1927

      Hey Thomas,

      – No, I haven’t seen optical DO probes less than 350, but I’ve only used PME minidots (onboard logger and should fit under a dome; ~1k) and Hach Hydrolabs (multiparamater sondes that are likely too big for domes; several K). Electrochemical/Clark-cell DO probes may be another option (calibration will drift more). If you only need a few days for chamber estimates (benthic productivity?), the calibration of electrochemical probe may be good enough.

      – For the arduino systems, typically I have a separate voltage regulator for the sensor than the board. Note, this preference may be lack of arduino board use however.


    • #1935
      Anthony Aufdenkampe


      The YosemiTech are a great deal and are very well made (http://www.yosemitech.com/en/product-cat-2.html). At the Stroud Water Research Center, we ordered one each of conductivity, turbidity and DO to test them out over the summer. When connected to a computer, they worked great.

      However, we unfortunately haven’t had the time to work out how to get them to communicate with our Arduino compatible Mayfly logger boards. All the YosemiTech sensors communicate using RS-485 with MODBUS protocols, which is a new communication protocol for our team. We’ve glanced at some of the work done on this, such as https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino, but just haven’t had time to play with it.

      Has anyone on this forum figured out how to connect a RS-485/MODBUS sensor to an Arduino? If so, please point us to some examples.

    • #12626

      Hi Thomas and anthony,

      I know it has been long since the post was discussed but by any chance did you guys move along with the project and made any breakthroughs? It would really help me alot.


    • #12630
      Sara Damiano

      I’ve made an Arduino library for communicating with the Yosemitech sensors: https://github.com/EnviroDIY/YosemitechModbus

      It’s built on top of my modbus library: https://github.com/EnviroDIY/SensorModbusMaster

      In the modbus library there’s a hardware folder with the plans for a little “wing” board to more easily connect a Yosemitech sensor to a Mayfly.

      I can’t actually say very much about the data quality, though. The probe Anthony mentioned ended up bounced between desks for over a year before I got the library to communicate with it working. When we ran a calibration on it after that, it didn’t seem as stable as the YSI sondes we have. Since the sensing cap only has a listed life of a year, we couldn’t really say if that was because the sensor wasn’t as good or the cap was just too old. And we still didn’t have a good case set up to actually put it anywhere, so it just sat on a desk for several more months. About a month ago I attached it to a group of Yosemitech sensors I have running downstairs in one of our artificial flumes. We are running those sensors to watch how the turbidity compares, but I threw the DO probe on because it was looking lonely on my desk. If you want to look at the data from it: https://data.envirodiy.org/sites/SWRCWetLab/

    • #13655


      I have a problem in communication between arduino uno and yosemitech Y504-A (http://yosemitech.sell.everychina.com/p-101690172-y502-a-online-optical-dissolved-oxygen-sensor.html). I use MAX485 module (https://hobbycomponents.com/wired-wireless/663-max485-rs485-transceiver-module). Honestly I am new in Modbus, so please teach me how to solve or connect with sensor to read data. Thank you.

    • #13669
      Sara Damiano

      @ayechan – do you have a specific problem or are you looking for general instructions?  If you have a specific problem, please create a new topic with a detailed description of your setup and problem.

      If you are looking for instructions, start by reading the sensor manual provided by Yosemitech.  If possible, connect the sensor to you computer using an RS485 to USB adapter and the Yosemitech ModbusRunner software.  (The software is here if you need it: https://github.com/EnviroDIY/YosemitechModbus/tree/master/utilities/WindowsSoftware.)  After that, read the documentation for the Yosemitech Modbus library (https://github.com/EnviroDIY/YosemitechModbus).  Then test out the examples in that library.  If you come up with a problem on the way, please create a new topic with a detailed description of your setup and problem.

    • #15057

      Hi @sara,

      I am trying to connect a y4000 to my arduino using an mkr 485 sheild (RS485) for hardware serial port  using your arduino library for y4000, till now with no luck.

      I suspect it is because of the “AltSoftSerial” creating software port while I am using a hardware one, but I am not sure how to modify this.

      Can you please help with some tips or thoughts?

    • #15058
      Sara Damiano

      @madbird – I’m sorry, I’m not at all familiar with the MKR or any of its shields.  For anything to work, you need to know what kind of serial port you need and how the pins are connected.  Merely creating and not using an AltSoftSerial instance shouldn’t be a problem at all.  But, of course, nothing’s going to work if you don’t tell the code the real port the device is connected to.


    • #15059
      Sara Damiano

      Ok, I’m looking at the Arduino website now.

      So it looks like the MKR is a SAMD21 based board, not an AVR based board like the UNO.  So, then, yes, just including AltSoftSerial will cause the code to fail to compile because AltSoftSerial is AVR only.

      Based on the schematics, the MKR RS485 shield connects the Tx and Rx of the RS485 to Serial1 of the MKR1000 (and I assume whatever clone of that you have).  So that means you should delete everything related to SoftwareSerial, AltSoftSerial, or ESP8266.  In it’s place, you just need to add one line HardwareSerial& modbusSerial = Serial1; Then you should be able to use modbusSerial just like in the examples.

      Apart from the code, you do need to make sure you’re supplying the Y4000 with enough power.  I’ve never actually touched a Y4000, but if I remember correctly it needs 12V and reasonable amperage.  That ISOVcc pin on the shield is *not* supplying power to the sensors.  The ISOVcc pin is part of the fail-safe for the chip that keeps the RS485 pins logic-high if something gets disconnected.  It should be connected to the Vcc of whatever you’re powering the sonde with (in addition to the Sonde power wire connection).   The same is true of the ISOGnd – it gets connected to the ground of the sonde power supply *and* the sonde’s ground wire, not only one or the other. Connecting the ISOVcc on the shield is optional (though I think the fail-safe won’t work without it).  The ISOGnd should be connected.

      I think you also want to set your dip switches to “half duplex” and terminate the Y-Z since the Yosemitech is half-duplex A/B only.

    • #15060
      Sara Damiano

      Oh, bother, and I missed that the chip on the RS485 shield does not have automatic flow control and the DE and REnot aren’t even on the same pin.   The library has support for a single DE/REnot pin, but for two separate pins.  You’ll need to physically join those pins for the library to work.  Run a jumper wire between A4 and A5 and then use either one of those for the DEREPin for the library.  In the past I’ve had almost no success in getting manual direction control to work properly.

    • #15067

      Hi Sara,

      Thank you very much for your help, I actually have a Y4000 and I have managed to communicate to it and use it connected to a PC, I am trying to monitor a near river.

      I tried to work as you have written earlier, the problem is it looks like I am overwriting the serial connection to the PC, so the second the code uploads the USB connection is lost and the serial monitor is not working.

      I am using the modified code by Anthony Aufdenkampe based on the GetValues.ino and I wonder if you can have a look for any tips on what might be the issue, thank you very much in advance.

    • #15069
      Sara Damiano

      You’re not “overwriting” the serial connection.  The USB connection on the SAMD21 is a bit touchy and will fail if anything in the program fails.  In you’re program in lines 117 and 119 you’re calling Serial.println(...) and asking it to print the results of a function that returns void.  That’s most likely causing the crash.  It probably would be OK on an AVR board, but the SAMD21 is less forgiving.

      Why don’t you start with the current version of the GetValues example from the YosemitechModbus library:  https://github.com/EnviroDIY/YosemitechModbus/blob/master/examples/GetValues/GetValues.ino.  It’s very different from what you had.  From there:

      • delete line 16 (#include <AltSoftSerial.h>) and
      • replace line 44 with HardwareSerial& modbusSerial = Serial1;
      • in lines 33, use your real pin number controlling the Y4000 power, or -1 if you have it straight to a battery (and make sure the sonde really is powered!)
      • in line 34, set the adapterPwrPin to -1; the shield you have is always powered
      • in line 35, set the DEREPin to A4 or A5 (and make sure they’re tied together)

      See if that compiles and runs.  Make sure your serial monitor is set to 115200.

      After your getting some output, if you’re not getting values or the values are garbled or unreasonable, try adding the line sensor.setDebugStream(&Serial) right below the sensor.begin(..) in line 67.  Then post that output.


    • #15074

      Hi Sara,

      Again thank you for your help, I am supplying the Y4000 from a dedicated power supply and I have done all the code instruction you gave earlier.

      The code is working. However, the sensor is not responding back as you can see in the attached picture. I thought it might be a grounding issue so I have connected the grounding from the sensor with the MKR485 grounding, nothing have changed. Tried to change the modbusAddress = 0x03 into 0x01 as a try, also nothing changed.

      If anything comes to your mind on what can be the issue please let me know.

    • #15078
      Sara Damiano

      You should be using the same modbus address that you use when connected to the computer.

      Looking at the datasheet again, I told you the wrong connections.  I’m sorry.  Only Y/Z are available in half-duplex mode, not A/B.  So you need to move A->Y and B->Z.  Turn off the Y/Z termination dip switch (I think).  I also told you the wrong pins for DE/REnot.  They should be A5/A6 *not* A4/A5.

      If fixing the wrong connections I told you to use doesn’t fix things, try disconnecting A5 and A6 and manually setting them at the start of your program.  Set DEREPin = -1; Then in your setup function, add this:

      pinMode(A5, OUTPUT);
      digitalWrite(A5, LOW);
      pinMode(A6, OUTPUT);
      digitalWrite(A6, HIGH);

      Since it is a fully duplex chip, both the receiver and driver can be enabled at the same time, unlike half-duplex chips like the MAX485.


    • #15128

      Hi Sara,

      Just wanted to say thank you for your help and kind support, now everything is working as expected and just need to calibrate the Y4000.

      Attached is a screenshot about the final results, I needed to twerk the delay time a little bit and make sure grounding overall is respected, but other than that everything worked  fine.

      Thanks again.

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