Conflict WiFi with dallas temperature library for ds18b20 ???
Posted: Sun Apr 15, 2018 5:50 pm
Hi guys,
I am facing a very strange problem with my esp32 module and ds18b20. Please have a look at the following code:
For some reason the first temperature reading which is before scanning for wifi networks is ok (I get correct results) but after the wifi scan networks the answer from my ds18b20 is always -127. It seems that it cannot find anymore the sensor on the wire.
This is what I have already try:
1. If I remove this line byte numSsid = WiFi.scanNetworks(); the second temperature reading is ok (I get correct results).
2. Add more delay during conversion (no success)
3. Try additional methods for reading temperature from ds18b20 (as shown in the github page) (no success)
4. Try different pins for the temperature sensor (no success)
I am out of ideas. Does anyone had the same problem?
Thank you in advance.
I am facing a very strange problem with my esp32 module and ds18b20. Please have a look at the following code:
Code: Select all
#if DEBUG
//TOOD: remove is just for test
sensors.requestTemperatures();
Serial.print("Temperature: ");
Serial.println(sensors.getTempCByIndex(0));
delay(1000);
#endif
#if DEBUG
Serial.println("** Scan Networks **");
#endif
byte numSsid = WiFi.scanNetworks();
// print the list of networks seen:
#if DEBUG
Serial.print("SSID List:");
Serial.println(numSsid);
// print the network number and name for each network found:
for (int thisNet = 0; thisNet<numSsid; thisNet++) {
Serial.print(thisNet);
Serial.print(") Network: ");
Serial.println(WiFi.SSID(thisNet));
}
Serial.println("Wifi ssid: " + (String)wifiSSID);
Serial.println("Wifi pass: " + (String)wifiPASS);
#endif
#if DEBUG
//TOOD: remove is just for test
sensors.requestTemperatures();
Serial.print("Temperature: ");
Serial.println(sensors.getTempCByIndex(0));
delay(1000);
#endif
This is what I have already try:
1. If I remove this line byte numSsid = WiFi.scanNetworks(); the second temperature reading is ok (I get correct results).
2. Add more delay during conversion (no success)
3. Try additional methods for reading temperature from ds18b20 (as shown in the github page) (no success)
4. Try different pins for the temperature sensor (no success)
I am out of ideas. Does anyone had the same problem?
Thank you in advance.