基于单片机的空气质量检测仪设计
2018-06-05文彪明立娟
文彪 明立娟
摘 要:文章设计了一种空气质量实时检测报警系统,通过单片机发送指令给PM2.5激光检测传感器实现对当前PM2.5值的读取,经过单片机的处理后,在LCD1602的液晶显示当前PM2.5值,用户可以根据实际需要通过按键,设置报警阈值,从而实现对当前PM2.5的检测报警。使用该仪器可以针对不同环境需要,设定阈值报警,操作使用简单、灵活多变。
关键词:单片机;自动检测;90C516RD+;PM2.5
中图分类号:TP277 文献标志码:A 文章编号:2095-2945(2018)13-0097-02
Abstract: In this paper, a real time air quality detection and alarm system is designed. The current PM2.5 value is read by sending instructions to PM2.5 laser detection sensor by single chip microcomputer. After processing by single chip computer, the current PM2.5 value is displayed on the LCD1602. According to the actual needs, the user can set the alarm threshold by pressing the button, so as to realize the detection and alarm of the current PM2.5. The instrument can be used for different environmental needs to set a threshold alarm, so the operation is simple, flexible and changeable.
Keywords: single-chip microcomputer; automatic detection; 90C516RD+; PM2.5
1 系统设计
(1)总体设计包括液晶显示、微处理器、PM2.5激光传感器总体框图如图1所示。
(2)硬件设计
本设计电路是由单片机为控制核心,另外主要通过5个模块的电路设计实现功能,他们分别是液晶显示模块、按键模块、传感器模块、报警模块、存储模块。通过单片机芯片处理数据和发送指令,再通过液晶显示和按键模块设置阈值,储存阈值,最后判断是否蜂鸣器报警,如图2所示。
(3)按键模块
通过3个按键触发,按键KEY1是设置键,按键KEY2是阈值加,按键KEY3是阈值减如图3所示。
(4)晶振模块
通过晶振模块提供11.0592MHz的振荡信号。如图4所示。
(5)液晶显示
通过单片机处理,在LCD液晶显示实时空气质量。如图5所示。
(6)报警模块
将获取到的实时数据值和设置的阈值比较,超过阈值则在蜂鸣器上报警,如图6所示。
(7)储存模块
将设置的阈值保存,避免二次开机再次设置,如图7所示。
(8)传感器模块
本传感器通过异步串行通讯方式(UART),以帧为单位进行通讯。通过单片机发送命令帧给传感器,传感器回复给单片机相应的应答帧,从而读取当前PM2.5的值,传感器与单片机的接线图,如图8所示。……
