Two temperature sensors on the nodemcu v3

Hi!

I was wondering if I can connect two DS18B20 sensors n the nodemcu CH340g v3 airrohr interface / software.

If so, how.

Many thanks! Arjan

It should be possible but you’ll need to modify the firmware:

What would be the purpose of this ? Do you want to display the values on the map then ?

One Wire is a wonderful bus. Every device has it’s own unique address. So technically it’s possible. But One Wire comes with some drawback - like very strict timings which in case of 1-threaded heavily loaded CPU might not be as easy to achieve without breaking other functionality.

In other hand having many DS18B20 in your setup might be very useful. Typical use case with two sensor: one for air temperature, and second one for soil. But One Wire is very sensitive for response timings so it would be wise to move protocol handling to additional IC like DS2482S-100+ (One-Wire - I²C bridge) and talk with sensors via I²C bus.

Hmmm… Why not to get data sequentally from sensors and then send it? Why do you want parallel functionality?

Single measurement takes up to 750ms - depending of set conversion resolution (between 12-bit and 9-bit, time may be reduced to 94ms for 9-bit). But One Wire requires very precise timings in communication. We are using software UART (for SDS011, CO2 sensor or GPS), software I²C for BME280 and LCD, WiFi communication and web server in “background”. All that on one fast thread. Right now firmware make one measurement and collect value. And often this value isn’t sent because of measurement error. Also it is a good practice to make interval measurements and return average value. Let’s say 1 measurement for 15-30 seconds. But since we can’t precise schedule other tasks, there is a huge probability that they will be colliding with precise timings required by DS18B20 or DHT22 even more. That’s why I think in future we should be using One-Wire to I²C bridge as a good solution for connecting 2 or more One-Wire devices. That also frees D8 pin and enables using SPI devices along with One-Wire.

Please also consider that many people are using Sensor.Community and Nettigo Air Monitor devices as Home Assistant outdoor sensors. In that situation - support for many DS18B20 sensors are added value for people with greenhouses, small gardens, etc.

You shall not wait all this time, after aquiring this measurement will hold in register.

If you will use some interface converters, all high level timings between coomands will be same.

Why do you need so precise timings for measure temperature?

I think better way to use some configurator such as tasmota/esphome only to resend data to HA, and then in HA resend data to luftdaten or other service.

There are indeed many possibilities for multiple temperature sensors on a single unit.
I did try already to upload the data to a Home Assistant InfluxDB but that didn’t work.
Anyone how to get this done?