Well…
I dug up my old DS18B20, in the TO-92 package, and connected it (on a solderless breadboard) to my XIAO BLE Sense module:
DS18B20 Pin 1 to Gnd from the XIAO BLE Sense
DS18B20 Pin 2 to Pin D2 of the XIAO BLE Sense, with a 4.7K Resistor pulled up to 3.3V
DS18B20 Pin 3 to 3.3V from the XIAO BLE Sense
I took your software and made the following changes:
1.
I put the following at the top of the file
#include <OneWire.h>
2.
I changed your OneWire object instantiation to
OneWire ds(2); // On pin 2 ---A 4.7K pullup resistor is required
Then I loaded board package 1.0.0 from the Board Manager’s “Seeed nRF52 mbed-enabled Boards” package, and selected the “Seeed nRF52840” board. (Doesn’t matter whether you select “Seeed nRF52840” or “Seeed nRF52840 Sense”)
You can try one of the other board options if you want, but I’m telling you what works for me. (See Footnote.)
Anyhow, output is now consistent with temperature measured at the DS18B20 with my handy-dandy GM320 Infrared Thermometer.
ROM = 28 5F 1 A8 2 0 0 23
Chip = DS18B20
Data = 1 DB 1 4B 46 7F FF 5 10 27 CRC=27
Temperature = 29.69 Celsius, 85.44 Fahrenheit
No more addresses.
ROM = 28 5F 1 A8 2 0 0 23
Chip = DS18B20
Data = 1 DB 1 4B 46 7F FF 5 10 27 CRC=27
Temperature = 29.69 Celsius, 85.44 Fahrenheit
No more addresses.
.
. Etc.
.
Regards,
Dave
Footnote:
[/Begin Editorial Rant]
The XIAO BLE boards are terrific hardware items. Have used on a couple of experimental BLE projects. Not bad.
However…
The software is VERRRRRRRY Frustrating. Several releases that are, in some unpredictable, inexplicable, and inexcusable ways, incompatible. I wish Seeed would start all over. Make another board with these capabilities but give it another name. And don’t release a blasted bloomin’ thing until and unless SOMEONE would actually test the software and would publish examples that actually work “out of the box.” Life is simply too short to for some of us to keep dicking around with different versions that more-or-less work (mostly less).
[/End Editorial Rant]