I have a simple test program for a DS18b20 temperature sensor which works fine with an ESP826 on a Wemos D1 mini board. If I substitute the ESP8266 for an ESP8266 Pro on a WEMOS D1 Mini Pro the code runs but the read of the sensor fails.
Pinouts etc of the two board are identical.
I am using the latest Arduino IDE and the DS18B20 library from Miles Burton and the OneWire library from Tim Studt et al ( i.e. standard libraries downloaded via the Arduino IDE ).
Here is the code :
/*
* Simple test program for Dallas DS18B20 Temperture sensor
* ********************************************************
*
* Initialsises Sesnor, then reads sensor and displays temp every 5 seconds approx.
*/
#include <OneWire.h>
#include <DallasTemperature.h>
#define APP_NAME "Dallas DS18b20 test program"
#define APP_VERSION "v0.01" // 19/06/2025 Initial version
#define WEMOS_MINI_PIN_D1 5
#define WEMOS_MINI_PIN_D2 4
#define WEMOS_MINI_PIN_D3 0
#define WEMOS_MINI_PIN_D4 2
#define WEMOS_MINI_PIN_D5 14
#define WEMOS_MINI_PIN_D6 12
#define WEMOS_MINI_PIN_D7 13
#define WEMOS_MINI_PIN_D8 15
OneWire oneWire(WEMOS_MINI_PIN_D3); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
char Buffer[128];
float fTempC;
void setup()
{
Serial.begin( 115200 );
delay( 1000 );
oneWire.reset(); // Configure Temperature Sensor
sensors.begin();
sprintf( Buffer, "\n\n%s %s", APP_NAME, APP_VERSION );
Serial.println( Buffer );
}
void loop()
{
sensors.requestTemperatures();
fTempC = sensors.getTempCByIndex(0);
if( fTempC == DEVICE_DISCONNECTED_C )
strcpy( Buffer, "Temp sensor error" );
else
sprintf( Buffer, "%2.1f", fTempC );
Serial.println( Buffer );
delay( 5000 );
}
When I look at the IDE Serial Monitor output for the ESP8266 I see this for example :
17:28:45.609 -> Dallas DS18b20 test program v0.01
17:28:46.302 -> 28.3
17:28:51.963 -> 28.3
17:28:57.625 -> 28.2
17:29:03.294 -> 28.2
and when I substitute the ESP8266 Pro board I see this :
17:30:37.949 -> Dallas DS18b20 test program v0.01
17:30:37.949 -> Temp sensor error
17:30:42.978 -> Temp sensor error
17:30:47.936 -> Temp sensor error
17:30:52.941 -> Temp sensor error
I get the same results if I compile the ESP8266 Pro version targeted ( by the IDE ) at an ESP8266 or ESP8266 Pro.
I'd be grateful for suggestions as to why this is happening. Thanks