基于物联网的防盗报警器设计与实现

目录
1 绪论 1
1.1 研究内容及意义 1
1.1.1 研究背景及意义 1
1.1.2 主要研究内容 1
1.2 相关技术与模块介绍 1
1.2.1 LoRa概述 1
1.2.2 WiFi概述 1
1.2.3 Contiki概述 2
1.2.4 MPU6050概述 2
1.2.5 物联网三层架构 2
2 需求分析 3
2.1非机动车防盗报警 3
2.2 大型场馆展品防护报警 3
2.3 国家能源产所监测 3
2.4 家居生活防盗监测 3
2.5 系统优点概述 3
3 功能设计 5
3.1 防盗检测功能 5
3.1.1 检测算法 5
3.2 报警功能 7
3.3 环境参数采集功能 7
3.4 近距离无线传输功能 7
3.5 远距离无线传输功能 7
3.6 组网功能 8
3.7 人机交互功能 8
4 系统实现 9
4.1 感知层 9
4.1.1 压力采集 9
4.1.2 环境感知 9
4.1.3 节点控制中心 9
4.2 传输层 9
4.2.1 广域网实现 9
4.2.2 局域网实现 10
4.3 控制层 10
5 系统测试 12
5.1 执行节点测试 12
5.2 汇聚节点测试 12
5.3 云服务端测试 13
5.4 客户端测试 14
6 结束语 16
6.1 特色与创新 16
6.1.1 多传感器数据融合技术 16
6.1.2 可动态调整的阈值检测算法 16
6.1.3 超远距离超低功耗的LWPAN技术 16
6.1.4 比RSSI更精准的测距和定位技术 16
6.1.5 良好的人机交互界面 16
6.1.6 性能优越的操作系统 17
6.2 系统总结 17
参考文献: 17
致谢 19
3 功能设计
为了实现上述功能,需要做出以下设计规划:
3.1 防盗检测功能
防盗检测功能是为了检测被检测的物体、器件,是否被非法的触碰,移动,甚至盗取。分析可知,通过采集加速度的数据,可以得知物体的运动状态。但是仅仅通过加速度数据,可能会产生误报的情况。因此需要同时采集角速度数据。通过加速度+角速度的数据融合,解算姿态信息,再结合加速度的后续变化,判定物体的运动状态。
3.1.1 检测算法
加速度和角速度变化超过阈值?此时进入预报警状态,进一步解算加速度和角速度数据融合,检测到加速度变化超过阈值?物体运动,进入报警状态。加速度+角速度停止变化?进入预解除报警状态,进一步解算加速度和角速度数据融合,检测到加速度变化超过阈值?没有变化,则报警状态解除,有变化,则报警状态持续。
1.1.2 主要研究内容
本文的主要研究内容是设计与实现基于物联网产业的传感器与通信技术,具体完成工作如下所示:
(1)结合现代的人的生活方式和习惯,分析现有报警系统的优缺点,研究改进方案。
(2)采取物联网的典型三层架构模型,分层设计各层要完成的功能和提供给上层的接口。
(3)完成主控MCU的功能设计、外围传感器的选型组装、云服务器的配置、C/S模式通信、Android客户端设计。
(4)对系统进行专业测试,根据测试结果,继续完善并维护系统,来确保系统的稳定性和兼容性。
4 系统实现
4.1 感知层
4.1.1 压力采集
采用AD采集模块,型号为hx711。hx711是一款高灵敏度高精度的24位AD模块,市面上常用的电子秤,即采用此电路模块。为了实现压力的感知,还需要敏感元件来采集压力。其中全桥电路对压力的感知结果较为精准。因此敏感单元采取全桥压阻元件电路。AD模块和敏感电路组成压力采集模块。
4.1.2 环境感知
系统对环境的感知,分为运动姿态感知和温湿度感知。
使用MPU6050六轴传感器作为运动姿态采集单元。MPU6050与主控MCU采取IIC协议通信,其内部有众多寄存器,用来配置不同的功能。
使用SHT11模块获取节点系统周围的温湿度情况。SHT11采取两线制的通信方式,其内部的16位数据锁存器,本文转载自http://www.biyezuopin.vip/onews.asp?id=14907高8位保存了温度信息,低8位保存了湿度信息。通过移位操作,可以在MCU中获取环境的温湿度。
4.1.3 节点控制中心
采集节点使用了stm32f103作为主控芯片。芯片上面移植搭载contiki操作系统,用来管理多任务的交替和并发执行。
Contiki只需要几 KB 的代码和几百字节的内存就能提供多任务的环境及 TCP /IP 支持。其一般的配置是 2KB 的RAM 和 40KB 的 ROM, 由一个事件驱动型的内核组成,在它上面可以动态地加载或者卸载应用程序。Contiki 进程使用一个轻量级的 protothreads,在事件驱动型内核之上提供了一个线性的、类线程的编程方式。Contiki的这些轻便的特性使得其很适合做内存有限的微控制器[4]。

