In today's digital era, IoT devices have become vital for connecting things to the internet, allowing users to control them remotely from anywhere. The primary advantage of using IoT devices lies in the ability to save time and access resources remotely. However, with the increasing use of IoT devices, there are growing challenges related to security and privacy. Key aspects of IoT security include authentication, confidentiality, and integrity, which are essential for a robust security mechanism.While current IoT protocols offer varying levels of security, it has become crucial to defend against different types of attacks like masquerade attacks, man-in-the-middle attacks, replay attacks, password guessing, impounder attacks, and Denial of Service (DoS) attacks. In this paper, we analyze the security of IoT devices and propose a smart solution. We employ a temperature sensor (DHT22) with NodeMCU to transmit data through the IoT protocol and receive it on a mobile device. We assess how data is securely transmitted from IoT devices to mobile devices, highlighting challenges faced during prototype development. Moreover, we emphasize the security level in transmitting data from IoT devices to the cloud and from the cloud to mobile devices, presenting a prototype capable of securely and seamlessly transmitting data to the cloud.