I try to use a new DS18B20+ temperature sensor (sealed water proof version).
It doesn't work. My own code doesn't work, examples from DallasTemperature Library don't work, example from OneWire library doesn't work.
For example function
sensors.getDeviceCount(); (DallasTemperature library) returns '0'.
tempSensor.getTempCByIndex(0); returns 65409 (int variable).
!ds.search(addr) (OneWire library) also always return '0'. Then I am sure, Arduino code is alright.
I am sure DS18B20 is connected correctly:
- white wire (onewire data) - onewire Arduino pin (tested with pin 2 and pin 13)
- red wire (+V) - 5V Arduino pin
- black wire (GND) - GND Arduinp pin
- between 5V and DATA there is a 4k7 resistor
I have measured resistances between the temperature sensor's wires:
- '+V' to 'data': 4,7 kOhm
- 'GND' to 'data': ~3 Ohm
I think between the GND and DATA sensor wires resistance should be much higher - am I right? Below you can see a block diagram copied from the sensor datasheet (https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf):
Maybe black and white wires are +V and GND (which one is +V?), red is data? Or it's broken? Or something else?
I have bought it here - https://botland.com.pl/pl/czujniki-temperatury/10936-sonda-wodoodporna-z-czujnikiem-temperatury-ds18b20-5m-brazowy-silikon.html?search_query=sonda+temperatury&results=43 (language: polish). it is written:
- VCC - red
- GND - black or green
- data 1-wire - white or yellow