Multiple DS18B20 and DallasTemperature library
Posted: Fri Feb 12, 2016 5:37 pm
Hi
I have a couple of DS18B20 wired to a NodeMCU in parasite mode. I use a 1K pullup resistor, but I've noticed something strange when using the DallasTemperature library with more than 1 sensor. One of the sensors is connected through a 2 meter long wire, while the other is mounted directly on the board.
In the beginning I was using just one sensor, and my readings were correct. Now I have 2 connected, and the reading are way off. But if I only use the onewire library and use the ds18b20 example from there, then I get valid readings from both sensors, so something is messing it up.
Here's serial output using first the DallasTemperature Library and second only onewire library.
You guys have any idea as to why the DallasTemperature Library is behaving like this when I have 2 sensors connected on the same wire?
I have a couple of DS18B20 wired to a NodeMCU in parasite mode. I use a 1K pullup resistor, but I've noticed something strange when using the DallasTemperature library with more than 1 sensor. One of the sensors is connected through a 2 meter long wire, while the other is mounted directly on the board.
In the beginning I was using just one sensor, and my readings were correct. Now I have 2 connected, and the reading are way off. But if I only use the onewire library and use the ds18b20 example from there, then I get valid readings from both sensors, so something is messing it up.
Here's serial output using first the DallasTemperature Library and second only onewire library.
Code: Select all
// DallasTemperature Multiple example
Locating devices...Found 2 devices.
Parasite power is: ON
Device 0 Address: 289B161E070000E0
Device 1 Address: 28FF42A6921501A8
Device 0 Resolution: 12
Device 1 Resolution: 12
Requesting temperatures...DONE
Device Address: 289B161E070000E0 Temp C: 127.94 Temp F: 262.29
Device Address: 28FF42A6921501A8 Temp C: 46.38 Temp F: 115.47
Requesting temperatures...DONE
Device Address: 289B161E070000E0 Temp C: 127.94 Temp F: 262.29
Device Address: 28FF42A6921501A8 Temp C: 46.38 Temp F: 115.47
// OneWire DS18S20, DS18B20, DS1822 Temperature Example
ROM = 28 9B 16 1E 7 0 0 E0
Chip = DS18B20
Data = 1 78 1 4B 46 7F FF 8 10 51 CRC=51
Temperature = 23.50 Celsius, 74.30 Fahrenheit
ROM = 28 FF 42 A6 92 15 1 A8
Chip = DS18B20
Data = 1 CD 1 4B 46 7F FF 7F 10 B1 CRC=B1
Temperature = 28.81 Celsius, 83.86 Fahrenheit
No more addresses.
You guys have any idea as to why the DallasTemperature Library is behaving like this when I have 2 sensors connected on the same wire?