wemos mini not reading ds18b20 temp sensor

I have spend a good few hours now trying to get a temperature reading from a ds18b20 temp sensor. I have used the sensors I have before without problem. So there is something I am doing wrong.
I have 2 sensors and 2 wemos mini, I have tried both of them at different combination without success, so i doubt both of them to be broken as I have used them in the past..

I am using a simple sketch to try it out, found here
https://github.com/milesburton/Arduino-Temperature-Control-Library/blob/master/examples/Simple/Simple.pde

Requesting temperatures...DONE
Error: Could not read temperature data

I have used this tutorial as reference how to wire it (but using only a single sensor). And I am pretty sure I have connected the cables right? Just in case I have attached an image.

I hope that someone have an idea what I doing wrong!

So I finally managed to solve it!

I had to specify D1 as pin. Just using a number as 1 (as taken from the sketch example) did not work.
What would the example 1 means vs D1 that actually work mean?

On Arduino UNO, D1 means DIGITAL 1 (0 thru 13) A1 would be analog input 1 (0 thru 5), when that program was written, no one ever heard of a Wemos. :slight_smile:

If you are correct and the sensor is OK then your message: "Error: Could not read temperature data" indicates it is improperly wired or the Pull up resistor is missing or disconnected. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

It was properly wired. But...

if(tempC != DEVICE_DISCONNECTED_C)

Could not find any device. Device could be found on D1 not on 1.
The error message is not generated by the library but from the code example, so in that sense it was not very helpful to identify the problem. It was still a software issue

JCA34F:
On Arduino UNO, D1 means DIGITAL 1 (0 thru 13) A1 would be analog input 1 (0 thru 5),

You can't use D1 as pin designator for an Arduino sketch. It doesn't compile. On an Uno board those pins are simply numbered, no D prefix.

On the WeMOS D1 is GPIO5, so most likely D1 is defined as 5. There is no obvious relation between the WeMOS (or NodeMCU) D0-D9 pin numbering and the ESP8266 GPIO pin numbers...