namespace SerialportSample
{
    partial class SerialportSampleForm
    {
        /// 
        /// 必需的设计器变量。
        /// 
        private System.ComponentModel.IContainer components = null;

        /// 
        /// 清理所有正在使用的资源。
        /// 
        /// 如果应释放托管资源,为 true;否则为 false。
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// 
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// 
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SerialportSampleForm));
            this.comboPortName = new System.Windows.Forms.ComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.comboBaudrate = new System.Windows.Forms.ComboBox();
            this.buttonOpenClose = new System.Windows.Forms.Button();
            this.buttonReset = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.button4 = new System.Windows.Forms.Button();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.button7 = new System.Windows.Forms.Button();
            this.button8 = new System.Windows.Forms.Button();
            this.button9 = new System.Windows.Forms.Button();
            this.label3 = new System.Windows.Forms.Label();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.txGet = new System.Windows.Forms.TextBox();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            // 
            // comboPortName
            // 
            this.comboPortName.FormattingEnabled = true;
            this.comboPortName.Location = new System.Drawing.Point(141, 16);
            this.comboPortName.Name = "comboPortName";
            this.comboPortName.Size = new System.Drawing.Size(121, 23);
            this.comboPortName.TabIndex = 0;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Location = new System.Drawing.Point(49, 19);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(89, 20);
            this.label1.TabIndex = 1;
            this.label1.Text = "选择串口";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label2.Location = new System.Drawing.Point(49, 65);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(69, 20);
            this.label2.TabIndex = 2;
            this.label2.Text = "波特率";
            // 
            // comboBaudrate
            // 
            this.comboBaudrate.FormattingEnabled = true;
            this.comboBaudrate.Items.AddRange(new object[] {
            "2400",
            "4800",
            "9600",
            "19200",
            "38400",
            "57600",
            "115200"});
            this.comboBaudrate.Location = new System.Drawing.Point(141, 66);
            this.comboBaudrate.Name = "comboBaudrate";
            this.comboBaudrate.Size = new System.Drawing.Size(121, 23);
            this.comboBaudrate.TabIndex = 3;
            this.comboBaudrate.SelectedIndexChanged += new System.EventHandler(this.comboBaudrate_SelectedIndexChanged);
            // 
            // buttonOpenClose
            // 
            this.buttonOpenClose.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.buttonOpenClose.Location = new System.Drawing.Point(326, 7);
            this.buttonOpenClose.Name = "buttonOpenClose";
            this.buttonOpenClose.Size = new System.Drawing.Size(75, 37);
            this.buttonOpenClose.TabIndex = 7;
            this.buttonOpenClose.Text = "open";
            this.buttonOpenClose.UseVisualStyleBackColor = true;
            this.buttonOpenClose.Click += new System.EventHandler(this.buttonOpenClose_Click_1);
            // 
            // buttonReset
            // 
            this.buttonReset.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.buttonReset.Location = new System.Drawing.Point(452, 7);
            this.buttonReset.Name = "buttonReset";
            this.buttonReset.Size = new System.Drawing.Size(75, 37);
            this.buttonReset.TabIndex = 8;
            this.buttonReset.Text = "重置";
            this.buttonReset.UseVisualStyleBackColor = true;
            this.buttonReset.Click += new System.EventHandler(this.button2_Click);
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(31, 23);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(96, 64);
            this.button1.TabIndex = 18;
            this.button1.Text = "打开LED灯";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(154, 23);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(96, 64);
            this.button2.TabIndex = 19;
            this.button2.Text = "关闭LED灯";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click_1);
            // 
            // button3
            // 
            this.button3.Location = new System.Drawing.Point(279, 23);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(96, 64);
            this.button3.TabIndex = 20;
            this.button3.Text = "打开声音";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            // 
            // button4
            // 
            this.button4.Location = new System.Drawing.Point(31, 128);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(96, 64);
            this.button4.TabIndex = 21;
            this.button4.Text = "关闭声音";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            // 
            // button5
            // 
            this.button5.Location = new System.Drawing.Point(154, 128);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(96, 64);
            this.button5.TabIndex = 22;
            this.button5.Text = "开始运动监测";
            this.button5.UseVisualStyleBackColor = true;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            // 
            // button6
            // 
            this.button6.Location = new System.Drawing.Point(279, 128);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(96, 64);
            this.button6.TabIndex = 23;
            this.button6.Text = "停止运动监测";
            this.button6.UseVisualStyleBackColor = true;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            // 
            // button7
            // 
            this.button7.Location = new System.Drawing.Point(31, 234);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(96, 64);
            this.button7.TabIndex = 24;
            this.button7.Text = "环境温湿度";
            this.button7.UseVisualStyleBackColor = true;
            this.button7.Click += new System.EventHandler(this.button7_Click);
            // 
            // button8
            // 
            this.button8.Location = new System.Drawing.Point(154, 234);
            this.button8.Name = "button8";
            this.button8.Size = new System.Drawing.Size(96, 64);
            this.button8.TabIndex = 25;
            this.button8.Text = "当前压力值";
            this.button8.UseVisualStyleBackColor = true;
            this.button8.Click += new System.EventHandler(this.button8_Click);
            // 
            // button9
            // 
            this.button9.Location = new System.Drawing.Point(279, 234);
            this.button9.Name = "button9";
            this.button9.Size = new System.Drawing.Size(96, 64);
            this.button9.TabIndex = 26;
            this.button9.UseVisualStyleBackColor = true;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label3.Location = new System.Drawing.Point(645, 29);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(104, 20);
            this.label3.TabIndex = 27;
            this.label3.Text = "系统时间:";
            this.label3.TextChanged += new System.EventHandler(this.label3_TextChanged);
            this.label3.Click += new System.EventHandler(this.label3_Click);
            // 
            // timer1
            // 
            this.timer1.Enabled = true;
            this.timer1.Interval = 1000;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // txGet
            // 
            this.txGet.Location = new System.Drawing.Point(1, 23);
            this.txGet.Multiline = true;
            this.txGet.Name = "txGet";
            this.txGet.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.txGet.Size = new System.Drawing.Size(522, 295);
            this.txGet.TabIndex = 5;
            this.txGet.TextChanged += new System.EventHandler(this.txGet_TextChanged);
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.txGet);
            this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.groupBox1.Location = new System.Drawing.Point(33, 105);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(525, 318);
            this.groupBox1.TabIndex = 16;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "接收区";
            // 
            // groupBox2
            // 
            this.groupBox2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox2.BackgroundImage")));
            this.groupBox2.Controls.Add(this.button5);
            this.groupBox2.Controls.Add(this.button1);
            this.groupBox2.Controls.Add(this.button9);
            this.groupBox2.Controls.Add(this.button2);
            this.groupBox2.Controls.Add(this.button8);
            this.groupBox2.Controls.Add(this.button3);
            this.groupBox2.Controls.Add(this.button7);
            this.groupBox2.Controls.Add(this.button4);
            this.groupBox2.Controls.Add(this.button6);
            this.groupBox2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.groupBox2.Location = new System.Drawing.Point(590, 105);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(392, 318);
            this.groupBox2.TabIndex = 28;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "控制区";
            // 
            // SerialportSampleForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            this.ClientSize = new System.Drawing.Size(994, 611);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.buttonReset);
            this.Controls.Add(this.buttonOpenClose);
            this.Controls.Add(this.comboBaudrate);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.comboPortName);
            this.Name = "SerialportSampleForm";
            this.Text = "电脑控制端";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.ComboBox comboPortName;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.ComboBox comboBaudrate;
        private System.Windows.Forms.Button buttonOpenClose;
        private System.Windows.Forms.Button buttonReset;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.Button button8;
        private System.Windows.Forms.Button button9;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Timer timer1;
        private System.Windows.Forms.TextBox txGet;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.GroupBox groupBox2;
    }
}


