ds18b20 always reads zeroes

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
RE:
New user
Posts: 5
Joined: 11 Oct 2016, 15:01

ds18b20 always reads zeroes

#1 Post by RE: » 15 Oct 2016, 13:06

Hi,

ESPEasy works quite well on WemosD1 and Witty Cloud devices using a DHT22 sensor. Thanks a lot for this great sw!

Unfortunately I cannot get any DS18b20 temp sensor working. The boards are powered by 2A power-banks. The IDX / Var is definitely NOT zero. I tried different values (1, 2, 22, 77, 120, etc.) to no avail.

One single time the ESP could read the 1-wire id of the sensor. But, whenever I reflash or reboot the sensor id is 0-0-0-0-0-0-0-0 and the temperature always shows as 0.0. (BTW, it is unfortunate to show a not uncommon temperature as error value, I'd prefer NaN or 85.0)

Using the Arduino library with my own program or with Homie and a competely untouched same wiring, I can perfectly read correct ids and temperature values.

regards
RE:

RE:
New user
Posts: 5
Joined: 11 Oct 2016, 15:01

Re: ds18b20 always reads zeroes

#2 Post by RE: » 15 Oct 2016, 14:11

BTW, I tried the following firmware versions: 78, 108, 120, and 137

The log shows:
9214976 : WD : Uptime 153 ConnectFailures 0 FreeMem 26960
9214977 : WD : Uptime 153 ConnectFailures 0 FreeMem 26960
9230940 : DS : Temperature: 0.00 (28-57-47-f3-6-0-0-25)
9244978 : WD : Uptime 154 ConnectFailures 0 FreeMem 26960
9274979 : WD : Uptime 154 ConnectFailures 0 FreeMem 26960
9291000 : DS : Temperature: 0.00 (28-57-47-f3-6-0-0-25)
9304980 : WD : Uptime 155 ConnectFailures 0 FreeMem 26960
9334981 : WD : Uptime 155 ConnectFailures 0 FreeMem 27040
9351148 : DS : Temperature: 0.00 (28-57-47-f3-6-0-0-25)

RE:

RE:
New user
Posts: 5
Joined: 11 Oct 2016, 15:01

Re: ds18b20 always reads zeroes

#3 Post by RE: » 09 Nov 2016, 09:20

I realized that the problem does not exist on pin 2 (D4). ESPEasy detects all sensors and reads perfectly well all data if the 1-wire sensors are attached to pin2. At other pins the sensors do not get detected or always read zero.

What is so special about GPIO-2 (D4) on the Wemos D1 mini?

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: ds18b20 always reads zeroes

#4 Post by Drum » 09 Nov 2016, 11:52

Which version are you using? The waterproof ones, stainless steel end on the long black cable generally have a pull-resister built in. Check the schematic on the wimos, it may have a pull-up on GPIO2.
The datasheet for the ds18b20 shows a 4.7k pullup from VCC to data. This is also in other threads in the forum, a search on ds18b20 should have found it, searching on ds18b20 and wemos might be even more helpful.

Also it is a good idea to have the data sheets for components you use handy, they can be very helpful.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ds18b20 always reads zeroes

#5 Post by papperone » 09 Nov 2016, 14:07

RE: wrote:I realized that the problem does not exist on pin 2 (D4). ESPEasy detects all sensors and reads perfectly well all data if the 1-wire sensors are attached to pin2. At other pins the sensors do not get detected or always read zero.

What is so special about GPIO-2 (D4) on the Wemos D1 mini?
Can you please confirm you wired a 4.7k resistor between VCC and DATA of the DS18B20? This is mandatory to have it properly working.
Regarding the different PIN behavior D4 and D3 in the WeMos D1 mini have a pull-up resistor (so in theory they shoudl act the same).
On top of this the D4/GPIO2 is connected to the blue built-in LED of the WeMos, but I'm not sure it shoudl make any difference...
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

ToniA
Normal user
Posts: 69
Joined: 26 Aug 2016, 20:37

Re: ds18b20 always reads zeroes

#6 Post by ToniA » 09 Nov 2016, 16:44

I have a bunch of Wemos D1 mini boards, and without further thinking I just wired the water-proof DS18B20 sensors to D4. Just because it's next to +5V and GND. And they all work beautifully.

https://wp.josh.com/2014/06/23/no-exter ... mp-sensor/

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests