Smart House

by Orange Digital Center in Circuits > Electronics

39 Views, 0 Favorites, 0 Comments

Smart House

WhatsApp Image 2024-11-11 at 4.48.48 AM.jpeg

This project was developed within the Orange Digital Center Morocco , a space dedicated to fostering innovation, creativity, and rapid prototyping. At the FabLab, individuals and teams have access to state-of-the-art tools, including 3D printers, laser cutters, and a variety of electronic and mechanical resources. The center provides a collaborative environment where innovators, entrepreneurs, and students can transform their ideas into tangible products. By focusing on sustainable and impactful solutions .

The Smart Home project utilizes an ESP8266 microcontroller to create a system that allows users to remotely monitor and control various household functions. It integrates components such as a servo motor for automated tasks, a relay for fan control, RGB LED lighting for ambiance, and a DHT sensor for tracking temperature and humidity. The system is controlled using the Blynk platform, offering convenience and enhanced home management capabilities.


prepared by Yassmine ELHAMIM, Khadija HADDOU, Youness AMASSI.


Supplies

liste-of-materiales.jpg

The Smart Home project brings together a range of components :

  1. 1 x ESP8266 Wi-Fi module
  2. 1 x 3.7V power supply
  3. 1 x breadboard
  4. jumper wires for connections
  5. 1 x DHT11 sensor
  6. 1 x LCD 16x2 I2C display
  7. 1 x relay module
  8. 1 x servo motor
  9. 5 x RGB LED

Wiring

Screenshot 2024-11-12 172818.png
WhatsApp Image 2024-11-11 at 4.48.48 AM (1).jpeg
d5fa307c-f857-4235-a96f-9a9528c1b625.jpg
WhatsApp Image 2024-11-11 at 4.47.49 AM.jpeg

Now that we have an overview of the components, let's dive into how everything is connected to the ESP8266. Proper wiring is crucial for ensuring smooth communication between the microcontroller and all the devices, so here's a breakdown of the pin connections that bring this smart home system to life:

  1. (D4): Pin connected to the servo motor. The servo will move to different positions based on Blynk commands.
  2. (D8): Pin connected to the relay module, used for controlling a fan. It can turn the fan on or off based on the temperature or manual control from Blynk.
  3. (GPIO0 / D3): Pin connected to the DHT11 temperature and humidity sensor.
  4. RGB LED Pins:
  5. (D5): Pin connected to the red LED of the RGB LED.
  6. (D6): Pin connected to the green LED of the RGB LED.
  7. (D7): Pin connected to the blue LED of the RGB LED.
  8. the LCD is an I2C (Inter-Integrated Circuit) display, meaning it only needs two pins for data communication:
  9. SDA (Data Line): This connects to the D2 (GPIO4) pin on the ESP8266.
  10. SCL (Clock Line): This connects to the D1 (GPIO5) pin on the ESP8266.

Since the LCD uses an I2C backpack, it also has its own address (0x27 in this case) that allows communication over the I2C protocol.

These pins connect various components to the ESP8266 microcontroller and allow control through the Blynk app.

Programming

arduino_logo_1200x630-01.png
WhatsApp Image 2024-11-11 at 3.23.53 AM.jpeg

For the programming part, We used the Arduino IDE software. The program consists of the following parts :

Library Inclusion :

The program starts by including libraries necessary for the project :

  1. ESP8266WiFi.h and BlynkSimpleEsp8266.h for WiFi connectivity and Blynk integration.
  2. Servo.h for controlling the servo motor.
  3. Wire.h and LiquidCrystal_I2C.h for interfacing with the LCD display via I2C communication.
  4. DHT.h for managing the DHT11 temperature and humidity sensor.

WiFi and Blynk Setup:

The WiFi credentials and Blynk authentication tokens are defined to link the ESP8266 to the network and Blynk application. The connection is established in the setup() function, using the Blynk.begin() method.

Pin and Component Definitions:

  1. Servo Motor: Configured on pin D4. It is linked to a push button in the Blynk app for movement control.
  2. Fan: Connected via a relay on pin D8. It operates automatically when the temperature exceeds 25°C or can be manually controlled using an on/off button in the Blynk app. The fan status is influenced by the DHT11 sensor readings, and temperature and humidity values are displayed on an LCD.
  3. RGB LED: The RGB LED is connected to pins D5, D6, and D7 for red, green, and blue components, respectively. It can be turned on/off or buttons in the Blynk app for different color control.

Main Functions:

  1. setup(): Initializes WiFi, Blynk, the servo, relay, RGB LED pins, and sets up the DHT sensor and LCD display.
  2. loop(): Calls Blynk.run() to handle Blynk communication and readAndDisplaySensorData() to update sensor readings.
  3. readAndDisplaySensorData(): Reads temperature and humidity from the DHT sensor, displays data on the LCD, and controls the fan based on temperature conditions.

