This project is a simple IoT development board. The development board is equipped with an ESP8266-12F WiFi module. Using a mobile phone to connect to the Alibaba Cloud IoT Life Platform, remote control of sockets, lights and other functions can be realized. The development board also integrates a 0.96-inch OLED display and is equipped with a temperature and humidity sensor, which can transmit data to the Alibaba Cloud platform to realize data statistics and monitoring functions. OLED screens can also see data in real time.
1. Realize two sets of 220V switches
2. Connect a temperature and humidity sensor to collect the indoor temperature
3. Equipped with a 0.96-inch OLED, which can display temperature, humidity and switch status in real time
4. Connect to Alibaba Cloud IoT platform to realize intelligent remote control switches and statistical temperature and humidity data
Directly use esp8266 as the main control, without adding an additional main control such as stc or stm, saving costs. The most important thing is that I have used ESP8266 before. I can write programs directly using Essence SDK and can also connect to Alibaba Cloud, so I decided on this
Use 1117 to convert the USB input 5V voltage to 3.3V. The output 3.3V is very stable with very small deviation, so I chose this voltage regulator chip.
The CH340E is too small. I used it once and soldered it to the point where I doubted my life, so I chose the CH340C. These two functions are completely sufficient for the esp8266.
Easy to use
Increase the load capacity, drive the relay to close, and add an inverter in front
The HK4100F-DC5V-SDG, 5V relay is used, which can meet the requirements.
Two buttons are designed, which are also necessary. One is the reset button RES, and the other is the download button BOOT. When downloading, you must first press and hold the BOOT button, then press the reset button RES, and then release it. Two buttons can download programs.
1. Use ESP-12F to connect directly to Alibaba Cloud without the need for other controllers.
2. In the design and development stage, it is still necessary to add a CH340 for programming and debugging.
3. Add a temperature and humidity sensor to monitor indoor temperature and humidity.
4. Add an OLED screen (you can also put other ones), so you don’t have to take out your mobile phone to watch it at home. You can just watch the OLED screen directly, which is convenient.
5. Two relays are designed, one can control the plug and the other the light.
First of all, my device placement has an overlapping part of OLED and ESP-12F, one at the top and one at the bottom. You can’t see the WIFI module when looking from above, but you can see it when looking sideways (I don’t know if it will affect the board when it comes). (Please give it a try), this part saves a lot of space and makes the board smaller (condensation is the essence hahaha, I still like the wiring to be more compact).
Then the antenna part of the ESP-12F module needs to be cleared. Although this clearing is a bit small, I have tested it and found that there is no problem with a gadget I made before, so this is fine.
For the USB power supply access part, of course capacitor filtering is required when entering each module. One of them was not drawn well at the time, so Zhou Gong reminded me, thank you (laughter... but I had already placed an order with Jialichuang at that time) ), it’s just a small problem, I’ll pay attention to it in the future
As for the DHT11 temperature and humidity meter, it may not have been designed well at the time. If it is installed in a shell, the heat inside will definitely be affected, but put it next to it and make a hole in the shell (I drew a shell, it was the first time for a novice to draw it, and I will attach it later). It seems that DHT11 is too high and difficult to handle. I am still thinking of putting it in. I don’t know how to do it. Please give me your opinion in the comment area and learn from the boss’s handling method.
Regarding the 220V part of the relay, I have never drawn a board that connects to the mains before. 220V is a bit confusing for me, so I still listened to Lichuang's class and learned from Song Gong that it should also be cleared and not covered with copper.
1. The relay uses 5V, but it was 3.3V when the circuit was designed. This would cause the relay to fail to close, so I changed it to 5V. During the wiring, I connected 3.3V and modified it. (2020-8-10)
2. The filter capacitor of CH340C in PCB wiring is not placed properly. Replace it and there should be no problem. (2020-8-11)
3. When I finally connected 220V, I burned out an inverter maybe because I connected it too frequently or for other reasons. I thought at first that the relay circuit was completely exhausted. I measured the voltage with a multimeter and found that it seemed like The inverter burned out, so I replaced it and it was fine. As expected of me, hahaha. (2020-8-14)
1. ESP8266 is not in the official certification of Alibaba Cloud IoT platform, and it is quite troublesome to connect it (when I didn’t understand anything at first). I searched for information and videos for a long time, and finally I was able to connect it. I would like to thank <Chaowei Electronics> and <Jixin Team> for their videos on station B. Many of the codes were transplanted from them.
Chaowei Electronics B station video link: https://www.bilibili.com/video/BV1nE41117ah (It seems that there is no B station account)
**Jixin B station video link:**** https://www.bilibili.com/video/BV134411w7wq **
The steps for esp8266 to connect to Alibaba Cloud can be found here with details (this is the document of Lichuang’s advanced training class, please borrow it if you are doing it): https://www.yuque.com/iiyqfa/ssdag4/oyhtag
One thing that is different is that for this networking method, do not choose WIFI, but choose cellular (2G/3G/4G/5G), so that you can skip the WIFI networking step and scan the QR code to connect to the device directly, otherwise the device will not be found. Because our ESP8266 is not a module certified by Alibaba Cloud.
(!!!!!! Project source code is attached!!!!!!)
2. A small problem I encountered when debugging the program. My development board is integrated with a temperature and humidity meter, and there will be data. However, I followed the steps to control the switch first. There is no problem with closing and opening the switch. , but I didn’t know how to transfer data to the cloud at the time. Finally, I studied the physical model written by Alibaba Cloud in JSON for a long time, and combined with what was said in the Chaowei Electronics video, I gradually understood it, and finally the data was successfully uploaded to the cloud. (The mobile page is a bit ugly and needs to be improved). The final result data is uploaded, and Alibaba Cloud also has charts and records.
Mobile page (to be improved)
After improvement (please don’t complain, boss)
3. During debugging, I encountered the problem that the relay can be closed but cannot be disconnected. I didn't make a board at home at that time, so I built a circuit on site and found that it could be connected but not disconnected. Since I simply used IO to drive the relay directly, when I tried it with LED, the LED turned on and off normally, but There was a problem when the relay was replaced. When designing, I listened to Lichuang's lecture and found out that a MOS tube driver was added to the relay driver, which is specifically designed to drive the relay. A reverser was also added. I will try the results when the board arrives. When I was debugging at home, I added a transistor to increase the driving force, and it was successful.
Debugged at home (the temperature and humidity were written backwards, but it does not affect it and has been corrected)
(Still waiting for the board to arrive)
1. The problem is that when soldering the board, the most difficult thing to solder on this board is the micro USB, so it is soldered first. It took ten minutes to solder it, and a piece of the board was wasted in the middle. It was soldered the second fastest. .
2. The method is to solder off the most difficult part first. Generally speaking, we will say to solder from low to high first. Relatively speaking, the higher ones are easier to solder, but some larger ones are not easy to solder, such as the USB interface. I think you need to solder this first. It is larger than the capacitor and resistor, but it is really difficult to solder. It is better to solder it first. If you have soldered everything else and then solder the USB, you may not be able to solder it in one go. Solder it well (the master bypasses it). It is really not easy for beginners to solder it well. Anyway, I have soldered USB several times and it is quite difficult. If you don’t solder it well, you may have to re-solder it. If you go back and forth, the pad may be damaged by you. If it breaks (I broke a board) and the pad is broken, then the soldering you did before will be wasted. Then according to my order, I will solder the power supply, some filter capacitors and CH340 first. I am not sure that what I solder will be useful. I will solder it first and plug it into the computer to see if the computer can recognize the ch340. If it can, Everyone is happy, it seems successful, and then weld other things. Don't just adjust it all at once after soldering. If you find a problem in the end, the entire board may be ruined. You need to adjust it part by part (that's what I do anyway, it's just a suggestion, it depends on your habits).
After soldering the board, start the burning process, as follows (do not imitate, it is purely funny):
! ! ! ! ! ! ! ! ! ! ! ! ! Don't imitate, don't imitate! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! You can use it after burning it, hehe. I have almost adjusted the program before, so I can achieve basic functions by burning it in! ! ! Hohohohohohoho<<<<<
After burning the program, you can open the serial port debugging assistant, select 74880 for the baud rate, select the corresponding port number, click to open the serial port, and then press the reset button on the board to see the information. Of course, you need to configure the network first.
After the network is successfully configured, the board will automatically reset and then connect to the Alibaba Cloud IoT platform (provided that your triplet is correct, the following will briefly teach you how to modify the triplet), and the following information will be displayed: There is an IP address of 8266, and Alibaba Cloud The IP of the Internet of Things platform, and the triplet corresponding to the device will be printed out (in this way, you will be connected successfully and can go to the cloud)
! ! ! Most of the programs are transplanted from Chaowei Electronics and Jixin Classroom! ! ! ! !
The program can also be improved. For example, I have not used the small lights, and the triplet serial port can be directly modified to send the triplet to the main control, and some printing information can be output on the OLED. (Continuously improving, the perfect program will be uploaded simultaneously)
Just give me a few pictures and submit it as a file. There’s nothing to say, and I can’t say it. Anyway, it’s just not a good design. That DHT11 is too high. If you have any ideas, can you tell me hehe?
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet