Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Access control in C++

What it is

Using a compatible Intel-based platform, this project lets you create a smart access control system that:

  • monitors a motion sensor to detect when a person is in an area that requires authorization.
  • can be accessed with your mobile phone via a built-in web interface to disable the alarm.
  • keeps track of access data, using cloud-based storage.

First time setup

For all the samples in this repository, see the General Setup Instructions for required boards and libraries. You need either Grove or DFRobot sensors but not both.

Hardware requirements

Grove*

Sensor Pin
PIR Motion Sensor D4
Grove RGB LCD I2C

DFRobot*

Sensor Pin
PIR (Motion) Sensor A2

For more specific information on the hardware requirements see Hardware Details

Software requirements

  1. MRAA https://github.com/intel-iot-devkit/mraa and UPM https://upm.mraa.io/
  2. Intel® System Studio https://software.intel.com/en-us/creating-iot-projects-with-intel-system-studio-2018-c
  3. Microsof Azure*, IBM Bluemix*, AT&T M2X*, AWS*, Predix*, or SAP* account (optional)
  4. Note: The following libraries are included with the repo and already linked to in the code -jsoncpp -restclient

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. Expand the section C/C++ General.
    Click on the Paths and Symbols sub-section, and click on the Symbols tab.
  3. Now click on GNU C++, and click on the Add button.
  4. 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 wish to use.
  5. Your new name symbol and value will now be displayed. Click OK.
  6. Another dialog box will appear asking to rebuild project. Click OK.

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

MQTT message published: { d: { value: '2016-04-21T23:57:18.254Z looking-for-motion'  }}
2016-04-21T23:57:30.559Z motion-detected 
Connecting to MQTT server... 
MQTT message published: { d: { value: '2016-04-21T23:57:30.559Z motion-detected'  }}

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_TOKEN environment variables. You can do this in Intel® System Studio as follows:

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

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

  3. In the Commands to execute before application field, add the environment variables so it looks like this, except using the server and authentication token that correspond to your own setup:

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

Regenerating the HTML and CSS

If you make any changes to either the index.html or styles.css file, you need to regenerate the .hex file used to serve up the assets via the built-in Crow* web server. We have a useful tutorial on how to use the shell script here:

how-to-run-the-shellscript.md

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.