Reading DS18B20 from AVR without 4k7 pull-up

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....

and how will this change affect the reading of a sensor when I use long wires?

This is a digital interface, that means if there are transmission errors you will get CRC errors. It does not impact the temperature accuracy.

The pull-up pulls the data-output of the Sensor back to high after it has been driven zero by the sensor data-pin. If the capacitor of the data-wire becomes larger more charge has to be delivered by the pull-up. That means a weak pullup needs more time to charge this capacitor.

In doubt connect an oscilloscope to the data pin and look at the quality of the rising edges.