Blynk Control Functions:

  1. Servo Control (BLYNK_WRITE(V1) and BLYNK_WRITE(V3)): Allows movement of the servo using push buttons.
  2. Fan Control (BLYNK_WRITE(V0)): Provides manual fan control via a Blynk button, overriding automatic control if enabled.
  3. RGB LED Control (BLYNK_WRITE(V2, V4, V6)): Controls the red, green, and blue values of the RGB LED using Blynk inputs.

Now, as for the Blynk interface, it complements the code by providing an easy-to-use control panel. In the Blynk app, you’ll find five buttons that control various components of the system. Two buttons are dedicated to controlling the servo motor, which in turn controls the curtains. There are also on/off buttons for the fan and RGB LEDs, enabling you to interact with the system seamlessly and control everything directly from your smartphone.


Feel free to check out the code file, the code is ready for you to explore and adapt for your own smart home projects.

Linking Your Smart Home With Blynk: Setup and Configuration Steps

images.png
1.png
2.png
3.png
4.png
5.png
6.png
7.png
8.png
9.png
10.png
11.png
12.png
15.png
13.png
14.png
1731425742475.jpg
1731425742452.jpg
1731425742429.jpg
1731425742406.jpg
1731425742383.jpg
1731425742359.jpg
1731425742337.jpg
1731425742314.jpg
1731425742289.jpg
1731425742266.jpg
1731425742240.jpg

In this section, we'll walk you through the process of linking your smart home system with Blynk. The guide is divided into two main steps: first, we'll cover the configuration on your computer, followed by the setup on your smartphone. Screenshots are included throughout to help you visualize each step and ensure a smooth setup. Let's get started!


Configuring Blynk on Your Computer

Here, we'll guide you through setting up your Blynk account and configuring devices using the Blynk web interface. Follow these steps to prepare everything on your computer before moving to the smartphone setup.

  1. First, create an account and log in to the system through your computer.
  2. Navigate to the Developers Zone.
  3. Create a new model by setting up the name, material, and type of connection.
  4. A checklist will appear on the screen, showing the steps you need to complete.
  5. Start by creating a data stream and select "Epingle virtuelle."
  6. Fill in all the required information, then click "Create" and save it.
  7. After saving, the new data stream will be displayed.
  8. Next, add a new peripheral by simply providing a name for it.
  9. Then, click on "Dashboard Configuration" and select "Modify".
  10. Next, select the widgets you need for your project. Then, go to "More Settings" and add the data stream along with all the required information.
  11. Once all the steps are complete, you can view your control button from "Dispositifs".

Configuring Blynk on Your Smartphone

Once you've completed the setup on your computer, the next step is to configure Blynk on your smartphone. The mobile app lets you control and monitor your devices remotely. In this section, we'll walk you through downloading the app, linking it to your account, and setting up your device controls. Let’s get started!

  1. First, install the Blynk app on your phone and log in with the same account you created on your computer.
  2. Open the device you previously created on your computer.
  3. Tap the green icon to switch to the Developer Zone.
  4. Click the "+" button to add widgets (the same ones you created on your computer).
  5. Tap on the widget to enter its details.
  6. Select the data stream you created earlier.
  7. You can also personalize the widget by adding custom designs.
  8. Now, your button is ready to control your device/component.

Building the House

WhatsApp Image 2024-11-11 at 4.48.46 AM.jpeg
WhatsApp Image 2024-11-11 at 4.47.50 AM (1).jpeg
WhatsApp Image 2024-11-11 at 4.47.50 AM (2).jpeg

In this part of the project, we designed and constructed the house using wood. The design files were created and then the wooden pieces were cut using a laser cutter, ensuring precision and a smooth fit. Afterward, the pieces were glued together to form the structure. For the curtain, we 3D printed a tube that perfectly fits into our design, and used a piece of cloth to create the actual curtain. We’ll be sharing the design files for these parts as well.

ْْWe also crafted accessories to furnish our home. These included a table, a couch, and even a little car—each piece adding a unique and fun element to the setup.

Final Assembly and Project Completion

WhatsApp Image 2024-11-11 at 4.48.48 AM.jpeg
WhatsApp Image 2024-11-11 at 4.48.47 AM (1).jpeg
WhatsApp Image 2024-11-11 at 4.48.47 AM.jpeg
WhatsApp Image 2024-11-11 at 4.48.46 AM (1).jpeg

In this section, we bring all the elements of the project together. After assembling the house, integrating the smart components, and adding our custom-made accessories, we finalize the setup and ensure everything works smoothly. From the carefully crafted wooden pieces to the functional electronics, this is where the vision becomes a reality. Here are some images of the completed project.

Thank you for following along with this journey! We hope this project inspires you and provides useful insights for your own creations.

Discover the Final Outcome!

Smart Home Project: Remote Control & Automation with ESP8266!