• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Multiple DS18B20 sensors on an ESP8266

Q&A Forum › Category: ESP8266 › Multiple DS18B20 sensors on an ESP8266
0 Vote Up Vote Down
Nigel Cooper asked 1 year ago

Hi Guys,
I have an application which requires multiple ESP8266 modules literally contained in a black box. Each module has two DS18B20 temperature sensors. Right now, the sensors are daisy chained to the same GPIO pin. I’m using the unique device serial number to identify each individual sensor, but this gives me a problem in that to know which sensor is reading what temp value, the sensors need to be hard wired. In the field it also means a sesnor can’t simply be replaced with another as the ESP8266 has to be programmed with the new sensor serial number.
In an ideal world, I’d like to have a bucket of ESP8266 modules and a bucket of DS18B20 sensors and with the appropriate connectors, I’d like to be able to connect any sensor to any ESP8266 and configure the temp location in the software. Is it possible to connect one sensor to one GPIO and another sensor to another GPIO – I’m stuck at how I would program “onewire.h” to address both GPIO’s.
Any thoughts welcomed.
Thanks.

4 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
Yes. You can wire each sensor to a different GPIO,
You just need to make sure you create two OneWire instances in your code with different names.
Do you understand what I mean? Or do you need further help? What code are you using?
Regards,
Sara

0 Vote Up Vote Down
Nigel Cooper answered 1 year ago

Thanks Sara, I’ll give that a try and let you know if I needf any further help.

0 Vote Up Vote Down
Nigel Cooper answered 1 year ago

Working! (other than I need a second pull-up resistor). Each sensor reads correctly when I switch the one pull-up resistor I have right now, between them. Thank you Sara

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Great.
I’m glad you made it work.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.