Permalink
Switch branches/tags
v0.1.3 openhardware-pi-v0.4.4 openhardware-pi-v0.4.3.2 openhardware-pi-v0.4.3.1 openhardware-pi-v0.4.2 openhardware-pi-v0.4.1.3 openhardware-pi-v0.4.1.2 openhardware-pi-v0.4.1.1 openhardware-pi-v0.4.0 openhardware-pi-v0.3.9.2 openhardware-pi-v0.3.9.1 openhardware-edison-v0.4.4 openhardware-edison-v0.4.3.2 openhardware-edison-v0.4.3.1 openhardware-edison-v0.4.2 openhardware-edison-v0.4.1.3 openhardware-edison-v0.4.1.2 openhardware-edison-v0.4.1.1 openhardware-edison-v0.4.0.0 openhardware-edison-v0.3.9.1 openhardware-bbg-v0.4.4 openhardware-bbg-v0.4.3.2 openhardware-bbg-v0.4.3.1 openhardware-bbg-v0.4.2 openhardware-bbg-v0.4.1.3 openhardware-bbg-v0.4.1.2 openhardware-bbg-v0.4.1.1 openhardware-bbg-v0.4.0.0 openhardware-bbg-v0.3.9.1 openhardware-bbg-v0.0.1.4 openhardware-bbg-v0.0.1.3 maestro-e220-v0.0.1.6 maestro-e220-v0.0.1.5 maestro-e220-v0.0.1.4 maestro-e220-v0.0.1.3 maestro-e220-v0.0.1.2 maestro-e220-v0.0.1.1 libelium-meshlium-v0.0.1.2 libelium-meshlium-v0.0.1.1 libelium-meshlium-v0.0.0.1 latest general-linux-vreleaseScriptTest general-linux-v0.0.1.5 general-linux-v0.0.1.4 general-linux-v0.0.1.3 general-linux-v0.0.1.2 general-linux-v0.0.1.1 general-linux-v0.0.0.3 general-linux-v0.0.0.2 general-linux-v0.0.0.1 futuretek-ftm-100s-v0.4.0.2 futuretek-ftm-100s-v0.4.0.1 futuretek-ftm-100s-v0.3.9.2 futuretek-ftm-100s-v0.3.9.1 futuretek-ftm-100s-v0.0.1.4 futuretek-fmt-100s-v0.0.1.2 futuretek-fmt-100s-v0.0.1.1 ezex-eeg-200-v0.0.2.7 ezex-eeg-200-v0.0.2.6 ezex-eeg-200-v0.0.2.5 ezex-eeg-200-v0.0.2.4 ezex-eeg-200-v0.0.2.3 ezex-eeg-200-v0.0.2.2 ezex-eeg-200-v0.0.2.1 ezex-eeg-200-v0.0.1.5 ezex-eeg-200-v0.0.1.4 ezex-eeg-200-v0.0.1.3 ezex-eeg-200-v0.0.1.2 ezex-eeg-200-v0.0.1.1
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
158 lines (137 sloc) 4.29 KB

supported sensors

All sensors and auctuators are tested on Beaglebone Black.

Sensor setup

  • Requirement

    • Network (Wired or Wireless) connection
  • VDD 5V vs. SYS 5V

    • VDD_5V
      • 1A
      • VDD_5V is the main power supply from the DC input jack. So this voltage is not present when the board is only powered via USB
    • SYS_5V
      • 0.25A
  • Sensors

    1. ds18b20 (1-wire) : Temperature
    • VDD_3V3
    • DGND
    • GPIO 2
    • 4.7K Pull-Up Resistor (between VDD_3V3 and DGND)
    1. DHT11 Sensor V2 : Humidity
    • SYS_5V or VDD_5V
    • DGND
    • GPIO 27
    1. htu21d (I2C) : Humidity
    • VDD_3V3
    • DGND
    • I2C2_SCL
    • I2C2_SDA
    • Address: 0x40
    1. photocell (I2C) : Light
    • VDD_ADC
    • GDNA_ADC
    • AIN0
    • 10K Pull-Down Resistor (between AIN0 and DGND) / (sensor : between VDD_ADC and AIN0)
    1. BH1750FVI : Light (digital)
    • VDD_3V3
    • DGND
    • I2C2_SCL
    • I2C2_SDA
    • (Optional) ADD : if ADD is HIGH then address will be changed to 0x5c from 0x23
    • Address: 0x23 (0x5C)
    1. [magnetic switch]
    • DGND
    • GPIO 46 or 61 or 115
    1. [motion detector]
    • SYS_5V or VDD_5V
    • DGND
    • GPIO 46 or 61 or 115
    1. [noise detector]
    • SYS_5V or VDD_5V
    • DGND
    • GPIO 46 or 61 or 115
    1. [RGB]
    • DGND
    • GPIO 67
  1. power switch
  • SYS_5V or VDD_5V
  • DGND
  • GPIO 67
  1. sensorTag
  • TI sensor tag over Bluetooth LE
  • Bluetooth LE network generic support is under way.

Example

This example code is to access sensors: ds18b20 and dht22/dht11. ds18b20 uses 1-wire network and dht22/dht11 uses GPIO port thru proprietry protocol.

var sensor = require('./sensor/');

var targets = [{ 
    driverName: 'ds18b20',  //  temperature sensor over 1-wire sensor network
    options: {}, 
  }, {
    driverName: 'dht',      // temperature/humidity sensor over GPIO
    options: {model: 'dht22', macAddress: 'xxxxxx'},
  }];

targets.forEach(function (target) {
  var props = sensor.getSensorProperties(target.driverName),
      sensorId;

  if (props.discoverable) { // discoverable over sensor network
    sensor.discover(props.supportedNetworks[0], function (err, foundIDs) {
      if (err) {
        console.error('err=', err.stack);
      } else {
        if (foundIDs.length > 0) { //discovered
          sensorId = foundIDs[0]; // pick 1st one from the discovered IDs
          var snsr = sensor.createSensor(target.driverName, sensorId, target.options);

          // listening sensor data at the recommended interval
          snsr.on('data', function (data) { 
            console.log('data=', data); 
          });
          snsr.listen(props.recommendedInterval);
        }
      }
    });
  } else { // not discoverable
    var snsr = sensor.createSensor(target.driverName, null/*sensorId*/, target.options);

    // listening sensor data at the recommended interval
    snsr.on('data', function (data) {
      console.log('data=', data);
    });
    snsr.listen(props.recommendedInterval);
  }
});

sensor/actuator properties

Ds18b20 example:

  supportedNetworks: ['oneWire'],  // working over 1-wire network
  sensorType: 'temperature',  
  onChange: false,            // polling type sensor(not interrupt type)
  discoverable: true,         // discoverable thru 1-wire network 
  recommendedInterval: 10000, // recommended data gathering interval
  maxInstances: 7,            // max # of sensors to be attached 
  model: 'ds18b20',     
  maxRetries: 8               // max # of retries on error

sensor data format

ok example

{ 
  status: 'ok',
  id: 'dht22-xxxxxx',
  result: { 
    temperature: 26.9, 
    humidity: 51.5 } ,
  time: 1377605409847 // optional
}

error example

{ 
  status: 'error',
  id: 'dht22-xxxxxx',
  message: 'Error: Command failed' 
}