基于STM32的智能插座的设计与实现毕业论文
2022-01-09 18:52:50
论文总字数:25218字
摘 要
近些年来随着物联网技术的兴起,智能插座的应用越来越多,其属于物联网技术与智能家居结合的小产物,借助内置在插座中的通信模块和控制模块,能够在移动客户端支持下让家庭中插座做到远程控制开关与定时开关。由此可见,插座已经由原先的提供电源的接线端子发展为小型的智能化控制器。
本课题针对智能家居中节能问题,尝试研发一种可自动通断电的智能插座。最基本要求为该插座具有2种控制方式,一种是定时控制方式,可人工设定电源通断电的时间,另一种是延时控制方式,设定若干时间后插座自动接通或关断。同时,可以通过手机来进行控制。
本次设计的智能插座系统主要分为5个模块,分别为控制模块、稳压模块、网络通信模块、人机交互模块和继电器控制模块。硬件基于STM32F103微控制器搭建,软件使用C语言编程软件uVision5编程。控制程序主要分为4部分,一是基于RTC时钟的实时时间显示和定时控制通断,二是基于通用定时器的延时控制通断,三是基于ESP8266的通讯控制,四是基于OLED和按键的人机交互控制和显示。经测试,设计的智能插座可以达到设计要求。
关键词:智能插座,嵌入式,时间控制,STM32,ESP8266
Design and implementation of smart socket based on stm32
Abstract
In recent years, with the rise of Internet of things technology, the application of intelligent socket is more and more, which belongs to the small product of the combination of Internet of things technology and intelligent home. With the help of the communication module and control module built in the socket, the socket in the home can achieve remote control switch and timing switch with the support of mobile client. It can be seen that the socket has been developed from the original power supply terminal to a small intelligent controller.
Aiming at the problem of energy saving in smart home, this paper tries to develop a kind of intelligent socket which can automatically turn on and off power. The basic requirement is that the socket has two control modes, one is timing control mode, which can manually set the time of power on and power off, the other is delay control mode, which can automatically turn on or off the socket after delaying several minutes or hours. At the same time, it can be controlled by mobile phone.
The design of the intelligent socket system is mainly divided into five modules, which are control module, voltage regulator module, network communication module, human-computer interaction module and relay control module. The hardware is based on STM32F103 micro controller, and the software is programmed with C language programming software uvisin5. The control program is mainly divided into four parts: one is real-time display and timing control on/off based on RTC clock; the other is delay control on-off based on general timer; the third is communication control based on esp8266; the fourth is human-computer interaction control and display based on OLED and keys. After testing, the designed intelligent socket can meet the design requirements.
Key Words: Smart socket;embedded;time control;STM32;esp8266
目 录
摘要…………………………………………………………………………………I
ABSTRACT………………………………………………………………………II
第一章 绪论………………………………………………………………………1
1.1 课题背景及研究意义……………………………………………………………1
1.2 智能插座的研究现状……………………………………………………………2
1.3 智能插座的发展前景……………………………………………………………3
1.4 课题的主要研究内容……………………………………………………………3
第二章 智能插座总体方案设计……………………………………………4
2.1 设计任务要求……………………………………………………………………4
2.2 系统总体框架……………………………………………………………………4
2.3 系统模块主要功能………………………………………………………………5
2.2.1 降压稳压模块……………………………………………………………5
2.2.2 人机交互模块……………………………………………………………5
2.2.3 控制模块…………………………………………………………………5
2.2.4 网络通信模块……………………………………………………………5
2.2.5 继电器控制模块……………………………………………………………5
第三章 智能插座的硬件系统设计…………………………………………6
3.1 智能插座的硬件选择……………………………………………………………6
3.2 STM32F103C8T6最小系统板……………………………………………………6
3.3 ESP8266模块……………………………………………………………………7
3.4 OLED显示模块 …………………………………………………………………8
3.5 按键控制模块……………………………………………………………………9
3.6 电源模块…………………………………………………………………………9
3.7 继电器控制模块…………………………………………………………………10
3.8 硬件接线…………………………………………………………………………11
第四章 智能插座的程序设计和实验………………………………………12
4.1 MDK软件使用和移植要求………………………………………………………12
4.2 实时时钟程序与定时程序设计………………………………………………13
4.3 延时时钟程序设计……………………………………………………………14
4.4 上位机串口通讯控制程序……………………………………………………14
4.5 ESP8266串口程序设计………………………………………………………15
4.6 OLED显示程序设计 …………………………………………………………17
4.7 按键控制调时程序设计………………………………………………………19
4.8 系统功能测试…………………………………………………………………20
4.8.1 实时显示功能测试……………………………………………………20
4.8.2 WIFI控制功能测试……………………………………………………21
4.8.3 按键控制功能测试 ……………………………………………………24
4.8.4 非法指令测试 …………………………………………………………26
4.8.5 继电器控制测试 ………………………………………………………27
第五章 总结……………………………………………………………………28
参考文献…………………………………………………………………………29
附录………………………………………………………………………………31
请支付后下载全文,论文总字数:25218字