1
题 目: 基于物联网的漏电检测系统
关键词: 嵌入式; STM32F407;无线数据采集;GPRS;DTMF;远程控制,
QT
摘 要
本设计是一款电力线路漏电监测与远程控制系统,本次设计使用了指定硬
件平台:STM32F407( Cortex-M4 微控制器),以 STM32F407 核心板为
主体,结合 GSM 模块,构建了一个无线电力线路监测与远程控制系统。该系统
主要工作流程如下:通过电能表测量出电能数据并通过 SIM300 的 GPRS 功
能将电流数据实时的传给服务器,服务器进行汇总比较,一旦发现监测到各支
路监测点电能总和与其父节点的干路电能比较,如果超过设定的域值,则说明
该电路区域有漏电现象,则本系统服务端即时发出报警信号并通过与之相连接
的手机模块 SIM300 拨打监测号点终端通信模块的电话,建立实时连接后,通
过该连接通路,发送 DTMF 单,将指令发送给终端,其控制电路将该段线路电
力切断,以达到对线路的实时监控效果。无线通信和数据采集终端的固件用
IAR 开发环境,采用 C 语言编程,服务器端采用 QT + SQL 2008 数据库编
程,运行于 WINDOWS 平台。本系统的优势在于:系统采用可视化编程界面友
好;具有自动检测和传输功能方便实用;GSM 网络覆盖面广,监控不受距离限
制;无线通信可免布线,方便快捷;采用工业标准协议,利于产业化产生现实
效益。该系统在对线路进行实时监测的同时,对意外事故做出及时反应,尽可
能地减少因为线路故障而造成的人身伤害及财产损失,对有效保护人的生命安
全及社会财产具有重大意义,并对电路的各种事故具有实时预防能力,对将来
在电路监测报警领域有很大发展前景。
Abstract
This design is a power line leakage monitoring and remote control system , this
2
design uses a specific hardware platform : STM32F407 (Cortex-M4 microcontroller )
to STM32F407 core board as the main body , combined with the GSM module , to
build a wireless power lines monitoring and remote control system . The system
works as follows : the current data collected through the transformer and through
SIM300 the GPRS function of the current real-time data to the server , the server
summary comparison , if found to monitor the sum of each branch current monitoring
point with its parent stem Lu current comparator , if it exceeds the set threshold , then
the region of the circuit leakage phenomenon , this system server immediately send
alarm signals and through any connected mobile phone module SIM300 monitoring
numbers dialed telephone point terminal communication module , establish a live
connection , through the connecting passage , send DTMF single and sends
commands to the terminal , the control circuit power off the section of the line in
order to achieve real-time monitoring of the line effect . Wireless communications and
data collection terminal 's firmware using IAR development environment, using C
language programming , server QT + SQL 2008 database programming , running on
WINDOWS platform . This system has the advantage : The system uses visual
programming interface is friendly; with automatic detection and transmission function
is convenient and practical ; GSM network coverage , monitor unlimited distances ;
wireless communication -free wiring , convenient ; using industry standard protocols ,
which will help industry generate real benefits. The system is real-time monitoring of
the line at the same time , for a timely response to accidents , to minimize due to line
faults caused personal injury and property damage , for the effective protection of
human life and social security property is of great significance , and various accidents
on the circuit with real-time prevention capabilities for the future in the field of
monitoring and alarm circuits have great prospects for development.
Keywords: Embedded ; STM32F407; wireless data collection ; GPRS; DTMF;
Remote Control
3
目录
1 绪论.............................................................................................................................5
1.1 背景分析...............................................................................................................5
1.2 需求分析...............................................................................................................6
1.3 研究现状...............................................................................................................7
1.4 SIMCOM 公司的 SIM300 简介...........................................................................7
2 系统方案.....................................................................................................................8
2.1 总体方案...............................................................................................................8
2.2 系统各部分方案...................................................................................................9
2.2.1 电源提供.........................................................................................................9
2.2.2 数据采集与发送方案.....................................................................................9
2.2.3 数据储存......................................................................................................10
2.2.4 事故远程控制方案.......................................................................................10
2.2.5 时钟校时方案...............................................................................................10
2.2.6 继电器开关控制与状态存储.......................................................................11
2.2.7 DTMF 解码...................................................................................................11
3 功能与指标...............................................................................................................11
3.1 系统功能.............................................................................................................11
3.1.1 终端采集数据...............................................................................................11
3.1.2 服务器对数据的存储与处理.......................................................................12
3.1.3 事故判断并远控...........................................................................................12
3.1.4 时钟远程校时...............................................................................................12
3.1.5 DTMF 解码功能..........................................................................................12
3.1.6 指令回传核对...............................................................................................13
4 实现原理...................................................................................................................13
4.1 系统工作原理.....................................................................................................13
4.2 系统初始化.........................................................................................................14
4.3 时钟校时原理.....................................................................................................14
4.4 终端定时采集数据.............................................................................................14
4.5 远程控制、检测过流.........................................................................................14
4.6 数据库.................................................................................................................15
5 硬件电路图...............................................................................................................15
5.1 电源模块电路图.................................................................................................15
5.2 STM32F407 主控制器电路图...........................................................................15
5.3 DS1302 时钟模块电路图...................................................................................16
5.4 EEPROM 存储模块电路图................................................................................16
4
5.5 继电器开关控制模块电路图.............................................................................17
5.6 电位器模拟电能采集模块电路图.....................................................................18
6 软件设计...................................................................................................................19
6.1 PC 集中监测端介绍...........................................................................................19
7.7 拨号传输时钟校时指令程序流程图.................................................................24
6.8 拨号传输继电器指令控制程序流程图.............................................................25
7.1 系统测试方案.....................................................................................................26
7.2 测试设备.............................................................................................................26
7.3 测试数据.............................................................................................................26
7.4 结果分析.............................................................................................................27
8 特色...........................................................................................................................28
8.1 数据采集与发送.................................................................................................28
8.2 时钟校时.............................................................................................................28
8.3 指令传送.............................................................................................................29
8.4 在嵌入式平台上实现.........................................................................................29
8.5 PC 集中监测端...................................................................................................29
9、实物总体图片展示...............................................................................................29
5
1 绪论
1.1 背景分析
随着电力事业的迅猛发展,电力在生活中得到了广泛的应用。而电力线路
事故时常发生,它会造成电能浪费、发生火灾、造成人员伤亡等严重事故。然
而现有的漏电保护装置只是把发生触电、漏电的线路切断,以保护人身安全,
但是对于线路发生的地点、故障的时间、漏电电流的大小则缺乏监测,因而对
于故障的排除仍有困难,对于事故的原因也无从得知。因此迫切需要开发一种
漏电监测系统对线路的上述参数进行监测。提供一种电力线路异常漏电检测与
远程控制装置和方法,对于建设智能电网有重大意义。检测电力线路异常漏电
需要同时采集电网各配电节点的电流数据,在低频和直流输电线路中,可根据
节点电流代数和为零的原则进行检测,一旦发现异常漏电,应该及时断开发生
短路故障节点后的电力供应,从而减少损失。因此随着计算机网络和电子技术
的发展,新技术在电力系统中也得到了广泛的应用,智能远程控制的理念将投
入到实际应用中。对远程检测和控制电力系统的研究有很大的实用价值和商业
价值。智能电力检测与远程控制系统主要体现智能化和远程化两个方面,通过
嵌入式设计、GPRS 远程数据传输与 SIM300 拨号控制等技术使其得以实现。
传统的电力检测控制系统体积大、技术单一、控制范围小、时效性不佳、实用
价值和商业价值不高。很难实现大规模、多档位、即时有效的远程检测与控制
要求。
电力线路检测与远程控制系统,迎合了智能远程控制电力系统的需求,不
仅使电力检测的实时性大大提高,显示更加明显化,资源耗材少,技术先进,
时效性更强,可以实现实时监测及时远程控制的要求,大大减少了人力资源的
浪费。并对数据以数据库的形式存储在服务器,便于查找与比对。使系统更加
人性化,智能化。更满足现在社会生产生活的需要。