If your project is going outside or is going to sit on a windowsill, then chances are you’ll need to take into account the harmful effects of the sun. The two largest problems presented by the sun are overheating and UV rays. And if your project is in the window, your problem is cut in half since UV doesn’t penetrate typical window glass!
The sun presents a major problem because of radiation. Since your project is composed of electronics, you’re stuck with a system that wants to heat up, and even more so if it is hit by direct sunlight. If possible, your best bet is to place your project in a shaded place, preferably with good airflow. This minimizes the radiation from the sun, and the good airflow will help convect the heat away. Even better would be an enclosure with a heat sink placed in at least a partially shaded spot. A metal riser between the hottest components on the board and the heatsink will work the best to keep your components cool.
If mounting in direct sunlight is a must, then make sure the enclosure is as light a color possible. Black will get hottest in the sun, while white will reflect the most radiation (although it will show dirt a bit sooner). Most outdoor conduit is gray for this reason. And try to avoid using a clear box or cover – you’ll get a solid temperature rise from the greenhouse effect.
Ultraviolet (UV) Degradation
Plastic breaks down because of the UV rays from the sun, so make sure any part of your project that is exposed to the sun is made of a UV rated material. Outdoor boxes normally have an additive to help resist the breakdown from UV rays. So something made of ASA will actually last longer than ABS. Certain cables also contain this additive for the same reason. Make sure to check both your case and cables or else the plastic will become brittle over time and crack.
When in doubt, plan for the worst. The extra cost of getting the right materials for the job will be worth it in the long run. Use a heatsink. Get ASA instead of ABS. Expect that even in partial sunlight, your project will get still get warm and need a heatsink. It is a lot easier to overcompensate for potential issues before they happen rather than after.