npm

Need private packages and team management tools?Check out npm Orgs. »

veml6070-sensor

0.0.7 • Public • Published

veml6070-sensor

Node.js versions NPM version

Welcome to veml6070-sensor, a Node.js I2C module for the Vishay Semiconductors VEML6070 UVA Light Sensor. Adafruit sells a VEML6070 breakout board and here is the datasheet.

This module uses i2c-bus which should provide access with Node.js on Linux boards like the Raspberry Pi Zero, 1, 2, or 3, BeagleBone, BeagleBone Black, or Intel Edison.

Since veml6070-sensor needs to talk directly to the I2C bus and requires access to /dev/i2c, you will typically need run Node with elevated privileges or add your user account to the i2c group: $ sudo adduser $USER i2c

Example Code

const VEML6070 = require('veml6070-sensor');

// VEML6070 constructor options object is optional, i2cBusNo defaults to 1
//
const veml6070 = new VEML6070( {i2cBusNo : 1} );

const readSensorData = () => {
  veml6070.readSensorData()
    .then((data) => {
      console.log(`data = ${JSON.stringify(data, null, 2)}`);
      setTimeout(readSensorData, 1000);
    })
    .catch((err) => {
      console.log(`VEML6070 read error: ${err}`);
      setTimeout(readSensorData, 2000);
    });
};

// VEML6070 init options object is optional, integrationTime defaults to VEML6070.VEML6070_INTEGRATION_TIME_1_T()
//
veml6070.init({integrationTime : VEML6070.VEML6070_INTEGRATION_TIME_1_T()})
  .then((result) => readSensorData())
  .catch((err) => console.error(`VEML6070 init failed: ${err} `));

Example Output

> sudo node example.js
data = {
  "uv": 3839
}

Example Wiring

For an example of I2C setup on a Raspberry Pi, take a look at my pi-weather-station project.

install

npm i veml6070-sensor

Downloadsweekly downloads

0

version

0.0.7

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability