Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By fddev33
#77228 Hello everybody
I'm not used with asking for help ...but today, i feel like i need it!

I put my DS18B20 in a glass of water
My sensor is attach to D3 pin from nodmcu
Voltage of sensor is 3.3V
Pull up resistance is 4.7k (I ve also tried 1k or 8k)

Here is a sample of the values I've read :
Temperature : 23.25
Temperature : 23.37
Temperature : 23.12
Temperature : 23.25
Temperature : 23.37
Temperature : 23.37
Temperature : 22.62
Temperature : 23.12
Temperature : 23.25
Temperature : 23.37
Temperature : 23.25
Temperature : 23.25
Temperature : 23.25
Temperature : 23.25
Temperature : 22.50
Temperature : 23.37
Temperature : 23.12
Temperature : 23.12
Temperature : 22.62
Temperature : 22.62
Temperature : 23.25
Temperature : 23.25
Temperature : 23.25
Temperature : 23.37
Temperature : 23.25
Temperature : 22.62
Temperature : 23.25
Temperature : 23.25
Temperature : 23.25
Temperature : 23.12
Temperature : 23.25
Temperature : 22.62
Temperature : 22.62
Temperature : 23.25
Temperature : 23.25
Temperature : 22.62
Temperature : 23.12



Minimum is 22.50
Maximum is 23.37
within 1min, in a simple glass of water ...i really think that is not acceptable :roll: :!:

:idea: How can i have value more stable ?
:(
Thanks a lot !

here is my code
Code: Select all#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS D3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup(void)
{
  Serial.begin(9600);
  sensors.begin();
}
void loop(void)
{
  sensors.requestTemperatures();
  Serial.print("Temperature : ");
  Serial.println(sensors.getTempCByIndex(0)); 
  delay(1000);
}



note :
- Hardware: [ESP-12e module]
- Core Version: [packages\esp8266\hardware\esp8266\2.4.1]
- Development Env: [Arduino IDE 1.8.5]
- Operating System: [Windows]
User avatar
By btidey
#77418 I have always found the readings from DS18B20 to be very stable. I have about 12 in active use and they do not vary by more than 0.1C from one reading to the next.

They are programmeable to have 9,10,11,12 bit conversion (0.5C, 0.25C, 0.125, 0.0625C). This configuration is stored in EEPROM in the device so will persist if it is every changed from the normal default of 12 bits.

I wonder if your DS18B20 has somehow been programmed into 9 bit mode which could explain your results.

The library has getResolution and setResolution functions.
User avatar
By rudy
#77421 The results do look bad. Where did you get it from.

I had designed a power supply board at work and included was a INA219 current monitoring IC. I had the purchaser order 50, for the prototype run, from a Aliexpress seller. They were half the price compared to buying them from normal distributors. And they were crap. We had to replace all of them.

Is the DS18B20 near the antenna? I know that the radiated signal can affect sensors. Or maybe the power supply isn't clean enough for stable readings. Maybe add a capacitor across the supply pins on the sensor.