{
  "id": "howmanyoliversarethere/micropython-ltr308",
  "name": "micropython-ltr308",
  "prettyName": "micropython-ltr308",
  "description": "MicroPython driver for the Lite-On LTR-308ALS ambient light sensor",
  "version": "",
  "author": "howmanyoliversarethere",
  "license": "MIT",
  "tags": [],
  "status": "VALID",
  "official": false,
  "source": "https://github.com/howmanyoliversarethere/micropython-ltr308",
  "updatedAt": "2026-10-28T08:38:57.075Z",
  "page": "https://checkmim.com/packages/howmanyoliversarethere+micropython-ltr308",
  "createdAt": "2026-10-28T08:38:56.059Z",
  "submittedBy": "oliverr",
  "install": {
    "mpremote": "mpremote mip install github:howmanyoliversarethere/micropython-ltr308",
    "mip": "import mip; mip.install(\"github:howmanyoliversarethere/micropython-ltr308\")"
  },
  "readme": "# LTR-308ALS ambient light sensor\n\nA MicroPython driver for the Lite-On **LTR-308ALS-01** I2C ambient light\nsensor: lux readings with selectable gain (1x to 18x) and resolution\n(16 to 20 bits), standby, and the threshold interrupt on `nINT`.\n\nCopy `ltr308.py` onto your board, or install it with `mip`:\n\n```python\nimport mip\nmip.install(\"github:HowManyOliversAreThere/micropython-ltr308\")\n```\n\n## Usage\n\n```python\nfrom machine import I2C, Pin\nimport ltr308\n\ni2c = I2C(0, sda=Pin(19), scl=Pin(20), freq=400_000)\nals = ltr308.LTR308(i2c, gain=ltr308.GAIN_3X, resolution=ltr308.RES_18BIT_100MS)\nprint(als.lux())                  # latest reading\nprint(als.lux(only_new=True))     # None unless a new conversion finished\n\nif als.saturated():\n    als.gain(ltr308.GAIN_1X)      # too bright for this gain\n\nals.standby()                     # stop measuring until enable()\n```\n\n## Notes\n\n- The address is fixed at 0x53. The constructor checks the part ID (0xB1)\n  and raises `OSError` if it doesn't match.\n- Lux is `count × 0.6 × window_factor / (gain × integration factor)`, with\n  the integration time relative to 100 ms, per Lite-On's formula. Pass\n  `window_factor` to correct for light lost to a cover window.\n- The measurement rate must be at least as long as the conversion time.\n\n## License\n\nMIT - see [LICENSE](LICENSE).\n"
}