My board is Arduino Nano Sense BLE (one of most problematic board I every used), almost nothing works normally on this board and must be modded. For now I find this board perfect for flashing with LEDs and highlight my ceiling. Forgive me my frustration.
I have connected the temp sensor to 3.3v, GDN and signal pin (tried two, 2 and A0). I have cut the wire on temp sensor to be 50 cm. A resistor of 2.2k attached between 3.3V and signal pin.
All I get is -127 as result. Somebody please can tell me how to make the sensors work on this board? I tried to run it on standard UNO board - works. There is something wrong with nano boards, it is common issue if you will search internet for such topics.
Anybody please? I am in a bit of rush, must finish my project within 4 days and I spent last 3 on fighting with the temp sensors. Insane.
I performed a test on UNO to isolate possible powering and sensor fault. Test looked as follows:
Connection of DS18B20 (waterproof version)
Black -> GDN
Red -> 3V
Yellow ->D2
Last two connected via 2k2 resistor (2k2 instead 4k7 as I use 3V).
Then, to exclude possible codding mistakes I used ready example:
// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/*
* The setup function. We only start the sensors here
*/
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin();
}
/*
* Main function, get and show the temperature
*/
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");
// After we got the temperatures, we can print them here.
// We use the function ByIndex, and as an example get the temperature from the first sensor only.
Serial.print("Temperature for the device 1 (index 0) is: ");
Serial.println(sensors.getTempCByIndex(0));
delay(1000);
}
Result? works perfectly fine.
Then I switched to Nano Sense BLE board. without disconnecting the sensor I just switched connection on board's end and attached GDN, 3.3V and D2.
Result, -127. When trying to find DS18B20 address the result is none. I suspect board's pins order issue or Dallas/OneWire lib issue.
I need urgent help, I have two days left ot make it work and pass my project, no time to even order any other temperature sensors.
I also tried other libs to handle DS18B20, none works, and I tried like 3-4 of them. Arduino staff could look into the issue please, as I noticed there is few topics around internet regarding nano series and none are resolved. I found also IoT and Every has the same problem.
Findings are sad. OneWire HAL is not compatible with that board, yet. Author of the lib cannot assure when and if compatibility will be brought. Dedicated Mbed solution is here: OneWire - 1-Wire® library for mbed. Complete 1-Wire librar… | Mbed but requires analyze, adaptation and tests.
I ran into the same difficulties and ended up writing my own implementation.
With it, if you have only one DS18B20 on the bus, you don't even need external pull up resistor any more. =)