-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
This is how all the components inside the electrical junction box are connected. Above you can see the classic electric circuit for this project.
I used a 3.3-5V board, 3.3V for the ESP8266-01 module and 5V for the sensors. Two small boards were installed using double-sided tape inside the electrical box. One for the power board, the other for other connections. I installed the power board opposite the rubber liner of electric box for easy connection of the power cable.We need to use a knife to make a small hole for the power cable. The size of the opening should not be large, but tight. You also need to repeat this procedure for the DS18B20 sensor cable.Now we can prepare the top cover of the electrical box to install the DHT22 sensor on it. I used a drill to make holes one for the screws and one for the wires.Before mounting the DHT22 to the electrical box cover, I soldered three wires (Data, +5V and GND).Do not forget about heat shrink. Now insert the soldered wires with heat shrink into the hole in the cover, fixing the DHT22 sensor with a screw, then fill this area (the hole with the sensor cable inside) with a hot glue gun. From this point, we go to the programming of the ESP8266-01 module.
We can use Arduino Uno to program ESP8266-01. (for me it was a good decision not to buy a programming module for the ESP8266-01)
Connect ESP8266-01 and Arduino Uno as shown in the picture above. Connect the Arduino board to the PC using a USB cable.Open the Arduino IDE (in my case I used PlatformIO with Visual Studio Code), go to Tools, select your ESP8266-01 board and the correct port that the Arduino board is connected to. More info on programming ESP8266-01 with Arduino Uno here.If you use PlatformIO just download code from this repo, if not this is code for ArduinoIDE. Upload your code to the ESP8266-01 board, if it's ok, press the S1 button on the schematic to reset. You can then disconnect the USB cable from the Arduino Uno, disconnect the ESP module and connect it to our sensors and power board inside the electrical box.
Check all connections (use standard Arduino mother-mother and father-father wires), use pull-up resistors (I used 2 x 5k) 2 x 4.7k, solder the wires to the DS18B20 sensor to make them longer. By default, the button of power board inside our device is on. You can add a on/off button for power cable from the AC/DC adapter. At the end of this stage, screw the cover to the electrical box. Your device is ready, now we need to establish the connection between the ESP8266-01 and the Arduino IoT platform.
Last edit by Oleksandr Lavrenchuk on August 14 2022.