The usual recommendation is to use a 4k7 pull-up between data and VDD line for the DS18B20. On the other hand the AVR's have a pull-up integrated. It is less strong than 4k7 but it is strong enough for many applications (in my case 20cm distance from µC to Sensor, measurements shows good signal quality).
Here the instructions on how to use the internal AVR pull-up instead of an external one: It is related to the library and example posted here:
To use the library without external pull-up, you have to do the following change in OneWire.h:
Change the code for DIRECT_MODE_INPUT
#if defined(__AVR__) #define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin))) #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin)) #define IO_REG_TYPE uint8_t #define IO_REG_ASM asm("r30") #define DIRECT_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0) #define DIRECT_MODE_INPUT(base, mask) ((*((base)+1)) &= ~(mask))
#define DIRECT_MODE_INPUT(base, mask) ((*((base)+1)) &= ~(mask)); ((*((base)+2)) |= (mask))
This enables the pull-up again after each pin-direction change and the pull-up is always active.
Recompile the sketch and have fun....