Internet of Things (IoT) shows no sign of slowing down, particularly in the field of mobile applications because many IoT devices can be controlled through an application on a smartphone. There is a clear intersection between the Internet of Things (IoT) and artificial intelligence (AI). IoT allows you to connect machines and use the data generated from these machines. Artificial intelligence is the simulation of intelligent behavior in different kinds of machines. Leading manufacturers like Samsung and Apple obviously participate in the rise of artificial intelligence. The implementation of artificial intelligence (AI) and Internet of Things within terminals with touch screen is spreading at lightning speed in smartphones. With the advantage of detecting objects in front of the camera of lowering energy consumption and better guaranteeing data security than the traditional approach in the cloud. In this paper, authors proposed and present a home automation system to connect artificial intelligence (AI) and internet of things (IoT) controlled with a smartphone. The IoT system proposed allow any user to manage his house on site or remotely to fight against any intrusion or other natural disasters (Wind, Erosion, etc ...) that can cause considerable damage. This solution based Raspberry Pi technology, consist to manage and monitor a home remotely without human intervention by automating the entire house.