基于STM32的人体感应灯设计(论文13000字)
摘 要
本文旨在设计一种由光控元件和人体红外感应相结合的室内人体感应灯,整个照明系统由STM32F103C8T6最小系统板进行智能控制。系统由热释电红外传感器负责检测是否有人体经过,再经过光敏电阻针对环境光强调整电阻,结合STM32的ADC转换功能,从而实现感应灯对环境光强的感知,并根据环境光强对感应灯的亮度进行调整,感应灯的亮度调整由STM32F103C8T6最小系统板中通用定时器PWM调制功能进行调节。为了方便照明系统的管理,本次设计还加入了手动模式和自动模式的切换,同时加入了红外遥控的功能,使得远程操作照明系统成为可能。本设计中照明设备采用了两个LED灯珠,模拟现实生活中多个照明设备同时工作的情况,使设计更加贴近日常生活中的使用。软件层面则是基于HAL库使用C语言进行编写,HAL库是近年来意法半导体公司推行的代码编写方式,与传统的基于寄存器开发和基于库函数开发相比,HAL库有很多优点,是未来STM32软件开发的新风向。本设计最终要实现“人来灯亮,人走灯灭,智能调光,按需照明”的目标,让智能照明系统的家族增加新的成员。整个人体感应灯的设计具有低成本、节约能源、人性化等特点,提升使用人的舒适感。
关键词 STM32F103;PWM;热释电红外传感器;红外遥控;智能照明
Design of human body sensing light based on STM32
Abstract
The purpose of this paper is to design a kind of indoor human body sensor lamp which is combined with light control element and human body infrared sensor. The whole lighting system is intelligentively controlled by the STM32F103C8T6 microprocessor. In the entire lighting system, a pyroelectric infrared sensor is responsible for detecting whether a human body passes by. Then the photoresistor adjusts the resistance for the ambient light intensity, combined with the ADC conversion function of the microprocessor, so as to realize the perception of the ambient light intensity of the sensor lamp, and adjust the brightness of the sensor lamp according to the ambient light intensity. The brightness adjustment of the induction lamp is adjusted by the general timer PWM modulation function in the microprocessor STM32F103C8T6. In order to facilitate the management of the lighting system, this design also added manual mode and automatic mode switching, and also added the infrared remote control function, making it possible to remotely operate the lighting system. The lighting equipment in this design uses two LED lamp beads to simulate the simultaneous working of multiple lighting equipment in real life, making the design closer to the use in daily life. The software level is written based on the HAL library. The HAL library is a code writing method promoted by STMicroelectronics in recent years. Compared with the traditional register-based development and library-based function development, the HAL library has many advantages and is a new trend in the development of single-chip software in the future. This design ultimately achieves the goal of "lights on when people come, lights off when people go, intelligent dimming, and lighting on demand", allowing the family of intelligent lighting systems to add new members. The design of the whole human body induction lamp has the characteristics of low cost, energy saving, humanization, etc., which enhances the user's comfort.
Keywords STM32F103;Light control lighting;Infrared pyroelectric
目 录
第1章 绪论 1
1.1 引言 1
1.2 发展现状 1
1.2.1 人体红外感应灯优劣 1
1.2.2 人体红外感应灯的市场现状 2
1.3 研究目标 2
1.4 研究方法 3
1.5 人体感应灯设计思路 3
第2章 人体感应灯结构框架 5
2.1 人体感应灯功能框架 5
2.2 手动模式流程图 6
2.3 自动模式流程图 7
2.4 系统程序主流程图 7
第3章 硬件设计 9
3.1 感应灯整体电路 9
3.2 核心处理单元 9
3.3 电源电路 10
3.4 手动控制模块电路 11
3.5 人体感应模块电路 12
3.6 感光模块电路 12
3.7 红外遥控模块电路 13
3.8 LED驱动模块电路 14
第4章 软件设计 15
4.1 STM32的配置 15
4.2 功能函数编写 19
4.2.1 感应灯的控制 20
4.2.2 PWM调光 25
4.2.3 ADC转换 26
4.2.4 人体感应功能 27
4.2.5 红外遥控解码 27
4.2.6 主函数 31
第5章 感应灯样机与效果测试 33
5.1 样机结构 33
5.2 样机测试 33
总 结 35
致 谢 37
参 考 文 献 38
|