Skip to content

ROS2 Jazzy driver for ADS1015 12-bit 4-channel ADC (I2C). Fast 128-3300 SPS, PGA configurable, ADS1115 sibling.

License

Notifications You must be signed in to change notification settings

mingyo186/ads1015_adc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ads1015_adc

ROS2 Jazzy driver for ADS1015 12-bit 4-channel ADC over I2C (Texas Instruments).

The ADS1015 is the faster, lower-resolution sibling of the ADS1115 (16-bit). It offers data rates up to 3300 SPS (vs 860 SPS for ADS1115), making it ideal for applications that need speed over precision. Same pinout and register layout as ADS1115.

Features

  • Publishes std_msgs/Float32 per active channel on adc/channel{0-3}
  • fake_mode for testing without hardware (random Gaussian data)
  • 4 single-ended channels, configurable PGA (±0.256V to ±6.144V)
  • Fast data rates: 128–3300 SPS
  • Voltage offset calibration via service call
  • Runtime publish_rate change via ros2 param set

Prerequisites

  • ROS 2 Jazzy
  • Python 3
  • smbus2 (pip install smbus2) — only needed for real hardware

Installation

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

Usage

Launch (default: fake_mode)

ros2 launch ads1015_adc ads1015_launch.py

Direct execution

ros2 run ads1015_adc ads1015_node.py --ros-args -p fake_mode:=true

Real hardware (Raspberry Pi)

ros2 launch ads1015_adc ads1015_launch.py params_file:=my_params.yaml

YAML override

ads1015_adc_node:
  ros__parameters:
    fake_mode: false
    i2c_bus: 1
    device_address: 0x48
    active_channels: [0, 1]
    pga_gain: 1
    data_rate: 6

Topic echo

ros2 topic echo /adc/channel0

Parameters

Parameter Type Default Description
fake_mode bool true Use fake driver (no hardware)
i2c_bus int 1 I2C bus number
device_address int 0x48 I2C address (0x48–0x4B)
publish_rate double 10.0 Publishing rate (Hz)
active_channels int[] [0,1,2,3] Channels to read (0–3)
pga_gain int 2 PGA: 0=±6.144V, 1=±4.096V, 2=±2.048V, 3=±1.024V, 4=±0.512V, 5=±0.256V
data_rate int 4 DR: 0=128, 1=250, 2=490, 3=920, 4=1600, 5=2400, 6=3300 SPS

Services

Service Type Description
adc/calibrate std_srvs/srv/Trigger Collect samples for 2s, compute voltage offset bias
adc/reset std_srvs/srv/Trigger Clear bias, reinitialise sensor

Package Structure

ads1015_adc/
├── CMakeLists.txt
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── .gitignore
├── package.xml
├── config/
│   └── ads1015_params.yaml
├── launch/
│   └── ads1015_launch.py
├── nodes/
│   └── ads1015_node.py
├── ads1015_adc/
│   ├── __init__.py
│   └── ads1015_driver.py
└── test/
    └── test_ads1015_node.py

Test Results

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

Test Category Test Result
Topics adc/channel{0-3} publishes std_msgs/Float32 PASS
Services adc/calibrate returns success=True PASS
Services adc/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 ADS1015 12-bit 4-channel ADC (I2C). Fast 128-3300 SPS, PGA configurable, ADS1115 sibling.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published