A system enabling X-ray diffraction patterns under controlled conditions of relative humidity and temperature has been devised and combined with an X-ray powder diffractometer. Relative humidity in the sample space is controlled by mixing dry N2 gas with saturated water vapor. Temperatures of the sample and inner wall of the sample chamber are monitored by two attached thermocouples and the information was fed back to the control unit. Relative humidity between 0% and the 95%, and temperature between room temperature and 60 °C can be controlled. All parameters including those for XRD are programmable and the system runs automatically. The function of the system was checked by recording the XRD patterns of montmorillonite (a clay mineral) and NaCl under increasing and decreasing relative humidity.