Open KaoruTK opened 6 months ago
Hi there. I am trying to use pin 43 to read a Dallas Sensor and can't seem to make it work. I believe I have replaced the code in the OneWire_direct_gpio.h
correctly but don't really know. Here is my file. Any help would be greatly appreciated.
this lib supports pins >32 https://github.com/pstolarz/OneWireNg
@uzi18 Thank you. Will look into it this weekend
Works like a charm! thank you mate!
@DennisDG lib or patch?
Description
We encountered an issue with the OneWire library on the ESP32-S3 when using pin 48. The library originally only supported pins up to 36. To enable the use of pin 48, we modified the OneWire_direct_gpio.h file.
Steps To Reproduce Problem
Use an ESP32-S3 board. Connect a DS18B20 sensor to pin 48. Attempt to read data using the OneWire library without the modifications. Observe that it does not work due to pin limitations in the library.
Hardware & Software
Board: ESP32-S3 Modules used: DS18B20 temperature sensor Arduino IDE version: 1.8.19 ESP32 Board Manager package version: 2.3.2 Operating system & version: Windows 10 Other software/hardware: None
Arduino Sketch
include
include
OneWire ourWire(48); //Se establece el pin 2 como bus OneWire
DallasTemperature sensors(&ourWire); //Se declara una variable u objeto para nuestro sensor
void setup() { delay(1000); Serial.begin(9600); sensors.begin(); //Se inicia el sensor }
void loop() { sensors.requestTemperatures(); //Se envía el comando para leer la temperatura float temp= sensors.getTempCByIndex(0); //Se obtiene la temperatura en ºC
Serial.print("Temperatura= "); Serial.print(temp); Serial.println(" C"); delay(100);
}
Errors or Incorrect Output
Without the modifications, the OneWire library does not recognize pin 48 as valid, causing the sensor to be undetected. The issue arises because the original library code only supports pins up to 36. After modification, the library should support higher pins, including pin 48, on the ESP32-S3.
Code Modifications
We modified the following lines in the OneWire_direct_gpio.h file to support pins higher than 36:
By making these modifications, the library can now work with pins higher than 36, including pin 48 on the ESP32-S3. This change should be reviewed and potentially integrated to support a wider range of pins in the ESP32-S3 series.