ROS2 Jazzy driver for the Vishay VEML7700 high-accuracy ambient light sensor over I2C.
- Publishes
sensor_msgs/Illuminanceonveml7700/illuminance fake_modefor 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_ratechange viaros2 param set - Calibration and reset services
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.
- ROS 2 Jazzy
- Python 3
- Real hardware only:
smbus2(pip install smbus2)- VEML7700 breakout board (I2C)
cd ~/ros2_ws
colcon build --packages-select veml7700_light --symlink-install
source install/setup.bashros2 launch veml7700_light veml7700_launch.pyros2 run veml7700_light veml7700_node.pyros2 launch veml7700_light veml7700_launch.py \
params_file:=path/to/your_params.yamlSet fake_mode: false, gain, and integration in your YAML file.
ros2 topic echo /veml7700/illuminance| 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 |
| 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 |
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
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 |
MIT