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

User avatar
By dataguy
#73178 Odd Problem. Sensors are checked and work OK on pro mini. As soon as I port the solution to ESP8266 80 odd degrees instead of 25 C. Temp sampled every 2 mins. Itemp and otemp are floats, tmpo and tmpi char arrays [10]. Pullup is with a 3.3K resister, though anything around that seems to work ~1k to 5.6k. leads are very short, parasitic mode. exactly the same setup on 3.3v pro mini works 100%, with normal temperatures reported.

// DS18B20 temperature sensor setup

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

Any help or thoughts much appreciated.
Best regards
dataguy

//setup stuff

DS18B20.begin();
DS18B20.setResolution(10);// 0.25 degrees
DS18B20.setWaitForConversion(false);
DS18B20.requestTemperatures();

void gettemp(){
otmp = DS18B20.getTempCByIndex(0);
itmp = DS18B20.getTempCByIndex(1);
dtostrf(otmp,5,1,tmpo);
dtostrf(itmp,5,1,tmpi);
sprintf(str1,"Temperatures: in %sC, out %sC \n",tmpi,tmpo);
sprintf(dstr3,"In%sC Out%sC",tmpi,tmpo);
Serial.print("Temp #1 ");
Serial.print(otmp);
Serial.print("C, Temp #2 ");
Serial.print(itmp);
Serial.println("C");
DS18B20.requestTemperatures(); // for next time round
}

Result is :-
IP address: 192.168.1.13
Temp #1 81.00C, Temp #2 76.75C
HTTP server started
Temp #1 81.00C, Temp #2 76.75C

Any help or ideas much appreciated.

Best Regards

Dataguy
User avatar
By dataguy
#73280 After extensive testing it appears to be a software/library issue. What clinched it was when I uploaded a sketch from https://tech.scargill.net/tag/esp8266-dallas-chip/ . This does not use the dallas temperature or onewire library, and gives correct readings.

I did try a slighly older dallastemperature library but the results were unaltered.

@ rudy I did not try powering the devices as it seemed likely this would make no difference, but thanks for the suggestion.

Scargill library:-
Here's your temperature 22cMain loop running
Resetting sensor .. .
Resetting sensor .. .
Here's your temperature 22cMain loop running
Resetting sensor .. .
Resetting sensor .. .

Pin 12 on ESP8266 (also tried on pin 14 with no differences)

Dallas Temperature IC Control Library Demo
Locating devices...Found 2 devices.
Parasite power is: ON
Found device 0 with address: 28FFD9C0621704D5
Setting resolution to 10
Resolution actually set to: 10
Found device 1 with address: 28FF473A22170318
Setting resolution to 10
Resolution actually set to: 10
Device#0 Temp 79.75C Device#1 Temp 76.25C
Device#0 Temp 79.75C Device#1 Temp 76.25C
Device#0 Temp 79.75C Device#1 Temp 76.25C
Device#0 Temp 79.75C Device#1 Temp 76.25C
Device#0 Temp 79.75C Device#1 Temp 76.25C

On 328 mini @8mhz and 3.3v

Dallas Temperature IC Control Library Demo
Locating devices...Found 2 devices.
Parasite power is: ON
Found device 0 with address: 28FFD9C0621704D5
Setting resolution to 10
Resolution actually set to: 10
Found device 1 with address: 28FF473A22170318
Setting resolution to 10
Resolution actually set to: 10
Device#0 Temp 22.75C Device#1 Temp 25.75C
Device#0 Temp 22.75C Device#1 Temp 25.75C
Device#0 Temp 22.75C Device#1 Temp 25.75C
Device#0 Temp 22.75C Device#1 Temp 25.75C