Wanted to log the temperature with the LoRa gateway pi, but had to use another gpio since gpio4 was already in use for the Dragino LoRa/GPS Hat.
Just solder the DS18B20 sensor as in the image (the blue resistor is a 4k7 ohm pullup between data and +3v3).
And then add the following to /boot/config.txt
dtoverlay=w1-gpio,gpiopin=22
Reboot and you will find the sensor in /sys/bus/w1/devices/.