Please do an auto-format your code and paste it into your reply with code tags. If you do not understand this, do not post your code incorrectly, ask for further help.
if you get valid values most of the time and values -127 only from time to time the reason might be a wiring that rounds the signal too much.
Onewire-busses should be ideally on line with small stubs to the sensors. Even with such a topology the signal can be rounded too much.
In these cases a lower pull-up-resistor in the range of 2 kOhms will help.
So how does your wiring look like? Length of the wires? line-topology or star-topology?
Precautions with Star Topologies
Testing has shown that unswitched star-type network topologies
(i.e., those with several branches
diverging at the master) are the most difficult to make
reliable.
The junction of various branches presents highly mismatched
impedances;
reflections from the end of one branch can travel distances
equal to nearly the weight of the network
(rather than the radius) and cause data errors.
For this reason, the unswitched star topology is not
recommended, and no guarantees can be made about its
performance.
so first of all, it is always a star line. And the master is always the focus or star. The point here is to what extent impedances appear over the different cable lengths.
Good shouldn't be the topic because I wrote that my sensors are straight with a length of 50cm.
I will then reveal my entire source code and then see how far others can work in to understand what is going on.
Hi,
Thanks for your code.
I can see you ae doing a lot, possibly trying to make a generic DS18B20 system, that adapts to different numbers of devices.
But, the fact that other codes do the same thing,
Can you please post your SIMPLE code that reads and outputs and posts to Serial.print.
If all cable lengths are star, when a request to a specific sensor goes out over all star wires.
While the senor is responding, the master receives that signal as well as the reflected request from the end of the other cables.
The fact that they are all of equal length or not is not the problem.
That is the way I see it.(But correct me if anyone sees a fault in the logic.)
Have you looked at this link, where it has a code for ESP32 and multiple DS18B20.
So I tested the same structure / wiring with the sketch from one of your links. In fact, all sensors work even if the waiting time is not set to 5 seconds.
Still, I don't understand where the problem lies.
I use the same methods to read the sensors.
I have the feeling that the microcontroller cannot handle it. Which I can't imagine, because the program itself is still small, without MQTT, web server etc.
ok then i don't understand. Then please tell me what a OneWireBus should look like. A different wiring as I have built it is not possible for my understanding.
Yes, the NErd program works.
Again to the value. No temperature changes. There are no mistakes. If I take the sensor in my hand, so that the values change, the error value comes to -127.
yes moment. The OneWireBus only works as a star wiring.
The picture below is a parallel connection.
I just have no explanation as to why the program doesn't work that way.
As I said, if there is a change on the sensor, the error value -127 appears shortly afterwards.