Skip to content

VEML7700

Works with

Any CircuitPython board with I2C

What it does

The VEML7700 measures ambient light in lux across a wide range — from dim indoor environments up to 120,000 lux in direct sunlight. It uses a simple I2C interface and includes an auto-gain feature that adjusts sensitivity automatically, making it practical without manual tuning for most applications.

Installing the library

Download adafruit_veml7700.mpy from the Adafruit CircuitPython Bundle and copy it to the lib/ folder on your board.

Quick start

import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_veml7700.VEML7700(i2c)

print(f"Lux: {sensor.lux}")
print(f"Raw light: {sensor.light}")
print(f"White channel: {sensor.white}")

Key things you can do

What you want How to do it
Read lux (calibrated) sensor.lux
Read raw ADC count sensor.light
Read white channel sensor.white
Enable auto-gain sensor.auto_gain() — adjusts gain and integration time automatically
Set gain manually sensor.gain = adafruit_veml7700.ALS_GAIN_1 — options: ALS_GAIN_1, ALS_GAIN_2, ALS_GAIN_1_8, ALS_GAIN_1_4
Set integration time manually sensor.integration_time = adafruit_veml7700.ALS_25MS — range: 25ms to 800ms
Enable power saving sensor.power_saving_enabled = True then set sensor.power_saving_mode

Reading the official docs

Full API reference: https://docs.circuitpython.org/projects/veml7700/en/latest/

Key things to look up:

  • auto_gain() — the method adjusts both gain and integration time together; useful when lighting conditions vary
  • lux vs lightlux applies gain correction and returns a calibrated value; light is the raw 16-bit ADC count
  • Power saving modes slow the measurement rate to reduce current draw between reads

Projects using this library