1.0.0 • Published 8 years ago

homebridge-lightsensor-analog v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

homebridge-lightsensor-analog

Analog light sensor service for Homebridge

Reads from an analog-to-digital SPI chip using mcp-spi-adc, and represents the value as an ambient light sensor light level.

Installation

  1. Install Homebridge using npm install -g homebridge
  2. Install this plugin npm install -g homebridge-lightsensor-analog
  3. Update your configuration file - see below for an example

Connect an MCP SPI ADC chip to your computer, and a photodiode or other analog light sensor to one of the channels of the ADC.

Configuration

  • accessory: "LightSensorAnalog"
  • name: descriptive name
  • chip: one of: MCP3002, MCP3004, MCP3008, MCP3202, MCP3204, MCP3208, or MCP3304
  • channel: channel number of ADC chip to read from
  • options: options for mcp-spi-adc
  • scale: value to multiply the raw 0.0 - 1.0 analog value with
  • offset: value to add to the raw 0.0 - 1.0 analog value

Homebridge expects a value in lux, you can adjust scale and offset to calibrate the analog sensor value (currently only linearly) empirically.

Example configuration:

    "accessories": [
        {
            "accessory": "LightSensorAnalog",
            "name": "Kitchen",
            "chip": "MCP3304",
            "channel": 7,
            "options": {
              "speedHz": 20000
            },
            "scale": 500,
            "offset": 0
        }
    ]

See also

License

MIT