Hello, I'm making a project, which is a DS18B20 temperature sensor, and I'm also calibrating the salinity sensor of the salinity sensor, but when I want to read it, the temperature sensor initially outputs normal output, for example 29C, depending on the temperature. but sometimes it also reads -127 C, which should not be like that, what's the problem with the sensor? What should I do
Welcome to the forum
Start by posting your full sketch, using code tags when you do, and a schematic of your project. A 'photo of a hand drawn circuit showing all components, how they are connected and powered is good enough
To post images etc. you need trust level 1, you can get there by:
- Entering at least 5 topics
- Reading at least 30 posts
- Spend a total of 10 minutes reading posts
Are you placing the DS18B20 into the salt water?
The value -127 is returned by the library. It indicates an error communicating with the sensor.
If you search the library code for -127 you can see exactly under which conditions the value is returned.
The root cause is often (1) bad wires / contact, bad (no) soldering or no pull up resistor.
Sensor is probably fine. If it reads temperature -127 C sometimes, it can be problem with the connection or with the program.
However, DS18B20 from Chinese internet shops can be counterfeit and not reliable, reportedly. I do not have direct experience.
And also, I hope you are using sensor in some sleeve or so, resistant to aggressive environment.
That's nearly always a wiring problem.
Note that "waterproof" is only true for Chinese water.
Once other (salt) water gets in (and it does), the sensor is toast.