In this system, the bedroom is able to mimic an environment that may assist the user to have a better sleep. The whole system is controlled by an loT based embedded device that is constantly monitoring the ambient environment as well as the user through a host of sensors (temperature, humidity, light, heart rate and motion). The readings from these sensors ore uploaded through the embedded device to the cloud for data-logging and remote monitoring purposes. The logged data con later be analyzed to create profile of one's sleeping behavior based on the optimum sleeping environment. Once the sleep profile 1s created, the system will be automatically adjusted to simulate the optimum sleeping environment just before the user is going to bed. In addition, this loT based system will alert deeply asleep user if any hazard (fire, gas leakage etc.) in the environment is defected. This system can be wirelessly controlled by a smartphone application, which also acts as a sleep diary.