-->
Page 1 of 1

NodeMCU devkit and DS18B20 sample code invalid temp

PostPosted: Wed Apr 15, 2015 9:16 pm
by sprior
I hooked a DS18B20 OneWire temp sensor to my brand new NodeMCU devkit device and ran the sample DS18B20 code right from the firmware examples on github and the sensor seems to be working, but the displayed temperature isn't even close to correct. It's not clear exactly what schematic I should use for this, I've seen examples with and without a 4.7k resistor from V+ to the data pin on the DS18B20, neither way produced a correct temperature reading. It appears there have been some recent changes to the DS18B20 example code, so I don't know for sure the example code works yet or not.

Can someone clarify whether they've been able to get it to work with the devkit device and if so exactly what circuit and code they used?

Re: NodeMCU devkit and DS18B20 sample code invalid temp

PostPosted: Tue Apr 21, 2015 1:45 pm
by sprior
I think I found the problem. The DS18B20 library looks for family code 0x28 or 0x10 temperature devices, but apparently the code to interpret the values for these two families isn't the same, it it works if you attach a 0x28 (newer) device, but you get an invalid value for 0x10 (older) devices. I've got Arduino code which interprets both correctly, so in the short term I'll switch to a 0x28 device, but see if I can come up with the code that would make a 0x10 work as well. In this case the DS18B20 module name would be a little incorrect because the DS18B20 implies a 0x28 device, once fixed the module should maybe be renamed to the more generic DS1820 or something like OnewireTemp.