I have a problem with temperature sensors I have on a 0.5m cable and this cable is then connected to other sensors.
I need to connect up to 7 sensors (soil temperature measurement), but I always get:
0.00 | -127.00 | -127.00 | -127.00 | -127.00 | -127.00 | -127.00 |
If I plug in 3 sensors, only two and third throws the error -127.00. If I do this separately, it works.
There is nothing to suggest there is anything wrong with any of your sensors.
There is also nothing to suggest there is anything wrong with your code, so you can ignore reply #2.
The -127 is telling you that there is a lot wrong with your wiring, indeed most of the sensors are disconnected most of the time.
If you are using parasitic power, cease and desist immediately.
I assume this is just a test lashup and you will eventually use longer cable. I don't suppose there would be a problem with 500mm but note that you can't be a cheapskate with DS18B20 wiring. A popular approach is to use CAT5 cable for longer runs.
If you have multiple devices, connect them multidrop, not star configuration, if possible.
You must (for reliability) run the bus as a bus - you appear to have completely separate wiring harnesses
for ground, power and data - no, this is very bad for all sorts of reasons.
All three wires of the bus must run as a transmission line, not separated. So typically you'd use
either two twisted pairs (power/gnd and signal/gnd), or a twisted triple, or twin core shielded
with ground as shield, power and signal as cores. So two pairs from CAT5 or stereo audio screened
cable are feasible. With ribbon cable every other wire should be ground for best shielding.
Use a 4k7 pullup at each end of the bus. (Well it may be overkill but I've used this for 20 sensor string
successfully with years of 100% reliability).
Don't use parasite power unless you have to, then you can decouple each device with 100nF ceramic capacitor
which will really help provide solid behaviour. I've never even tried using these devices without
decoupling.