# **Keyestudio IoT Smart Home Kit for ESP32** ![image1](media/A1.jpeg) # 1. Description As the rapid development of the Internet grows, various intelligent devices are gradually integrated into our daily life. For example, we can use RFID to open the door. In addition, the kitchen is equipped with a gas detection alarm, which alerts people to the danger when dangerous gas and large smoke are detected. When it detects rain, it can automatically collect clothes and close windows. All kinds of electrical equipment can be controlled by mobile phone, control lights, fans, air conditioning and so on. In this connection, we seek to launch this smart home product with ESP32 control, which has a host of sensors and modules as well as networking function, making the relevant knowledge of the Internet more accessible to you. # 2. Features 1. Elegant appearance 1. A host of sensor modules 1. Mobile phone APP network control 1. Morse password door 1. It can automatically close windows 1. RFID function 1. C language and MicroPython # 3. Kit list | # | Picture | Name | QTY | | --- | --- | --- | --- | | 1 | ![image2](media/Wooden-Board.jpeg) | Wooden Board | 1 | | 2 | ![image3](media/Acrylic-Board.jpeg) | Acrylic Board | 1 | | 3 | ![image4](media/ESP32-Board.jpeg) | ESP32 PLUS Development Board | 1 | | 4 | ![image5](media/6812-RGB.png) | 6812 RGB Module | 1 | | 5 | ![image6](media/Gas-Sensor.png) | Analog Gas Sensor | 1 | | 6 | ![image7](media/Button-Module.png) | Button Module | 2 | | 7 | ![image8](media/RFID-Module.png) | RFID Module | 1 | | 8 | ![image9](media/Buzzer-Module.png) | Passive Buzzer Module | 1 | | 9 | ![image10](media/Motor.png) | 130 Motor | 1 | | 10 | ![image11](media/Steam-Sensor.png) | Steam Sensor | 1 | | 11 | ![image12](media/XHT11.png) | XHT11 Temperature and Humidity Sensor | 1 | | 12 | ![image13](media/PIR-Sensor.png) | PIR Motion Sensor | 1 | | 13 | ![image14](media/LED-Module.png) | Yellow LED Module | 1 | | 14 | ![image15](media/Servo.png) | Servo | 2 | | 15 | ![image16](media/I2C1602-LCD.png) | I2C1602 LCD Module | 1 | | 16 | ![image17](media/3P-150-mm-Wire.png) | 3P F-F 150 mm Dupont Wire | 5 | | 17 | ![image18](media/3P-200-mm-Wire.png) | 3P F-F 200 mm Dupont Wire | 4 | | 18 | ![image19](media/F-F-200-mm.png) | F-F 200 mm /40P/2.54 Wires | 0.1 (4 strands) | | 19 | ![image20](media/4P-200-mm-Wire.png) | 4P F-F 200 mm Splicing Dupont Wire | 2 | | 20 | ![image21](media/M1.4-6MM-Screws.png) | M1.4*6MM Round Head Screws | 4 | | 21 | ![img](media/wps1.jpg) | M1.2*4MM Round Head Screws | 4 | | 22 | ![image22](media/M3-Nickle-plated.png) | M3 Nickle-plated Nut(self-locking) | 5 | | 23 | ![image23](media/M4-8MM-Screws.png) | M4*8MM Round Head Screws | 24 | | 24 | ![image24](media/M3-6MM-Screws.png) | M3*6MM Round Head Screws | 9 | | 25 | ![image25](media/M3-6MM-Screws.png) | M3*10MM Round Head Screws | 5 | | 26 | ![image26](media/M3-6MM-Screws.png) | M2*12MM Round Head Screws | 5 | | 27 | ![image27](media/M4-Nut.png) | M4 Nickle-plated Nut | 24 | | 28 | ![image28](media/M4-Nut.png) | M3 Nickle-plated Nut | 7 | | 29 | ![image29](media/M4-Nut.png) | M2 Nickle-plated Nut | 6 | | 30 | ![image30](media/M3-8MM.png) | M3*8MM Flat Head Screws | 3 | | 31 | ![image31](media/Cross-Wrench.jpeg) | Cross Wrench | 1 | | 32 | ![image32](media/3.0-40MM-Screwdriver.png) | 3.0*40MM Screwdriver | 1 | | 33 | ![image33](media/2.0-40MM-Screwdriver.png) | 2.0*40MM Screwdriver | 1 | | 34 | ![image34](media/M3-10MM.png) | M3*10MM Dual-pass Copper Pillar | 4 | | 35 | ![image35](media/USB-Cable.png) | USB Cable | 1 | | 36 | ![image36](media/AA-Battery-Holder.png) | 6-Slot AA Battery Holder | 1 | | 37 | ![image37](media/M3-6MM-Screws.png) | M3*12MM Round Head Screws | 4 | | 38 | ![image38](media/White-Card.png) | White Card | 1 | | 39 | ![image39](media/ABS-RFID-Key.png) | ABS RFID Key | 1 | # 4. How to install the smart home **Step1** Components Required ![image40](media/A01.png) Installation Diagram ![image41](media/A02.png) Prototype ![image42](media/A03.png) **Step 2** Components Required ![image43](media/A04.png) Installation Diagram ![image44](media/A05.png) Prototype ![image45](media/A06.png) **Step 3** Components Required ![image46](media/A07.png) Installation ![image47](media/A08.png) Prototype ![image48](media/A09.png) **Step 4** Components Required ![image49](media/A10.png) Installation Diagram ![image50](media/A11.png) Prototype ![image51](media/A12.png) **Step 5** Components Required ![image52](media/A13.png) Installation Diagram ![image53](media/A14.png) Prototype ![image54](media/A15.png) **Step 6** Components Required ![image55](media/A16.png) Installation(Don’t tighten the self-locking nuts) ![image56](media/A17.png) Prototype ![image57](media/A18.png) **Step 7** Components Required ![image58](media/A19.png) ⚠️ **Special note:** Adjust servo of the window to 0 degree before installation | Servo | PCB | | --- | --- | | Brown line | G | | Red line | 5V | | Orange line | GPIO5 | ⚠️ **Especially Remind:** The following two methods can be chosen freely according to your own situation. **Method 1:Arduino code** ⚠️ **Special note:** Before you write the code and upload it, you must install the Arduino IDE, please go to the link: `5. Arduino Tutorial `__\ ,and then to see the part of **5.2 Getting started with Arduino** . How to get the code ? In folder **..\\Resource compression package\\arduino Code** , open file **Initialization-of-window-servo-angle.ino** , or copy and paste the following test code into the Arduino IDE. ![Img](./media/A20.png) ```c #include Servo myservo; #define servoPin 5 void setup() { myservo.attach(servoPin,500,2500); myservo.write(0); delay(300); myservo.write(90); delay(300); myservo.write(0); delay(300); } void loop() { // put your main code here, to run repeatedly: } ``` **Method 2:MicroPython code** ⚠️ **Special note:** Before you write the code and upload it, you must install the MicroPython IDE, please go to the link: `6. Python tutorial `__, and then to see the part of **6.2 get starter with Thonny** . How to get the code? In folder **..\\Resource compression package\\MicroPython Code** , open file **Initialization-of-window-servo-angle.py** , or copy and paste the following test code into the Thonny IDE. ![image59](./media/A21.png) ```python from machine import Pin, PWM import time pwm = PWM(Pin(5)) pwm.freq(50) ''' The duty cycle corresponding to the angle 0°----2.5%----25 45°----5%----51.2 90°----7.5%----77 135°----10%----102.4 180°----12.5%----128 ''' angle_0 = 25 angle_90 = 77 angle_180 = 128 pwm.duty(angle_0) time.sleep(1) pwm.duty(angle_90) time.sleep(1) pwm.duty(angle_0) time.sleep(1) # while True: ``` After adjusting the angle of the window servo to 0°, proceed to install as shown in the following picture) ![image60](media/wps1-1.jpg) Install M1.4*6MM self-tapping screws as shown below ![image61](media/wps2.jpg) Prototype ![image62](media/A22.png) **Step 8** Components Required ![image63](media/A23.png) Installation Diagram ![image64](media/A24.png) Prototype ![image65](media/A25.png) **Step 9** Components Required ![image66](media/A26.png) Installation Diagram ![image67](media/A27.png) Prototype ![image68](media/A28.png) **Step 10** Components Required ![image69](media/A29.png) Installation Diagram ![image70](media/A30.png) Prototype ![image71](media/A31.png) **Step 11** Components Required ![image72](media/A32.png) Installation Diagram ![image73](media/A33.png) Prototype ![image74](media/A34.png) **Step 12** Components Required ![image75](media/A35.png) Installation Diagram ![image76](media/A36.png) Prototype ![image77](media/A37.png) **Step 13** Components Required ![image78](media/A38.png) Installation Diagram ![image79](media/A39.png) Prototype ![image80](media/A40.png) **Step 14** Components Required ![image81](media/A41.png) Installation Diagram ![image82](media/A43.png) Prototype ![image83](media/A44.png) **Step 15** Components Required ![image84](media/A45.png) Installation Diagram ![image85](media/A46.png) Prototype ![image86](media/A47.png) **Step 16** Components Required ![image87](media/A48.png) Installation Diagram ![image88](media/A49.png) Prototype ![image89](media/A50.png) **Step 17** Components Required ![image90](media/A51.png) Installation Diagram ![image91](media/A52.png) Prototype ![image92](media/A53.png) **Step 18** Components Required ![image93](media/A54.png) Installation Diagram ![image94](media/A55.png) Prototype ![image95](media/A56.png) **Step 19** Components Required ![image96](media/A57.png) Installation Diagram ![image97](media/A58.png) Prototype ![image98](media/A59.png) **Wiring Part** temperature and humidity to io17 3P connection line using short: 15cm ![image99](./media/A60-1.png) ![image100](media/A60.png) yellow led module to io12 ![image101](./media/A61-1.png) ![image102](media/A61.png) steam sensor to the io34 3P connection line using short: 15cm ![image103](./media/A62-1.png) ![image104](media/A62.png) fan (IN- to io18,IN+ to io19) Dupont wires used: 4 dupont wires spread out ![image105](./media/A63-1.png) ![image106](media/A63.png) PIR motion sensor to the io14 3P connection line using short: 15cm ![image107](./media/A64-1.png) ![image108](media/A64.png) left button module to the io16 3P connection line using long wire: 20cm ![image109](./media/A65-1.png) ![image110](media/A65.png) right button module to the io27 3P connection line using long wire: 20cm ![image111](./media/A66-1.png) ![image112](media/A66.png) RFID module to the IIC The 4P merged line ![image113](./media/A67-1.png) ![image114](media/A67.png) LCD1602 display to the IIC The 4P merged line ![image115](./media/A68-1.png) ![image116](media/A68.png) 6812RGB LED to the io26 3P connection line using short: 15cm ![image117](./media/A69-1.png) ![image118](media/A69.png) gas sensor to the io23 3P connection line using long wire: 20cm ![image119](./media/A70-1.png) ![image120](media/A70.png) buzzer sensor to the io25 3P connection line using long wire: 20cm ![image121](./media/A71-1.png) ![image122](media/A71.png) servo controlling windows to io5 ![image123](./media/A72-1.png) ![image124](media/A72.png) servo controlling doors to the io13 ![image125](./media/A73-1.png) ![image126](media/A73.png) power wiring ![image127](media/A74.jpeg) **Step 20** Components Required ![image128](media/A75.png) Installation Diagram ![image129](media/A76.png) Prototype ![image130](media/A77.png)