Skip to content

ROS2 Jazzy driver for VEML7700 high-accuracy ambient light sensor (I2C). Publishes sensor_msgs/Illuminance with wide dynamic range 0.0036-120000 lux.

License

Notifications You must be signed in to change notification settings

mingyo186/veml7700_light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VEML7700 High-Accuracy Ambient Light Sensor — ROS2 Jazzy Driver (I2C)

ROS2 Jazzy driver for the Vishay VEML7700 high-accuracy ambient light sensor over I2C.

Features

  • Publishes sensor_msgs/Illuminance on veml7700/illuminance
  • fake_mode for testing without hardware (random Gaussian data)
  • Wide dynamic range: 0.0036 ~ 120000 lux
  • Configurable gain: 1x, 2x, 1/8x, 1/4x
  • Configurable integration time: 25 ms ~ 800 ms
  • High-lux polynomial correction (Vishay application note)
  • Runtime publish_rate change via ros2 param set
  • Calibration and reset services

Why this package?

There is also a bh1750_light driver for BH1750. The VEML7700 offers different trade-offs:

Feature BH1750 (bh1750_light) VEML7700 (this package)
Lux range 1–65535 lx 0.0036–120000 lx
Resolution 1 / 0.5 / 4 lx 0.0036 lx (best)
Gain Fixed per mode 1x / 2x / 1/8x / 1/4x
Integration Fixed per mode 25–800 ms
High-lux correction Not needed Polynomial correction
White channel No Yes
Price ~$1-2 ~$3-5

Choose bh1750_light for simple, low-cost lux readings. Choose this package for wide dynamic range and high accuracy.

Prerequisites

  • ROS 2 Jazzy
  • Python 3
  • Real hardware only:
    • smbus2 (pip install smbus2)
    • VEML7700 breakout board (I2C)

Installation

cd ~/ros2_ws
colcon build --packages-select veml7700_light --symlink-install
source install/setup.bash

Usage

Launch (fake mode — default)

ros2 launch veml7700_light veml7700_launch.py

Run node directly

ros2 run veml7700_light veml7700_node.py

Real hardware (Raspberry Pi)

ros2 launch veml7700_light veml7700_launch.py \
  params_file:=path/to/your_params.yaml

Set fake_mode: false, gain, and integration in your YAML file.

Verify output

ros2 topic echo /veml7700/illuminance

Parameters

Parameter Type Default Description
fake_mode bool true Generate random data without hardware
i2c_bus int 1 I2C bus number (/dev/i2c-N)
device_address int 0x10 I2C address (fixed for VEML7700)
gain string 1x Gain: 1x, 2x, 1/8x, 1/4x
integration string 100ms Integration time: 25ms, 50ms, 100ms, 200ms, 400ms, 800ms
publish_rate float 5.0 Publishing rate in Hz
frame_id string light_link TF frame ID

Services

Service Type Description
veml7700/calibrate std_srvs/srv/Trigger Collect samples for 2 s, report averages
veml7700/reset std_srvs/srv/Trigger Clear bias, reinitialize sensor

Package Structure

veml7700_light/
├── CMakeLists.txt
├── package.xml
├── config/
│   └── veml7700_params.yaml
├── launch/
│   └── veml7700_launch.py
├── veml7700_light/
│   ├── __init__.py
│   └── veml7700_driver.py
├── nodes/
│   └── veml7700_node.py
├── test/
│   └── test_veml7700_node.py
├── .gitignore
├── LICENSE
├── CONTRIBUTING.md
└── README.md

Test Results

Tested on Ubuntu 24.04 (WSL2) with fake_mode: true.

Test Category Test Result
Topics veml7700/illuminance publishes sensor_msgs/Illuminance PASS
Topics Illuminance non-negative, correct frame_id PASS
Services veml7700/calibrate returns success=True PASS
Services veml7700/reset returns success=True PASS
Parameters publish_rate runtime change PASS
Shutdown Clean exit PASS
Linting pep257, flake8, copyright, xmllint PASS

License

MIT

About

ROS2 Jazzy driver for VEML7700 high-accuracy ambient light sensor (I2C). Publishes sensor_msgs/Illuminance with wide dynamic range 0.0036-120000 lux.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published