Hi Rui or Sara,
Very pleased I am with all the very good written stuff in RNT. As a newbie I have feeling to be fast on the track.
I bought your course “Learn ESP32 with Arduino” and now busy to build this nice LoRa-sender – the last chapters about this LoRa. The version with just an ESP32 (DOIT) and an separate RFM95W I got already working.
But now like to use this ESP32 with LoRa aboard and also an OLED-display.
So I bought these two boards and the work quite well: banggood.com/2Pcs-Wemos-TTGO-LORA32-868915Mhz-ESP32-LoRa-OLED-0_96-Inch-Blue-Display-p-1239769.html
BUT…. that having been said… I want to use it for implementation of your Lora sender with the DS18B20 temperature sensor.
And as I can see this, we have a conflict for GPIO 15 that is used by the DS18B20 with a oneWire protocol and by the OLED (built in, so I cannot change this).
Here the OLED-pins from an example sketch:
#ifdef TTGO #define OLED_SDA 4 #define OLED_SCL 15 #define OLED_RST 16 #endif And from your sketch Lora Sender: // DS18B20 Data wire is connected to ESP32 GPIO15 #define ONE_WIRE_BUS 15
As I saw from other info one can connect more DS18B20’s at this pin and by using addresses each one can be selected for reading temperature.
Is there an alternative pin number to use for this oneWire transmission?
Thnx and kind regards,
Jop van der Werff
Thank you so much for your nice words.
I’m glad you’re enjoying and learning with our course.
Answering your question:
You don’t necessarily need to use GPIO 15 for the DS18B20 sensor. You can use any other pin for onewire protocol as long as that pin is not shared with the LoRa module of the board.
You can check the pinout for your board here: https://primalcortex.files.wordpress.com/2017/11/ttgolorapinout_v2.jpg
Accordingly to that pinout, I think that GPIO 13 can be a good fit – it is not shared with the LoRa module neither with the OLED display.
Let me know if that works out for you.
Thnx for your fast response and complete answer.
I am surprised by your answer that any GIO pin can be used: pleasant surprise as it makes life a lot easier.
But also a real “surprising” surprise as I really thought it should be 15 for some built-in functionality in the ESP32 (like the pins for I2C and for SPI).
The surprising is laid in this: I googled around and really, on internet every example implementing DS18B20 for the ESP32, is using this pin 15. So that made me coming to the conclusion “apparently it MUST be 15” for this oneWire protocol.
But if “everybody” is using 15 where it can be any other pin, can I come to the miserable conclusion that nobody is creative thinking in his own implementation and Is just copying his stuff from another author?
(don’t see my remark as not having confidence in your answer)
I will let you know if it works but I have to solve before another problem (see my coming answer to Rui in another question I posted).
Anyway, thnx a lot.
Yes, you can use any other pin for the sensor. But there are pins that you should avoid using. You can check this article about the ESP32 GPIOs: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
I’ve searched for the DS18B20 sensor on the internet, and I have no idea why everyone is using GPIO15.
GPIO 13 works just fine if you want to use that one.
Just to let you know: I changed GPIO 15 connection to GPIO13 and adapted the sketch.
This works fine.