Home › Forums › Environmental Sensors › MS One-Wire Power
Tagged: ModularSensors
- This topic has 1 reply, 2 voices, and was last updated 2022-07-17 at 6:07 PM by Shannon Hicks.
-
AuthorPosts
-
-
2022-07-14 at 10:51 PM #17149
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
//github.com/EnviroDIY/LearnEnviroDIYcode/tree/master/Part1-sketches/Example_05_Mayfly_DS18B20tempIn 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_ModularSensorsThanks Ron
-
2022-07-17 at 6:07 PM #17152
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.
-
-
AuthorPosts
- You must be logged in to reply to this topic.