Can I supply power to a DS18B20 temperature sensor from one of the Arduino 's pins?
So that with code I 'll be able to switch it on only during measurement (to lower power consumption).
(I have connected the sensor 's VCC to pin 5 of Arduino)
Yes probably, but there absolutely no point, the standby current is 0.75µA
I 'll power it from the main power rail.
It only consums high power during measurement?
And then falls to 0.75µA by itself?
I don't have to do anything?
Nope. When 1-wire transaction is complete device automatically goes to sleep state till next transaction.