锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / C++开源英语 / C++实现设备活动监控
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。


C++实现设备活动监控


Introduction

This shop-floor equipment activity monitor application is part of a series of how-to Intel® Internet of Things (IoT) code sample exercises using the Intel® IoT Developer Kit, Intel® IoT Gateway, Intel® Edison board, cloud platforms, APIs, and other technologies.

From this exercise, developers will learn how to:

  • Connect the Intel® Edison board or Intel® IoT Gateway, computing platforms a computing platform designed for prototyping and producing IoT and wearable computing products.
  • Interface with the Intel® Edison board or Arduino 101* (branded Genuino 101* outside the U.S.) board IO and sensor repository using MRAA and UPM from the Intel® IoT Developer Kit, a complete hardware and software solution to help developers explore the IoT and implement innovative projects.
  • Run these code samples in the Intel® System Studio IoT Edition (Eclipse IDE for C/C++ and Java* development) for creating applications that interact with sensors and actuators, enabling a quick start for developing software for the Intel® Edison board or Intel® Galileo board.
  • Store the equipment usage data using Azure Redis Cache* from Microsoft, Redis Store* from IBM Bluemix*, or ElastiCache* using Redis* from Amazon Web Services (AWS)*, different cloud services for connecting IoT solutions including data analysis, machine learning, and a variety of productivity tools to simplify the process of connecting your sensors to the cloud and getting your IoT project up and running quickly.
  • Set up a MQTT-based server using IoT Hub from Microsoft Azure*, IoT from IBM Bluemix*, or IoT from Amazon Web Services (AWS)*, different cloud machine to machine messaging services based on the industry standard MQTT protocol.
  • 此车间设备活动监控应用程序是使用英特尔®物联网开发人员套件、英特尔®物联网网关、英特尔®Edison主板、云平台、API和其他技术进行的一系列英特尔®物联网(IoT)代码示例练习的一部分。

    通过本练习,开发人员将学习如何:

    • 连接英特尔®Edison开发板或英特尔®物联网网关,计算平台是一个专为原型设计和生产物联网和可穿戴计算产品而设计的计算平台。
    • 英特尔®Edison开发板或Arduino 101 *(美国以外的品牌Genuino 101 *)板IO和传感器存储库的接口,这些接口适用于使用英特尔®物联网开发人员工具包开发的MRAA和UPM,这是一个完整的硬件和软件解决方案,可帮助开发人员探索物联网和实施创新项目。
    • 在英特尔®SystemStudio物联网版(用于C / C ++和Java *开发的Eclipse IDE)中运行这些代码示例,以创建与传感器和执行器交互的应用程序,从而快速启动为英特尔®Edison开发板或英特尔®伽利略开发板。
    • 使用来自Microsoft的Azure Redis Cache *,来自IBM Bluemix *的Redis Store *或使用来自Amazon Web Services(AWS)*的Redis *的ElastiCache *来存储设备使用数据,用于连接物联网解决方案(包括数据分析、机器学习,以及各种生产力工具,可简化将传感器连接到云的过程,并快速启动和运行IoT项目。
    • 使用来自Microsoft Azure *的IoT Hub,来自IBM Bluemix *的IoT或来自Amazon Web Services(AWS)*的IoT,基于行业标准MQTT协议的差异化云计算机到机器消息传递服务来设置基于MQTT的服务器。

What it is

Using an Intel® Edison board, this project lets you create a shop-floor equipment activity monitor that:

  • tracks equipment usage by monitoring sound and vibration sensors.
  • provides a visual notification whenever the equipment is in use.
  • logs equipment usage data using cloud-based storage.
  • 这是什么

    使用英特尔®Edison开发板,该项目可让您创建车间设备活动监视器:

    • 通过监控声音和振动传感器跟踪设备使用情况
    • 在设备使用时提供视觉通知。
    • 使用基于云的存储记录设备使用数据。

How it works

This equipment activity monitor checks for sound and vibration.

If both parameters cross a predefined threshold, the display is lit to indicate the equipment is in use.

Once the equipment is no longer being used, the monitor clears the display.

Optionally, equipment usage start/stop events can be stored using the Intel® IoT Examples Data store or on an MQTT server running in your own Microsoft Azure*, IBM Bluemix*, or AWS* account.

怎么运行的

此设备活动监视器检查声音和振动。

如果两个参数都超过预定义的阈值,则显示屏会亮起以指示设备正在使用中。

一旦设备不再使用,显示器将清除显示。

(可选)可以使用英特尔®物联网示例​​数据存储或在您自己的Microsoft Azure *,IBM Bluemix *或AWS *帐户中运行的MQTT服务器,存储设备使用开始/停止事件。

 

Hardware requirements

Grove* Starter Kit containing:

  1. Intel® Edison board with an Arduino* breakout board
  2. Grove Base Shield V2
  3. Grove Sound Sensor
  4. Grove Piezo Vibration Sensor
  5. Grove RGB LCD

DFRobot* Starter Kit for Intel® Edison board, containing:

  1. Intel® Edison board with an Arduino* breakout board
  2. Analog Sound Sensor.
  3. Digital Vibration Sensor
  4. LCD Keypad Shield
  5. 硬件要求

    Grove *入门套件包含:

    1. 带有Arduino *分线板的英特尔®Edison主板
    2. Grove Base Shield V2
    3. Grove声音传感器
    4. Grove Piezo振动传感器
    5. Grove RGB LCD

    适用于英特尔®Edison开发板的DFRobot *入门套件,包含:

    1. 带有Arduino *分线板的英特尔®Edison主板
    2. 模拟声音传感器
    3. 数字振动传感器
    4. LCD键盘护罩

Software requirements

  1. Intel® System Studio (Eclipse IDE for C/C++ and Java* development)
  2. Microsoft Azure*, IBM Bluemix*, or AWS* account (optional)
  3. 软件要求

    1. 英特尔®SystemStudio(用于C / C ++和Java *开发的Eclipse IDE)
    2. Microsoft Azure *,IBM Bluemix *或AWS *帐户(可选)

How to set up

This sample is already one of the IoT examples included in Intel® System Studio. To start using it, follow these steps:

  1. From the main menu, select Intel® IoT > Import IoT Examples.
  2. 如何设置

    此示例已经是英特尔®SystemStudio中包含的IoT示例之一。要开始使用它,请按照下列步骤操作:

    1. 从主菜单中,选择英特尔®物联网>导入物联网示例

    导入iot示例

  3. Expand the tree view for C++ > How To Code Samples > Equipment Activity Monitor and click Import Example.展开C ++的树视图>如何编码样本>设备活动监视器,然后单击导入示例

    代码示例2

  4. Select your developer board from the selection window then select Next.从选择窗口中选择开发板,然后选择Next

    选择板

  5. Select Intel® IoT C/C++ project from the Select a project type window then click Next.从“选择项目类型”窗口中选择“ 英特尔®物联网C / C ++项目”,然后单击“ 下一步”

    项目类型

  6. Select Yocto from the Selct target OS dropdown menu then click Next.从Selct目标操作系统下拉菜单中选择Yocto,然后单击下一步

    选择系统

  7. The next tab will ask for connection name and target name. If you do not know these click Search Target.下一个选项卡将询问连接名称和目标名称。如果您不知道这些,请单击“ 搜索目标”

    搜索目标

  8. Select your Edison from the dropdown list. Select OK.从下拉列表中选择您的Edison。选择确定

    代码示例

  9. Your connection name and target name should be filled in. Select Finish.应填写您的连接名称和目标名称。选择“ 完成”

    完成目标

  10. A new window will open for you and you will need to choose a name for your project and click Next.将打开一个新窗口,您需要为项目选择一个名称,然后单击“ 下一步”

    项目名称

  11. Your project source files will now be available on the on the upper left of your IDE by default.默认情况下,您的项目源文件现在可以在IDE的左上角使用。

    项目源代码导入

Connecting the Grove* sensors

You need to have the Grove* Base Shield V2 connected to an Arduino* compatible breakout board to plug all the Grove devices into the Grove Base Shield V2. Make sure you have the tiny VCC switch on the Grove Base Shield V2 set to 5V.

  1. Plug one end of a Grove cable into the Grove Sound Sensor, and connect the other end to the AO port on the Grove Base Shield V2.
  2. 连接Grove *传感器

    您需要将Grove * Base Shield V2连接到Arduino *兼容分线板,将所有Grove设备插入Grove Base Shield V2。确保Grove Base Shield V2上的微型VCC开关设置为5V

    1. 将Grove电缆的一端插入Grove声音传感器,将另一端连接到Grove Base Shield V2上的AO端口。

    设备活动
  3. Plug one end of a Grove cable into the Grove Piezo Vibration Sensor, and connect the other end to the A2 port on the Grove Base Shield V2.
  4. Plug one end of a Grove cable into the Grove* RGB LCD, and connect the other end to any of the I2C ports on the Grove Base Shield V2.
  5. 将Grove电缆的一端插入Grove压电振动传感器,并将另一端连接到Grove Base Shield V2上的A2端口。
  6. 将Grove电缆的一端插入Grove * RGB LCD,将另一端连接到Grove Base Shield V2上的任何I2C端口。

Connecting the DFRobot* sensors连接DFRobot *传感器

活动最下层

You need to have a LCD Keypad Shield connected to an Arduino* compatible breakout board to plug all the DFRobot* devices into the LCD Keypad Shield.

  1. Plug one end of a DFRobot* cable into Analog Sound Sensor, then connect the other end to the A3 port on the LCD Keypad Shield.

  2. Plug one end of a DFRobot* cable into the Digital Vibration Sensor, then connect the other end to the A2 port on the LCD Keypad Shield.

    您需要将一个LCD键盘护罩连接到Arduino *兼容分线板,将所有DFRobot *设备插入LCD键盘护罩。

    1. 将DFRobot *电缆的一端插入模拟声音传感器,然后将另一端连接到LCD键盘护罩上的A3端口。

    2. 将DFRobot *电缆的一端插入数字振动传感器,然后将另一端连接到LCD键盘护罩上的A2端口。

Intel® Edison board setup

This example uses the restclient-cpp library to perform REST calls to the remote data server. The code can be found in the lib directory. The restclient-cpp library requires the libcurl package, which is already installed on the Intel® Edison board by default.

英特尔®Edison主板设置

此示例使用restclient-cpp库对远程数据服务器执行REST调用。代码可以在lib目录中找到。该RESTClient实现-CPP库需要的libcurl包,这已经是默认安装在英特尔®爱迪生板。

 

Intel® IoT Gateway setup

You can run this example using an Intel® IoT Gateway connected to an Arduino 101* (branded Genuino 101* outside the U.S.).

Make sure your Intel® IoT Gateway is setup using Intel® IoT Gateway Software Suite, by following the directions on the web site here:

https://software.intel.com/en-us/getting-started-with-intel-iot-gateways-and-iotdk

The Arduino 101* (branded Genuino 101* outside the U.S.) needs to have the Firmata* firmware installed. If you have IMRAA installed on your gateway, this will be done automatically. Otherwise, install the StandardFirmata or ConfigurableFirmata sketch manually onto your Arduino 101* (branded Genuino 101* outside the U.S.).

英特尔®物联网网关设置

您可以使用连接到Arduino 101 *(美国以外的品牌Genuino 101 *)的英特尔®物联网网关来运行此示例。

请确保您的英特尔®物联网网关使用英特尔®物联网网关软件套件进行设置,请按照以下网站上的说明进行操作:

https://software.intel.com/en-us/getting-started-with-intel-iot-gateways-and-iotdk

Arduino 101 *(美国以外的品牌Genuino 101 *)需要安装Firmata *固件。如果您的网关上安装了IMRAA,则会自动完成。否则,请将StandardFirmata或ConfigurableFirmata草图手动安装到Arduino 101 *(美国以外的品牌Genuino 101 *)上。

 

Data store server setup

Optionally, you can store the data generated by this sample program in a back-end database deployed using Microsoft Azure*, IBM Bluemix*, or AWS*, along with Node.js*, and a Redis* data store.

For information on how to set up your own cloud data server, go to:

https://github.com/intel-iot-devkit/intel-iot-examples-datastore

数据存储服务器设置

(可选)您可以将此示例程序生成的数据存储在使用Microsoft Azure *,IBM Bluemix *或AWS *部署的后端数据库中,以及Node.js *和Redis *数据存储中。

有关如何设置自己的云数据服务器的信息,请访问:

https://github.com/intel-iot-devkit/intel-iot-examples-datastore

 

MQTT server setup

You can also optionally store the data generated by this sample program using MQTT, a Machine To Machine messaging server. You can use MQTT to connect to Microsoft Azure*, IBM Bluemix*, or AWS*.

For information on how to connect to your own cloud MQTT messaging server, go to:

https://github.com/intel-iot-devkit/intel-iot-examples-mqtt

MQTT服务器设置

您还可以选择使用MQTT(机器到机器)消息服务器存储此示例程序生成的数据。您可以使用MQTT连接到Microsoft Azure *,IBM Bluemix *或AWS *。

有关如何连接到您自己的云MQTT消息服务器的信息,请转到:

https://github.com/intel-iot-devkit/intel-iot-examples-mqtt

 

Configuring the example for your hardware kit

To configure the example for the specific hardware kit that you are using, either Grove* or DFRobot*:

  1. From the main menu, select Project > Properties dialog box is displayed. 
  2. 配置硬件套件的示例

    要配置您正在使用的特定硬件套件的示例,请使用Grove *或DFRobot *:

    1. 从主菜单中,选择“ 项目”>“属性”对话框。
    项目属性
  3. Expand the section C/C++ General.
    Click on the Paths and Symbols sub-section, and click on the Symbols tab. 展开C / C ++ General部分
    单击“ 路径和符号”子部分,然后单击“ 符号”选项卡。
  4. 生成路径
  5. Now click on GNU C++, and click on the Add button.现在单击GNU C ++,然后单击Add按钮。
  6.  添加
  7. In the Name field, enter "INTEL_IOT_KIT". In the Value field, enter either "GROVEKIT" (this is the default) or "DFROBOTKIT", depending on which hardware kit you 在“ 名称”字段中,输入“INTEL_IOT_KIT”。在“ 值”字段中,输入“GROVEKIT”(这是默认值)或“DFROBOTKIT”,具体取决于您要使用的硬件套件。wish to use. 添加名称变量
  8. Your new name symbol and value will now be displayed. Click OK. 现在将显示您的新名称符号和值。单击确定名称和变量OK
  9. Another dialog box will appear asking to rebuild project. Click OK. 将出现另一个对话框,要求重建项目。单击确定符号重编译OK

Connecting your Intel® Edison board or Intel® IoT Gateway to Intel® System Studio

  1. On the Target SSH Connections tab, right-click your device and select Connect.
  2. 将英特尔®Edison开发板或英特尔®物联网网关连接到英特尔®SystemStudio

    1. 在“ 目标SSH连接”选项卡上,右键单击您的设备,然后选择“ 连接”

    eclipse

If prompted for the username and password, the username is root and the password is whatever you specified when configuring the Intel® Edison board.如果提示输入用户名和密码,则用户名为root,密码为配置英特尔®Edison开发板时指定的密码。

Running the example with the cloud server

To run the example with the optional backend data store, you need to set the SERVER and AUTH_TOKENenvironment variables. You can do this in Eclipse as follows:

  1. From the Run menu, select Run Configurations.
    The Run Configurations dialog box is displayed.

  2. Under C/C++ Remote Application, click doorbell.
    This displays the information for the application.

  3. In the Commands to execute before application field, add the following environment variables, except use the server and authentication token that correspond to your own setup:

    使用云服务器运行示例

    要使用可选的后端数据存储运行示例,您需要设置SERVER和AUTH_TOKEN环境变量。您可以在Eclipse中执行以下操作:

    1. 从“ 运行”菜单中,选择“运行配置”
      系统弹出“运行配置”对话框。

    2. C / C ++远程应用程序下,单击门铃
      这将显示应用程序的信息。

    3. 在“ 在应用程序之前执行命令”字段中,添加以下环境变量,但使用与您自己的设置对应的服务器和身份验证令牌:

     

    chmod 755 /tmp/equipment-activity;
    export SERVER="http://intel-examples.azurewebsites.net/logger/equipment-activity";
    export AUTH_TOKEN="YOURTOKEN"  
  4. Click Apply to save your new environment variables.

Now when you run your program using the Run button, it should be able to call your server to save the data right from the Intel® Edison board Intel® IoT Gateway.

  1. 单击“ 应用”以保存新的环境变量。

现在,当您使用“ 运行”按钮运行程序时,它应该能够调用您的服务器以直接从英特尔®Edison开发板英特尔®物联网网关保存数据。

 

Running the code on the Intel® Edison board or Intel® IoT Gateway

When you're ready to run the example, click Run at the top menu bar in Intel® System Studio.

在英特尔®Edison开发板或英特尔®物联网网关上运行代码

准备好运行示例时,单击英特尔®SystemStudio顶部菜单栏中的“运行”


运行eclipse

This compiles the program using the Cross G++ Compiler, links it using the Cross G++ Linker, transfers the binary to the Intel® Edison board Intel® IoT Gateway, and then executes it on the board itself.

After running the program, you should see output similar to the one in the image below.

这使用Cross G ++编译器编译程序,使用Cross G ++ Linker链接它,将二进制文件传输到英特尔®Edison主板英特尔®物联网网关,然后在主板上执行。

运行程序后,您应该看到类似于下图中的输出。


eclipse成功

Successful output should be similar to the one in the image below.成功输出应类似于下图中的输出。
成功监控

The LCD should now display ready.现在应该显示LCD ready。
设备lcd

IMPORTANT NOTICE: This software is sample software. It is not designed or intended for use in any medical, life-saving or life-sustaining systems, transportation systems, nuclear systems, or for any other mission-critical application in which the failure of the system could lead to critical injury or death. The software may not be fully tested and may contain bugs or errors; it may not be intended or suitable for commercial release. No regulatory approvals for the software have been obtained, and therefore software may not be certified for use in certain countries or environments.

重要提示:本软件为样本软件。它不是设计用于任何医疗,救生或生命维持系统,运输系统,核系统,也不是用于系统故障可能导致严重伤害或死亡的任何其他任务关键型应用。该软件可能未经过全面测试,可能包含错误或错误; 它可能无意或不适合商业发布。未获得该软件的监管批准,因此软件可能未经过认证,无法在某些国家/地区或环境中使用。

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内