In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Build a minimum system brush nodemcu firmware and dht11 temperature read and upload server esp8266 experiment is how, I believe many inexperienced people are helpless, for this reason this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
1. bill of materials
ESP8266-12E Module
ESP8266 Adapter Board
cp2102 module or ch404g module
tact switch
hole plate
HT7533A-1 3.3V Voltage Regulator Chip
3.7V lithium battery
DHT11 Temperature and humidity module
2. Weld ESP8266 adapter board and make test board
ESP8266 module is not particularly small, the actual use of it can be directly welded to the hole plate, but as repeated use, it is recommended to weld to the adapter plate. The main elements on the hole board have two rows of pins on the left and right respectively, leading out all io ports, two buttons, the left button presses the pull down low rest port to realize restart, the right button pulls down GPIO0 (the fifth pin on the right of the module) port, and the button needs to be pressed when brushing firmware. On the left there is a voltage regulator circuit consisting of an ht7533 voltage regulator tube and two 10uf capacitors. There is a pin row below for inserting the cp2102 usb to serial module.
3. Download nodemcu firmware and swipe into esp8266 module
nodemcu firmware has a lot of modules, all functions are compiled, it is possible that esp8266Flash space is not enough, so you need to compile the required functions according to the application needs, recommended to use online compilation services, and jquery ui, through the web check to select the required functions, fill in your mailbox, submit after waiting for the background generated will send an email to inform you, and in the mail attached to the download address. https://nodemcu-build.com/ 。The email will provide 2 versions of firmware, I choose the floating point version. Download Flash Download Tools from Le Xin's official website, the tool can be used to brush firmware, windows use, nodemcu documentation also mentioned other brush firmware tools, such as esptools, cross-platform, but I use ch440G module under linux mint and can not brush into success, and use Flash Download Tools under windows is successful, the reason is not detailed, can succeed. Select one of the Download Path Config options at the top, select nodemcu firmware location, and fill in "0x00000" in the address on the right. Others are as shown in the figure:
The method of brushing firmware is:
1. Click on the Star below to display Wait
2. First press the right button on the hole board (pull GPIO0 low), then press the left button (pull rest low), then release the left button, then release the right button. This will enter firmware brushing mode.
3. If there is no accident, the software will display the download progress bar, and so on 100% complete, press the left button to restart esp8266 module.
4. After the first firmware reboot, the module needs to format flash, which takes one minute, so after the first firmware reboot, it needs to wait. If you connect to a serial port (bit rate 115200) using putty or minicom, you should see text being formatted.
The pit encountered.
I bought the usb serial module model is cp2102, win10 can not download firmware, and its 3.3v voltage port, measured voltage as high as 3.9V. Since it was not available, it was changed to a CH404G module.
4. Write code to read dht11 temperature
Use the tool ESPlorer, cross-platform, to provide code writing upload and serial port function, divided into two interfaces, left to write code, finished by the button below sent to ESP8266, and then the right serial window can see the data.
agreed
The data pin of dht11 is connected to GPIO12 port, the sixth on the left.
server side
On the server side, I use python+django to deploy on Baidu's bae to simply receive http post requests, verify data and store them.
messaging logical
The server stores two pieces of information about the sensor: the mac address and the encryption password. The esp8266 module sends five parameters to the server via an http post request:
humi: humidity, unit integer.
mac: MAC address of the module.
rnd: random number.
temp: Temperature, unit integer.
sign: post data sorted alphabetically by the above four parameters, hmac-sha1 encrypted using the password stored in the server. This effectively prevents fake data, but there is a small drawback, that is, there is no timestamp in it, which will lead to playback.
Strange, markdown code has been typeset badly, I can't get the code here: code
prompt
DHT11 accuracy is not very good, accuracy is 1 degree Celsius, I have 2 modules, a separate Taobao purchase, a piece of development board above, the same code 2 modules reading difference of 3 degrees, humidity difference is more.
5. Lithium battery powered on, power problem
I also master the contents of the power supply part is not good enough, this time using the HT7533A-1 voltage module, its package like a transistor is better inserted in the hole board for welding, according to the basic circuit in both ends plus 10uf capacitance, connected to lithium batteries, measured output voltage is 3.29V, normal. ESP8266 module inserted into the hole board, found that the module led rapid flashing, the module can not operate normally, guess is constantly restarting, as for the reason, I guess the peripheral circuit is wrong, such as which pins are not connected to the resistor pull-up or pull-down, or insufficient voltage current. By measuring the module voltage after power-on, it is found that the voltage drops to 2.7V, and the current of the whole circuit is 170mA. So pull out the lithium battery, use the external 3.3V direct access module, the module is normal, and the current is about 70mA. Then the preliminary judgment is the power supply problem of the voltage regulator module. There is a 662k voltage regulator chip in the hand, but the package is too small, it is not easy to solder on the hole board, and there is an AMS1117 -3.3V module, but the voltage difference required is about 1V, and a single lithium battery cannot be used. In the end, there is no good way to directly supply lithium battery power. The module manual says that the maximum input voltage does not exceed 3.6V. The measured lithium battery voltage is 3.9V and does not burn out.
6. continuous testing
The last use is the nominal 1000mA lithium battery direct power supply, it can be seen from the code that the timer is not set to perform a task in 3 minutes, no sleep mode is set, wifi is estimated to be continuously connected, and the current 24 hours have passed.
After reading the above content, do you know how to build a minimum system to brush nodemcu firmware and dht11 temperature reading and upload esp8266 experiment to the server? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.