基于物联网的防盗报警器设计与实现_第1张图片
基于物联网的防盗报警器设计与实现_第2张图片
基于物联网的防盗报警器设计与实现_第3张图片
基于物联网的防盗报警器设计与实现_第4张图片
基于物联网的防盗报警器设计与实现_第5张图片
基于物联网的防盗报警器设计与实现_第6张图片
基于物联网的防盗报警器设计与实现_第7张图片
基于物联网的防盗报警器设计与实现_第8张图片
基于物联网的防盗报警器设计与实现_第9张图片
基于物联网的防盗报警器设计与实现_第10张图片
基于物联网的防盗报警器设计与实现_第11张图片
基于物联网的防盗报警器设计与实现_第12张图片
基于物联网的防盗报警器设计与实现_第13张图片
基于物联网的防盗报警器设计与实现_第14张图片
基于物联网的防盗报警器设计与实现_第15张图片
基于物联网的防盗报警器设计与实现_第16张图片
基于物联网的防盗报警器设计与实现_第17张图片
基于物联网的防盗报警器设计与实现_第18张图片
基于物联网的防盗报警器设计与实现_第19张图片
基于物联网的防盗报警器设计与实现_第20张图片

你可能感兴趣的:(物联网,防盗报警器,Eclipse+ADT,WiFi模块数,LoRa通信)