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

MS One-Wire Power

Home Forums Environmental Sensors MS One-Wire Power

Viewing 1 reply thread
  • Author
    • #17149
      KBR Kings River

        To connect 3 pin One-Wire temperature senor I had wanted to use the Grove D10-11 port.

        Power to 3.3V_SW

        Sensor to D10

        Ground to GND

        Using the ModularSensors Code   MaximDS18 ds18(OneWirePower, OneWireBus);    MaximDS18 “(22, 10);

        Using the switch power this I don’t get a reading -9999.00  however if I switch the power pin to H2 pin 1  “always on power 3.3V” I get a correct temperature value.

        I had originally used the Example_05_Mayfly_DS18B20temp.ino

        In this code the power is the  switchedPower = 22 but the switched Power is always on.

        Something with the SwitchedPower On/Off  is causing bad reading?
        I have a Sonar and a few Analog devices also using the Switched Power and they are working ?

        Do I need to make any changes to the ModularSensors/src/sensors/  MaximDS18.cpp  –  MaximDS18.h  ?
        and I really don’t how to incorporation the changed library into  VS Code PlatformIO ini file    lib_deps =   envirodiy/EnviroDIY_ModularSensors

        Thanks Ron

      • #17152
        Shannon Hicks

          Onewire sensors like the DS18b20 don’t like to have their bus power cycled on and off.   Back when I last experimented with them (with a different sketch not related to ModularSensors), if you’ve got the sensor connected to the switched power supply, you had to do “DSsensors.begin();” each time the logger woke and powered up the switched power bus.  Only then will the DS18b20 be seen by the Mayfly.  So I just put that command in the loop right after the Mayfly wakes up from sleep.

          The easy solution to this is to just connect the DS18b20 to the Mayfly’s D5-6 Grove jack and put the power-select jumper to “3.3v const”(it’s default position) that way the Onewire sensor is constantly powered and won’t “disappear” after the pin 22 switched power is cycled.  Having a constantly powered Grove jack for I2C and Onewire peripherals is exactly why I designed the Mayfly’s D5-6 jack power selection options.

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.