Difference between revisions of "M2M Bridge"

From AMTech WikiDocs
Jump to: navigation, search
(Cloud Configuration)
 
(374 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Functionality ==
+
[[File:AmtechM2mBridge.svg|40px]] M2MBridge is a software stack that implements M2M edge functionality leveraging AMTech IoT Protocol
* Configurable edge intelligence
+
# [[M2MBridge Functionality|Functionality]]
* Bridges standard and proprietary protocols to AMTech IoT DAP.
+
# [[Configuration example]]
* Device-to-device or device-to-cloud communications.
+
# [[M2MBridge network]]
** MQTT, LLRP, CoAP, STOMP, SmartM2M, LWM2M, PLC, Zigbee and others
+
#: [[Aggregation]]
* Allow remote and centralized control of IoT devices and gateways.
+
#: [[Edge reasoners]]
** SNMP/MIB/TRAP, Reader Management and other
+
#: [[Mesh network]]
* Configurable auto-discover
+
# [[Intelligence at the Edge]]
* Implements common functionality and orchestrates the execution of the protocols
+
#: [[WhatIsAPlugin|What is a plugin?]]
* Network failure detection and recovery
+
#: [[EPC (Electronic product code)]]
* Get centralized configuration information at startup and real time modifications
+
#: [[Smoothing observations]]
* Access control policies to manage observation production and consumption
+
# [[Observations production and consumption]]
[[File:Example.jpg]]
+
# [[Cloud Configuration]]
 
+
#: [[Observation production config]]
== Edge Configuration ==
+
#: [[Validation]]
*Edge/Device(s) site configuration bridgeConfig.json
+
#: [[Sample configuration for beacons]]
    {
+
# [[Automatic updates on bridge instance delete]]
    <span style="color:red">//text to label bridge instance</span>
+
# [[Implementation notes]]
    "description": "AMTech M2M Bridge",
+
# [[How to implement a new plugin]]
        "dap":{
+
# [[Set up a new Raspberry PI]]
            <span style="color:red">//amtech IoT DAP ur</span>
+
# [[Edge Configuration|M2MBridge Edge Configuration]]
            "dapUrl": "https://dap.amtech.mx",   
+
# [[M2MBridge updates]]
            <span style="color:red">//userid for the m2mBridge instance</span>
+
# [[How to install & execute]]
            "userId": "xxxxxxx@amtech.mx",
+
# [[HelloWorld plugin]]
            <span style="color:red">// tenant where bridge been configured</span>     
+
# Supported plugins
            "tenant" : "xxxxxxx", 
+
## [[File:wi-fi.svg|35px]] [[File:tcp-ip.svg|35px]] [https://en.wikipedia.org/wiki/Ethernet Wifi or RJ45 Ethernet]
            <span style="color:red">//m2mBridge userId password</span> 
+
##: [[File:SNMPDevice.svg|35px]] [[SNMPDevice]]
            "password" :"xxxxxxxx"
+
##: [[File:LLRPReader.svg|35px]] [[LLRPReader]]
        },
+
##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]]
        <span style="color:red">//Id to uniquely identify a M2MBridge instance, in absence of this property a unique identifier gets created</span>
+
##: [[File:thing-magic.svg|35px]] [[ThingMagicEPCReader]]
        "bridgeId":"m2mBridgeProgressNext",     
+
##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]]
        <span style="color:red">//wkt location to set m2mBridge location</span>
+
##: [[File:plc-icon.svg|35px]] [[OPCUADevice]]
        "location": "{\"wkt\":\"POINT(-99.17125583 19.40501031)\",\"sContext\":\"geo\"}",     
+
##: [[File:modbus.svg|45px]] [[ModbusDevice]]
        <span style="color:red">//Address use to geo locate m2mBridge instance</span>
+
##: [[File:wioGeneric.png|45px]] [[Wio Devices]] (troubleshooting inside)
        "address" :{
+
##:: [[File:wioNode.svg.svg|35px]] [[wioNode]]
            "country" : "usa",
+
##:: [[File:wioLink.svg|35px]] [[wioLink]]
            "city": "Las Vegas",
+
## [[File:bt.svg|35px]] [https://en.wikipedia.org/wiki/Bluetooth_Low_Energy BLE 4.0]
            "road": "Las Vegas Boulevard South",
+
##: [[File:BLEbeaconsScanner.svg|35px]] [[BLEbeaconsScanner]]
            "number":"3960"
+
##: [[File:bleOBDScanner.svg|35px]] [[BLEODB2Scanner]]
        },
+
##: [[File:BLEPeripheralsScanner.svg|35px]] [[BLEPeripheralsScanner]]
    }
+
##: [[File:BluvisioniBEEK.jpg|65px]] [[BLEBluvisionBeeksScanner]]
 
+
##: [[File:BLEGattCentral.svg|35px]] [[BLEGattCentral]]
== Cloud Configuration ==
+
## [[File:i2c.svg|35px]] [https://en.wikipedia.org/wiki/I%C2%B2C I2C]
*Create an amtechM2mBridge thing type instace (See "/amtech/linkeddata/types/composite/entity/amtechM2mBridge")
+
##: [[File:watersensor.svg|35px]] [[PCA9536I2CWaterDetectionWithBuzzer]]
* Create an actor with the polices required by the activity(s) (See [[Access control#Actors|Actors]])
+
##: [[File:TSL2561Light.svg|65px]] [[TSL2561I2CLight]]
** Add the things type polices the bridge needs access to
+
##: [[File:soundvibration.svg|35px]] [[ADC121C021I2CSoundVibrationShock]]
** Police must have user check; enabling instance access control by m2mBridge instance 
+
##: [[File:ncd-i2c.png|65px]] [https://store.ncd.io/shop/?fwp_interface=i2c-interface NCD I2C devices]
** Include in the polices the thing types the bridge instantiates
+
##: [[File:grove-log.png|65px]] [https://www.seeedstudio.com/category/Grove-c-1003%7C%7C24.html?p=0 Grove devices via I2C]
*Register a follower (See [[Access control#Actors|Roles]])
+
## [[File:usb-logo.svg|35px]] [https://en.wikipedia.org/wiki/USB USB 2.0]
** Assign to follower actor "m2mBridge" access
+
##: [[File:thing-magic.svg|35px]] [[ThingMagicEPCReader]]
** Uniquely identify each m2mBridge
+
##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]]
*Activity observation configuration (See [[Activities#Observation production configuration|Observation production configuration]])
+
##: [[File:Phidgets-Logo.png|65px]] [https://www.phidgets.com/?tier=0&catid=3&pcid=12 Phidgets USB sensors]
** Add the Things types the bridge will use (See [[Activities#Thing types|Thing types]])
+
<!--##:[[File:modbus.svg|45px]] [[ModbusDevice]]-->
*** Add the observations types from selected thing type the bridge will produce or consume (See [[Sensor's network#Observations and observation types|Observations and observation types]] [[Sensor's network#Crud observation|CRUD observations]])
+
## [[File:xbee-pro-900hp.svg|35px]] [https://www.digikey.com/catalog/en/partgroup/xbee-pro-900hp/33082?utm_adgroup=RF%20&%20RFID XBee-Pro 900HP]
** Configure the topic that m2mBridge will listen for crud and command observations has to matched with others things' observation production configuration hosted at this m2mBridge configuration (See [[Activities#Observation production configuration|Observation production configuration]] [[Sensor's network#Topics|Topics]])
+
##: [[File:relay-home-automation.svg|35px]] [[NCDXbee900Relay]]
*Things instance creation
+
##: [[File:energy-monitor.svg|35px]] [[NCDXbee900EnergyMonitor]]
**Using amtech creator experience (See [[Activities#Thing types|Thing types]])
+
##: [[File:ncd-i2c.png|65px]] [https://store.ncd.io/shop/?fwp_interface=900hp-s3b NCD devices supporting XBee-Pro 900HP communication]
**Configuring autoDiscover entry at bridgeConfig.json (See [[M2M Bridge#Edge Configuration|Edge Configuration]])
+
<!-- ## [[File:libelium.svg|45px]] [[waspmoteBLECentral]]-->
*Monitoring M2MBridge status
+
##: [[File:libelium.svg|65px]] [http://www.libelium.com/libeliumworld/waspmote/ Libelium waspmote]
**Create an SNMPDevice instance given access to the M2MBridge user (See  "/amtech/linkeddata/types/composite/entity/SNMPDevice")
+
##:: [[File:SmartEnvironment.jpg|65px]] [[Smart environment PRO]]
***Create a reasoner to monitor disk, cpu and memory usage as needed by IoT solution
+
##:: [[File:SmartAgriculture.png|65px]] [[Smart Agriculture]]
 
+
##:: [[File:SmartWater.jpg|65px]] [[Smart Water]]
== Implementation notes ==
+
##:: [[File:SmartWaterIons.png|65px]] [[Smart Water Ions]]
*M2MBridge is an open source nodes stack developed by the AMTEch team; it discovers, loads nodes modules implementing "M2MBridge plugin interface" and creates thing types instances (See [[Activities#Thing types|Thing types]]) tacking into account the observation production configuration (See [[Activities#Observation production configuration|Observation production configuration]]) and M2MBridge credentials (See [[Access control#Actors|Actors]] and [[M2M Bridge#Edge Configuration|Edge Configuration]]).
+
##:: [[File:SmartCities.jpg|65px]] [[Smart Cities]]
**It leverages AMTech IoT DAP (See [[Integration Guideline|Integration Guideline]])
+
##:: [[File:SmartParking.jpg|65px]] [[Smart Parking]]
***Gets observation production configuration (See [[Integration Guideline#DAP Restful API#Get observation production configuration|Observation production configuration API]])
+
##:: [[File:SmartSecurity.jpg|65px]] [[Smart Security]]
***Gets thing types instances (See [[Integration Guideline#Get instances by thing type|Observation instances API]])
+
##:: [[File:Radiation.png|65px]] [[Radiation]]
***Creates a web socket to receive asynchronous commands and thing instances changes (crud operations) (See [[Integration Guideline#Commands|CRUD and Commands API]])
+
##:: [[File:AmbientControl.png|65px]] [[Ambient Control]]
****Dispatch command observations to plugin instance leveraging thing type instance @id (See [[Activities#Thing types|Thing types]])
+
****Restart instance when supported properties change by calling stop and star plugin interface
+
***Creates configuration information for Thing type leveraging configuration information and client side M2MBridge placeholders (See [[Activities#Observation production configuration|Observation production configuration]] and [[Sensor's network#Placeholders|Placeholders]])
+
***Load plugin nodes modules required by configuration
+
***Creates an instance of plugin for each type from observation production configuration leveraging thing type instance @id (See [[Activities#Thing types|Thing types]])
+
****JavaScript object is extended with the properties values from the thing instance (See [https://github.com/AMTechMX/M2MBridge/blob/master/plugins/SNMPDevice/SNMPDevice.js plugin example] )
+
****Properties and methods are injected like common logg for m2mBridge plugins, methods to send observations with and without transformation, methods for restarting, observation production configuration and others (See [https://github.com/AMTechMX/M2MBridge/blob/master/plugins.js for details]
+
****If instance does not exist at the server side execute auto discover process from bridgeConfig.json can be configured (See [[M2M Bridge#Edge Configuration|Edge Configuration]])
+
***Creates a centralized observation dispatcher with persistence to ensure:
+
****Observations delivery.
+
****The order that observations occurred .
+
 
+
== How to implement a new plugin ==
+
*Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
+
**at /.../M2MBridge/plugins create a directory that matched with the Thing type name to bridge example SNMPDevice (See [[Activities#Thing types|Thing types]])
+
*Implement a nodejs module with the following interface
+
    function SNMPDevice() {
+
    }
+
    SNMPDevice.prototype.start = function ( complete) {
+
        try {
+
            complete(null);
+
        } catch (e) {
+
            complete(e);
+
        }
+
    };
+
    SNMPDevice.prototype.stop = function (complete) {
+
        try {
+
            complete(null);
+
        } catch (e) {
+
            complete(e);
+
        }
+
    };
+
    SNMPDevice.prototype.command = function (observation, complete) {
+
        try {
+
            complete(null);
+
        } catch (e) {
+
            complete(e);
+
        }
+
    };
+
    module.exports.SNMPDevice = SNMPDevice;
+
 
+
== How to install it ==
+
*Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
+
*Install nodejs https://nodejs.org/en/download/package-manager/
+
*Install npm (http://blog.npmjs.org/post/85484771375/how-to-install-npm)
+
*Delete at /.../M2MBridge/plugins/xxx unneeded plug-ins
+
*Install packages for m2mBridge core and plug-ins (https://docs.npmjs.com/cli/install:)
+
*Execute npm install at:
+
**M2MBridge directory
+
**each plug-in directory
+
 
+
== Existing plugins ==
+
 
+
=== LLRPReader ===
+
 
+
=== BLEPeripheralsScanner ===
+
 
+
=== BLEbeaconsScanner ===
+
 
+
=== SNMPDevice ===
+
 
+
=== MQTTBroker ===
+
 
+
=== COAP ===
+

Latest revision as of 11:16, 14 January 2019

AmtechM2mBridge.svg M2MBridge is a software stack that implements M2M edge functionality leveraging AMTech IoT Protocol

  1. Functionality
  2. Configuration example
  3. M2MBridge network
    Aggregation
    Edge reasoners
    Mesh network
  4. Intelligence at the Edge
    What is a plugin?
    EPC (Electronic product code)
    Smoothing observations
  5. Observations production and consumption
  6. Cloud Configuration
    Observation production config
    Validation
    Sample configuration for beacons
  7. Automatic updates on bridge instance delete
  8. Implementation notes
  9. How to implement a new plugin
  10. Set up a new Raspberry PI
  11. M2MBridge Edge Configuration
  12. M2MBridge updates
  13. How to install & execute
  14. HelloWorld plugin
  15. Supported plugins
    1. Wi-fi.svg Tcp-ip.svg Wifi or RJ45 Ethernet
      SNMPDevice.svg SNMPDevice
      LLRPReader.svg LLRPReader
      LLRPAntenna.svg LLRPAntenna
      Thing-magic.svg ThingMagicEPCReader
      LLRPAntenna.svg LLRPAntenna
      Plc-icon.svg OPCUADevice
      Modbus.svg ModbusDevice
      WioGeneric.png Wio Devices (troubleshooting inside)
      WioNode.svg.svg wioNode
      WioLink.svg wioLink
    2. Bt.svg BLE 4.0
      BLEbeaconsScanner.svg BLEbeaconsScanner
      BleOBDScanner.svg BLEODB2Scanner
      BLEPeripheralsScanner.svg BLEPeripheralsScanner
      BluvisioniBEEK.jpg BLEBluvisionBeeksScanner
      BLEGattCentral.svg BLEGattCentral
    3. I2c.svg I2C
      Watersensor.svg PCA9536I2CWaterDetectionWithBuzzer
      TSL2561Light.svg TSL2561I2CLight
      Soundvibration.svg ADC121C021I2CSoundVibrationShock
      Ncd-i2c.png NCD I2C devices
      Grove-log.png Grove devices via I2C
    4. Usb-logo.svg USB 2.0
      Thing-magic.svg ThingMagicEPCReader
      LLRPAntenna.svg LLRPAntenna
      Phidgets-Logo.png Phidgets USB sensors
    5. Xbee-pro-900hp.svg XBee-Pro 900HP
      Relay-home-automation.svg NCDXbee900Relay
      Energy-monitor.svg NCDXbee900EnergyMonitor
      Ncd-i2c.png NCD devices supporting XBee-Pro 900HP communication
      Libelium.svg Libelium waspmote
      SmartEnvironment.jpg Smart environment PRO
      SmartAgriculture.png Smart Agriculture
      SmartWater.jpg Smart Water
      SmartWaterIons.png Smart Water Ions
      SmartCities.jpg Smart Cities
      SmartParking.jpg Smart Parking
      SmartSecurity.jpg Smart Security
      Radiation.png Radiation
      AmbientControl.png Ambient Control