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

Requirements for making a sensor compatible

Home Forums Environmental Sensors Requirements for making a sensor compatible

Viewing 4 reply threads
  • Author
    Posts
    • #19485
      Ted L
      Participant

        Hi, I develop and maintain the OpenOBS project, a low cost, open source sensor for turbidity, pressure, and temperature measurements. These are self-contained with a custom datalogger so that you can seal them up in a 1″ PVC and deploy underwater without anything installed onshore. However, I’m curious about pairing the sensors we have developed with your Mayfly dataloggers so that we can synchronize multiple sensors, use telemetry, solar panels, and generally benefit from your very well developed and tested logger.

        So, my question: can you point me towards the requirements for pairing a sensor to your logger? From what I see, it seems like all I need to do is set up the SDI-12 protocol (thank you for this library), and then break out the wires needed for the serial connection. Ideally we could continue using our microcontrollers which use an ATmega328p at 3.3V and 8MHz and reprogram them for this external serial connection.

      • #19486
        Sara Damiano
        Moderator

          We don’t have any set requirements for connection.  The Mayfly can communicate with almost anything that could communicate with an Arduino-style device.  Many users opt to user our ModularSensors library to run their loggers, but that library supports many protocols.

          SDI-12 devices are very common in the environmental sensing field, so we have a lot of experience in communicating with SDI-12 slaves. The Arduino SDI-12 library is not a full implementation of the protocol and it’s much better tested for use as an SDI-12 master than as a slave.  You would need to do some footwork and testing to fully implement your sensor as a compliant SDI-12 slave. The protocol documents have fairly good flow diagrams explaining the timing, retries, and low power modes that the slave must implement.

          Other protocols we have experience with are Modbus over RS232 or RS485, OneWire, and I2C (“Wire” or “Two Wire”).  If you look through the various sensor implementations in ModularSensors, you’ll see there are a lot of sensors where we use (or write and then use) a library that handles the lowest level back-and-forth needed to manage a sensor and then call that library’s “give me the current value” function within ModularSensors.

        • #19487
          Sara Damiano
          Moderator

            I spent some time skimming your GitHub code for your device.  If your logger is using a simple serial protocol to communicate with your GUI controller, it should also be able to communicate with the Mayfly (with or without Modular Sensors) in the same way if you expose the Serial (or AltSoftSerial) pins.

            ModularSensors already supports the MS5803 and the Mayfly has a QWIIC connection.  The Mayfly has a built-in ADS1115 for analog sensors. The VCNL4010 is not implemented in ModularSensors, but it looks like an I2C sensor with an Adafruit library, so it would be easy to implement and submit a PR for using the example of the MS5803.  Keep in mind if you’re developing anything with I2C communication that the I2C protocol is designed for short distance communication so you need an alternative if you want more than a few feet of cable.

          • #19488
            Ted L
            Participant

              Ok great, thank you for taking a look. Yes I2C is too short range for the applications I have in mind, but I have some experience with RS485 so that sounds like a good option.

              I’m not very familiar with your ecosystem, but would using ModularSensors require the Mayfly to be connected directly to the sensor? So if my sensors are natively I2C, I need to put a microcontroller next to the sensor and then implement RS485 (or SD-12 / RS232) there to communicate with the Mayfly, right? Then I would implement the combined sensor in ModularSensors? Just trying to get a handle of the expected pattern here.

            • #19489
              Sara Damiano
              Moderator

                Using ModularSensors doesn’t necessarily require the sensors to be directly connected to the Mayfly.  They could be, but they don’t have to be. In the case of a lot of inexpensive sensors sold as breakout boards, the Mayfly connects and talks directly to the sensor, but most of the not-bare-circuit sensors have black-box layers between the raw sensors and the Mayfly that do some internal processing before passing the number along.  If you wanted to make your sensors SDI-12 slave, you’d need to create those layers, whether on your 328p or some other in-between board.  Most commercial environmental sensors can do some on-board averaging, bad-value management, temperature correction, power management, and communication translation. Then “sensor” as the Mayfly sees it is the combination of the bare circuit sensor and the processing layers.  The Mayfly doesn’t need to know anything about what the lowest level sensing, just how get a “final” measured value.

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