Quantcast
Channel: Sensors - Arduino Forum
Viewing all articles
Browse latest Browse all 1146

DS18B20 and Firebeetle 2 (ESP32-C6) : no device found

$
0
0

Hello, I'm experiencing a particularly strange problem with DS18B20 sensors using a FireBeetle 2: I've used several probes, but OneWire can't return a device, so it always returns -127°C on requestTemperatures.

Here the pin diagram for FireBeetle 2 (ESP32 C6):


(from the seller: Firebeetle 2 Board ESP32-C6 Microcontroller Wiki - DFRobot)

My wiring is very basic using a bread board:

  • DS18B20 with VDD to 3.3V, ground and data to pin 9 (D9)
  • Pull-up 4.7K resistor between data and 3.3V (I also try a lower resistor 2.1K)
  • powering by USB C (in schematics i kept the LiPo battery as it will used with it)

Sorry for the typo in schematics I do not found ESP32-C which have a different pinout...


I used 5 different DS18B20 because I suspected it might be ko:

  • 1 of 1m from az-delivery,
  • 2 of 3m from az-delivery,
  • and 2 of 3m from a Chinese seller.

Here the code I used:

#include <OneWire.h>
#include <DallasTemperature.h>

// GPIO where the DS18B20 is connected to
const int oneWireBus = D9;
// const int oneWireBus = 9;
const byte temperaturePrecision = 11;

OneWire oneWire(oneWireBus);

DallasTemperature sensors(&oneWire);

void setup() {
  Serial.begin(115200);
  pinMode(oneWireBus, INPUT);

  sensors.setResolution(temperaturePrecision);
  sensors.begin();

  Serial.print("Found devices: ");
  Serial.println(sensors.getDeviceCount(), DEC);

  Serial.print("Parasite power is: "); 
  if (sensors.isParasitePowerMode()) Serial.println("ON");
  else Serial.println("OFF");

  uint8_t address[8];
  if (sensors.getAddress(address, 0)) {
    Serial.print("Address fetched:");
    for (int i = 0; i < 8; i++) {
      Serial.printf("%02X ", address[i]);
    }
  } else {
    Serial.println("Error fetching the address");
  }
}

void loop() {
  Serial.print("loop, pin ");
  Serial.println(oneWireBus);
  sensors.requestTemperatures();
  float temperatureC = sensors.getTempCByIndex(0);
  Serial.print(temperatureC);
  Serial.println("ºC");
  delay(2000);
}

Here is the output:

00:11:23.532 -> Found devices: 0
00:11:23.532 -> Parasite power is: OFF
00:11:23.532 -> Error fetching the address
00:11:23.532 -> loop, pin 9
00:11:23.532 -> -127.00ºC
00:11:25.304 -> loop, pin 9
00:11:26.073 -> -127.00ºC

Software used:

I have no idea why this do not works... any suggestion?

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1146

Trending Articles