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

Adding New Sensors to Modular Sensors

Home Forums Mayfly Data Logger Adding New Sensors to Modular Sensors

Viewing 2 reply threads
  • Author
    • #14703


      I have a reasonably basic question about the modular sensors code.  We are trialing new arduino type sensors that are not included in the modular sensors library.  What is the best way to make these work with the modular sensors logger code?  At the moment I am creating ‘calculated’ variables, but I’m hoping there is a tidier way to do this.  Should I be developing my c++ skills so I can write .cpp and .h files that are called into the modular sensors script?

      Another very basic question.  I am trying to use a ds18b20 temperature sensor to correct a simple conductivity sensor.  Given that the ds18b20 is already a variable in my modular sensors script (based on default example script ‘simple logging.ino’), how do I call that value into my ‘calculateconductivity’ function.  I can do this in the arduino IDE using something like:

      However, I can’t seem to find this code in the modular sensors script, and when I run a second ‘sensors’ object it doesn’t seem to work.  Any help would be much appreciated.



    • #14706
      Sara Damiano

      The “best” way to work with ModularSensors would be to write the c/h files and submit them as a pull request. 🙂  But if the calculated variable is working, then feel free to keep using it that way for yourself.

      If you define your variable for the DS18 temperature as something like Variable* ds18Temp = new MaximDS18_Temp(&ds18, "12345678-abcd-1234-ef00-1234567890ab); then in your calculation equation you would use something like float ds18TempVal = ds18Temp ->getValue();  The “baro_rho_correction” example is probably the best one to look at to see something similar in action: https://github.com/EnviroDIY/ModularSensors/blob/master/examples/baro_rho_correction/baro_rho_correction.ino



    • #14712

      Thank you @srgdamiano 🙂

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