I'm building simple digital thermometer based on common Dallas DS18B20 sensor with parasitic power. I want to put it outdoors, it can became very cold in my location (about -25 C) and very hot (about +45 C). Is it safe to just solder two wires and throw sensor outdoors? Will it survive or I need some case for it and\or some special wire?
I've got one outside, hanging out of the window (via a CD rom audio cable to plug it into) but I encapsulated it in a white diffused plastic 135 film canister, with self-amalgamating tape to cover the slot I cut in the lid to get the cable through. It needs a certain amount of weatherproofing, but the position mine is in can get sun shining on it (on those odd days) and that gives rise to over-reading.
I previously used an older version of the DS1820 outdoors, and found that it absorbed moisture and lost its accuracy over time. To get around this problem, I took a small piece of plastic tubing from a hardware store, just large enough to hold the sensor (with the wires coming out one side) and epoxied the sensor inside. I have had this outside for several years now and it is still accurate. The disadvantage is that it takes a bit longer to respond to temperature changes. Supposedly the newer versions of the DS1820 are not as sensitive to moisture, but I think protecting it is not a bad idea if it might get wet. I don't believe the temperature extremes you mention should require special consideration.
To avoid heating from Solar Radiation, you need to build what is known as a Stevenson Shield.
It is an enclosure that allows heated air to EXIT whatever container is protecting the sensor from the elements. See examples... you should be able to com up with a waterproof solution without too much trouble.
You're right — case in point. This morning my outside one was indicating -2°, which is true, everything was below freezing and frosty. Now the sun's out for a few minutes, and it is apparently +15.5° out according to that sensor, so probably no need for a coat! Except that everything is in fact still covered in frost.