当前位置:网站首页>51 single chip microcomputer temperature alarm based on WiFi control
51 single chip microcomputer temperature alarm based on WiFi control
2022-07-04 16:57:00 【Eat meat to solve a thousand worries】
Beginner's notes , There are inevitably many mistakes . Forget that you guys will not hesitate to give advice after finding mistakes
The author is not an electrical major , There is no knowledge support in many places , It is inevitable to make mistakes or explain ambiguities
Links to a full set of materials : Baidu SkyDrive
My applet source code : Click extract
1、 Function is introduced
- Expand the display to show the current temperature and threshold temperature .
- When the temperature exceeds the set threshold, the buzzer will alarm .
- Can pass wifi Use the mobile interface to adjust parameters .
Because there were several experiments before, the mobile phone could not be connected to the MCU , I thought wifi The function of can only change the level of hardware . But after experimental tests ,wifi The function of can directly put statements . So the logic is simple , direct if-else Dafa .
2、 Introduction to logical structure
adopt wifi The incoming characters change the existing program if else Dafa

3、 MCU pre knowledge
3.1 Why choose SCM
SCM can Collect data from reality And through the program to deal with . Make electronic devices more intelligent through program control . It is convenient for people's life .
3.2 What is single chip microcomputer .
- In my eyes, SCM is a microcomputer .
- It has some extended interfaces, such as : display 、 Temperature collector 、 bluetooth 、wifi etc. . These extenders give the single chip microcomputer more powerful functions .
- Strong electrical characteristics . Change the electrical characteristics of a certain position through the program to realize the function .
Roast can only be used C The ancient grammar of language .
3.3 How to use SCM
After the electrical details are encapsulated into a small black box, the program becomes a tone API Write C Language applet .
But if you don't understand the underlying electrical principle, you will overturn ~, For details, see the following “4.3 Show function “
- Software direction requires programming foundation (51 The language of MCU is C)
- Hardware direction requires understanding board principle .( The author said he couldn't understand ( I'm not going to understand ))
4、 The overall development process
Sensor and IO The communication of the mouth is very difficult to understand , This is also one of the ideas that cut me off from learning hardware ~~
But but but Communication can hardly be changed , That is to say, directly transfer what others have written API That's it
4.1 What is in the main function
- Capture the current temperature and display plus to judge whether to alarm
- Capture the interrupt and enter the edit threshold mode
4.2 Realize the capture temperature function
It uses DS18B20 Temperature sensor . Determine the calculation formula according to the hardware characteristics 、 Timing controls the process of temperature reading
4.3 Implement the display function
Used to display prompt information and input information .
use LCD1602 Liquid crystal display (LCD) . Only English can be displayed . Here, the screen is not cleared after the display, and the car overturns .
4.4 Implement the alarm function
if Judge , If the temperature is higher than the threshold, the buzzer will vibrate .
4.5 Realize the modification of threshold function
Pass in the parameter : Letter
- A: Enter editor
- B: Exit the editor
- C: Delete a bit
- D: decimal point
- similar ‘1’: Numbers
Realization way : Array sentry
Show function after each call
4.6 Realization wifi The incoming data enters the modified threshold function
At first, the store sent me wifi Something is wrong with the module , For a day , After the communication failed, he gave a well grounded negative comment , The store owner reissued a good module :happy:.
if - else Call the modify threshold function . The point is wifi Communication for . The use of wifi The module is ESP8266-WIFI.
Communication needs to be guaranteed wifi The baud rate is the same as that of MCU .
Function by sending AT+CIPSEND=0,7 Instructions , Set the sending data length , Then send the data To WIFI modular .
commonly APP The format of the sent data is :+IPD,ID Number , Send data length : data .
When the mobile phone is successfully connected to the hotspot , among +IPD,ID The number is fixed , Users can send How much data , Then the length can be determined . In this way, the serial port receiving interrupt can follow this format To analyze , Our main concern is “ data ” That piece of .
For example, control in the experiment in the supporting materials LED1 On command :+IPD,0,1:1 Each data is 10 Characters . The data is s[9] 了 .
5、 Summary
The final code still has large and small bug, It can only be said that I can barely run .
Through half a month of single-chip learning , I know more about software control . I also have some knowledge of hardware .
边栏推荐
- Market trend report, technical innovation and market forecast of tetrabromophthalate (pht4 diol) in China
- Hash table
- Visual studio 2019 (localdb) mssqllocaldb SQL Server 2014 database version is 852 and cannot be opened. This server supports 782
- TypeError: not enough arguments for format string
- Practice: fabric user certificate revocation operation process
- System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
- Accounting regulations and professional ethics [8]
- Software Engineer vs Hardware Engineer
- egg. JS learning notes
- Research Report of exoskeleton robot industry - market status analysis and development prospect prediction
猜你喜欢

多年锤炼,迈向Kata 3.0 !走进开箱即用的安全容器体验之旅| 龙蜥技术
时钟轮在 RPC 中的应用

Communication mode based on stm32f1 single chip microcomputer

Anta is actually a technology company? These operations fool netizens

《吐血整理》保姆级系列教程-玩转Fiddler抓包教程(2)-初识Fiddler让你理性认识一下

Solution du système de gestion de la chaîne d'approvisionnement du parc logistique intelligent

Visual studio 2019 (localdb) mssqllocaldb SQL Server 2014 database version is 852 and cannot be opened. This server supports 782

Understand Alibaba cloud's secret weapon "dragon architecture" in the article "science popularization talent"

The vscode waveform curve prompts that the header file cannot be found (an error is reported if the header file exists)

程序员怎么才能提高代码编写速度?
随机推荐
Vscode setting outline shortcut keys to improve efficiency
Cypher task design and task locking mechanism of isomorphic and heterogeneous graphs
Understand asp Net core - Authentication Based on jwtbearer
What is torch NN?
Communication mode based on stm32f1 single chip microcomputer
线程池的使用和原理
Median and order statistics
2022年国内云管平台厂商哪家好?为什么?
安信证券网上开户安全吗 开户收费吗
Overflow: the combination of auto and Felx
跳跃表实例
GO开发:如何利用Go单例模式保障流媒体高并发的安全性?
Accounting regulations and professional ethics [11]
Task state rollback and data blocking tasks based on check point mechanism
The vscode waveform curve prompts that the header file cannot be found (an error is reported if the header file exists)
Object.keys()的用法
[Acwing] 58周赛 4490. 染色
Array filter fliter in JS
最大子数组与矩阵乘法
Research Report on market supply and demand and strategy of China's Sodium Tetraphenylborate (cas+143-66-8) industry