I'm having some issues with my ds18b20 sensors giving there values when being published to
My home mqtt server. It's coming in with -127 values which I don't understand why. I used
Some code I knew was working for the same kind of function except it too isn't working. I managed
to fetch the addresses from both ds18b20 sensors using the exact same wiring
I've attached my current code. The bme280 is publishing its values with no issue.
I also don't understand why the esp32 doesn't flash its on board led until it connects to the mqtt server.
Please if anybody could help and give any guidance or suggestions. main.cpp (4.1 KB)
Sorry I cannot see how you wired it, post an annotated schematic showing exactly how you have connected the hardware. Be sure to show all power sources and links to technical information on the hardware items.
No worries I really should have included that...
as far as regards to the technical side. the sensors all are capable of running on 3-5v.
The DS18B20s on fairly generic. they are the waterproof sensor/probes on the end of a cable.
The BME280 is the waveshare environmental sensor with the Jtag tail/cable. I think thats what
connector is called.
DS18B20(same sensor and where i bought it from.)
Waveshare BME280
Hope this helps. Let me know if there is any other info you need/want at all
I have used the DS18B20 with a ESP32 without problems - connected to pin23
sample results holding the sensor
Temperature is: 25.56 Requesting temperatures...DONE
Temperature is: 26.00 Requesting temperatures...DONE
Temperature is: 26.75 Requesting temperatures...DONE
Temperature is: 27.50 Requesting temperatures...DONE
Temperature is: 28.13 Requesting temperatures...DONE
Temperature is: 28.69 Requesting temperatures...DONE
Temperature is: 29.13 Requesting temperatures...DONE
Temperature is: 29.56 Requesting temperatures...DONE
Temperature is: 29.94 Requesting temperatures...DONE
Temperature is: 30.25
Edit: bit doubtful about pullup resistor to 5Volts - the ESP32 uses 3.3V logic
connect pullup to ESP32 3.3V
do the DS18B20 work OK by themselves?
This was the size I used for when I used the Arduino Mega which worked well.
Its not wireless and wanted to check temps of the body of water and environmental conditions in each room.
what size do you suggest for both the 3.3v and 5v?
It worked when getting the sensor addresses to make the getTemp by address section.
So thought all was good lol. I can test them again with an arduino. Just to find the usb cable
Really good to know. it had a 5v on the unit and had worked with the 5v on the DS18's.
Didnt think there would have been a problem otherwise.
I have a resister pack thankgoodness. will try something out. lol didnt want to cut up wiring but it will be safer.
The data sheet shows 4.7K for 5V but nothing for 3V3 so I guessed that the 4.7K gives about 1 mA a 3.3K would do about the same on a 3V3 system. It has worked many times for me without any problems.
An update. As weird as it may be. I gutted it out of my old project box. Re wired it to the same configuration but without the 4 pin outdoor connectors.
I did also make a change to the location of the 4.7k resistor. It's now sitting earlier in the one wire bus. So instead of being at the end.
It now looks to he connected from the positive than the resistor and before the first ds18b20.
This works excellently.
I'm also releived that actually. My code had been working and was more a physical issue. Regardless of the message I got before with the addresses. It must have been a fluke.