DS18b20 wrong readout
Posted: Sun Dec 14, 2014 10:48 am
Hello,
I'm currently trying to get a DS18B20 module to work with the ESP8266.
I'm using the lib: https://github.com/nodemcu/nodemcu-firm ... 8b20.EN.md
with the following code:
This returns:
As you can see, it is reading a temperature of 2,5625°C, which is ofcourse wrong.
I tested the hardware setup by connecting the datapin to an arduino and got the correct readout of about 21°C.
My DS18B20 is a geniune one, not a chinese clone. Any ideas what could be wrong here?
Thanks,
Tobias
I'm currently trying to get a DS18B20 module to work with the ESP8266.
I'm using the lib: https://github.com/nodemcu/nodemcu-firm ... 8b20.EN.md
with the following code:
Code: Select all
ds18b20 = require("ds18b20")
ds18b20.setup(8)
addrs = ds18b20.addrs()
if (addrs ~= nil) then
print("Total DS18B20 sensors: "..table.getn(addrs))
end
print(ds18b20.readNumber(addrs[1],ds18b20.C))
print(ds18b20.readNumber(addrs[1],ds18b20.F))
print(ds18b20.readNumber(addrs[1],ds18b20.K))
This returns:
Code: Select all
Total DS18B20 sensors: 1
2 5625
36 6125
275 7125
As you can see, it is reading a temperature of 2,5625°C, which is ofcourse wrong.
I tested the hardware setup by connecting the datapin to an arduino and got the correct readout of about 21°C.
My DS18B20 is a geniune one, not a chinese clone. Any ideas what could be wrong here?
Thanks,
Tobias