Closed indymx closed 2 years ago
only on OneWireNG, as that's the only lib that I have found that works with ESP32-S2 and DS18B20.
I believe I'm using .10
I'm including the following in my sketch:
Could be cheap china sensors. I'm going to take one apart tonight to see what exactly is in there..
I have the following in my "failure" loop:
while (tmpread <= 0)
{
getTemp();
debugln("checking sensor... ");
delay(500);
TelnetStream.println("Sensor Failed. Checking");
delay(500);
debugln("Toggle pin state");
digitalWrite(OW_PIN, LOW);
delay(500);
digitalWrite(OW_PIN, HIGH);
};
does not help...
https://github.com/indymx/TpLink-Arduino/blob/main/TpLink-Arduino_TempControl.ino
I need to know exact version. There is a problem with 0.10.2 on ESP32. Use 0.10.3 or 0.11.0 (preferred). Check with the DallasTemperature example if the problem occurs.
Just checked, I'm showing 0.10.3 in the library.properties file.
I'll update to 0.11 tonight when I get home to see if that helps.
I run the DallasTemperature example on my ESP32-S2 setup for about 1 hour and didn't get any single error for temp. reading.
This time it ran for about 7 hours before it stopped working.
On Thu, Apr 7, 2022 at 2:54 PM Piotr Stolarz @.***> wrote:
I run the DallasTemperature example on my ESP32-S2 setup for about 1 hour and didn't get any single error for temp. reading.
— Reply to this email directly, view it on GitHub https://github.com/pstolarz/OneWireNg/issues/44#issuecomment-1092092215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGXRTNP2Q34W2JDNNX2SODVD4VOFANCNFSM5SYYNDQQ . You are receiving this because you authored the thread.Message ID: @.***>
It seems that authentic Dallas / Maxim Integrated sensors are impossible to get right now. Hopefully the ones I just got on Ebay are real..
You may consider push-pull circuit controlled by dedicated GPIO which will reset the DS18B20 (shorts its VDD pin to GND) in case of such deadlock.
https://open4tech.com/open-drain-output-vs-push-pull-output/
I will have to do some research on the push/pull. I read that link, I understand the concept, but need to see exactly how to implement that..
Second link is awesome. Thanks for sharing. That will definitely come in handy.
Well, it appears that I am dealing with Family C clones. 28-FF-64-1E-08-75-19-06: Family C (Clone).
Since it's near impossible to get genuine sensors right now, do you have any suggestions beyond the push/pull circuit?
The circuit is very simple and consists of 2 MOSFETS (P and N)
GPIO is set to low (GND), therefe Q1 is conducting Q2 is not. DS18B20's VDD pin is provided with voltage.
GPIO is set to High (Vcc), therefe Q1 is not conducting and VDD is shorted to GND via Q2. DS18B20 is not powered in this case (reset state).
The question is if it's really a problem with DS18B20 and it's reset will solve your issue.
If you would like to experiment with this circuit I recommend this simulator: https://www.falstad.com/circuit
The above circuit is described by:
$ 1 0.000005 12.050203812241895 50 5 50
f 336 176 384 176 33 1.5 0.02
f 336 272 384 272 32 1.5 0.02
w 336 224 336 272 0
w 256 224 336 224 0
w 384 160 384 128 0
w 384 288 384 320 0
g 384 336 384 352 0
R 384 128 384 80 0 0 40 5 0 0 0.5
w 384 192 384 224 0
S 256 224 224 224 0 0 false 0 2
w 336 224 336 176 0
w 384 336 384 320 0
w 384 224 480 224 0
w 384 256 384 224 0
R 224 208 224 160 0 0 40 5 0 0 0.5
g 224 240 224 272 0
x 178 227 208 230 4 12 GPIO
x 396 275 412 278 4 12 Q2
x 403 183 419 186 4 12 Q1
x 476 211 501 214 4 12 VDD
At first try you may to use GPIO (in the output mode) connected directly do DS18B20's VDD pin to power it. In working mode GPIO is high, for reset low. Maybe it will be sufficient for your case and you dont need to bother with push-pull circuit. But in this case you must be sure the GPIO output type is not open-drain, since this type of output is not able to provide voltage source to VDD.
I'm not finding anything in the datasheets that explicitly says whether or not it's open-drain.
I'm using an Adafruit ESP32S2 TFT. The ESP32-S2 datasheet has this: (but that's the only reference I can find)
It's also possible that I'm in way over my head on this..
Connect DS18B20 as follows:
During initialization phase GPIO_VDD
is set high (output, non open-drain mode), GPIO_DQ
is managed by the lib:
pinMode(GPIO_VDD, OUTPUT);
digitalWrite(GPIO_VDD, 1);
new (&_ow) OneWireNg_CurrentPlatform(GPIO_DQ, false);
For reset GPIO_VDD
and GPIO_DQ
are shorted to GND for specific amount of time (1 sec here):
auto& ow = (OneWireNg_CurrentPlatform&)_ow;
digitalWrite(GPIO_VDD, 0); ow.setBus(0); delay(1000);
NOTE: `OneWireNg_BitBang::setBus()` method is protected so you need to move this method from protected to public in `OneWireNg_BitBang.h` file
* Back to life after reset. `GPIO_VDD` to high. `GPIO_DQ` set to high impedance (as input):
```cpp
auto& ow = (OneWireNg_CurrentPlatform&)_ow;
ow.setBus(1);
digitalWrite(GPIO_VDD, 1);
I'm having an issue where after a random amount of time the DS18B20 will stop sending valid data. I don't have any good debug showing what data is being sent or if any when the issue starts, but I do have my script go into a failure loop when it see's a 0 for temp on the sensor.
It usually requires a complete power cycle of the ESP32 to get it to read again. Is there a way to force the sensor to reset ?