Temperature probe sometimes reading -127

Good day Everyone,

I have 3 x esp32 devices reading temperature from ds18b20 temperature probes,
same build same sketch.
1 device runs 100 %
1 device, had 2 reading errors in 24 hours, and shows reading as -127 (so didnt get reading from probe)
1 device, had 6 reading errors in the same 24 hour period, also giving -127 readings, before the error readings and after the error readings the device runs fine for hours and gets readings every 30 min. ..so not sure what could be causing this . if it was faulty wires or power supply it should be giving alot more of these errors. .if anyone could help that would be awesome thanx.

Hard to answer. It can be a problem on 1-Wire bus. Too long wires, not reliable connection, unsuitable design of the bus, other circuit influence, etc. For an example switching relays can cause a problem.
If the occurrence is rare it is not so bad.
It is not easy to find the right solution. Easy one is to try decrease pull-up resistor or to add small 68-100ohm serial resistor on the data pin close to each sensor.

where you buy these 18B20?

The market is full of fake 18B20.
Buy in “reputable” stores.

Ref: GitHub - cpetrich/counterfeit_DS18B20: How to tell original from fake DS18B20 temperature sensors.

How do I know?

If the ROM does not follow the pattern 28-xx-xx-xx-xx-00-00-xx then the DS18B20 sensor is a clone [5].

Also, there are two Arduino sketches provided to test DS18B20 sensors:

  • discover_fake_DS18B20.ino performs some harmless tests and indicates if they show deviations from authentic DS18B20. Not designed to work with parasitic power.
  • classify_fake_DS18B20.ino is a minimal implementation matching a sensor to a specific Family (see below) based on the response to undocumented function codes. Output is specific but rather boring. Use at your own risk.

Any of these used outdoors or in water ?

Hi there..no none of them outdoor..they are all set up to read temperatures from fridges.
Im suspecting the fridge motors are causing noise interverance or electrical spikes when the motor starts up.
I have also tried capasitors and ferret beads.

What value is your pull-up resistor?

The following site says:

OneWire requires a single 4.7K pullup resistor, connected between the pin and your power supply. When using very long wires, or with counterfeit DS18B20 chips and 3.3V power, a resistor in the 1K to 2.7K range may be required.

So maybe try 2.2k and see if that helps.

https://www.pjrc.com/teensy/td_libs_OneWire.html

FWIW, I've had no problem with my two genuine DS18B20 monitoring my fridge, using a 3.3k pull-up, and an ESP32.

It may happen due to bad connection. Here is another thread regarding this issue: wrong data from DS18B20 temperature sensor

:laughing:

This guidance is worth a read

Here

As a bodge , you can set your software to ignore the - 127 readings .
Have a look at that guidance.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.