smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

Repository Summary

Description ROS 2 Node to collect and publish information about Smart Battery System devices
Checkout URI https://github.com/emersonknapp/smart_battery_driver.git
VCS Type git
VCS Version master
Last Updated 2020-04-29
Dev Status UNKNOWN
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
smart_battery_driver 0.0.0

README

Smart Battery Driver

This is an interface to Smart Battery System (SBS) devices that are available via Linux I2C. SBS devices communicate via the SMBus protocol, which can use a standard I2C bus. This package implements the Smart Battery Data Specification Rev 1.1 to query these SMBus devices and report their state as a sensor_msgs/BatteryState

API

Node: smart_battery_driver

Published Topics

  • ~battery_state (sensor_msgs/BatteryState)
    • Collected battery information

Subscribed Topics

None.

Parameters

For help discovering these values, see following section I2C Querying

  • ~device_path (str, required)
    • Filesystem device path of the i2c device (e.g. “/dev/i2c-7”)
  • ~battery_address (int, required)
    • 7-bit SMBus address of the Smart Battery
  • ~publish_frequency (float, default: 1)
    • In Hz, how frequently to query and publish the battery’s information

Tested Hardware

NOTE: any SBS-compliant battery should be compatible with this driver. The following list shows combinations that have been actually tried.

Combination 1:

I2C Querying Help

For the following commands, you need to install the prerequisite i2c-tools

sudo apt-get install i2c-tools

Finding desired I2C bus

To find out what i2c buses are present on the system, run

i2cdetect -l

Example output:

i2c-3   unknown         DPDDC-B                          N/A
i2c-1   unknown         i915 gmbus dpb                   N/A
i2c-6   unknown         CP2112 SMBus Bridge on hidraw0   N/A
i2c-4   unknown         DPDDC-C                          N/A
i2c-2   unknown         i915 gmbus dpd                   N/A
i2c-0   unknown         i915 gmbus dpc                   N/A
i2c-5   unknown         DPDDC-D                          N/A

In the case of Tested Hardware Combination 1, i2c-6 is the CP2112 bridge, so ~device_path parameter should be “/dev/i2c-6”.

Finding I2C Device Addresses

Once you have determined the bus number to use, you can find out what devices addresses are present.

i2cdetect -y -r $BUS_NUM

If you connect only one device at a time to the bus, this will easily allow you to determine the addresses of your devices.

Example output:

0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- 0b -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

In this case, I only had the Smart Battery connected, and now I know that its device address is 0x0B

CONTRIBUTING

Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:

5. Submission of Contributions. Unless You explicitly state otherwise,
   any Contribution intentionally submitted for inclusion in the Work
   by You to the Licensor shall be under the terms and conditions of
   this License, without any additional terms or conditions.
   Notwithstanding the above, nothing herein shall supersede or modify
   the terms of any separate license agreement you may have executed
   with Licensor regarding such Contributions.

Contributors must sign-off each commit by adding a Signed-off-by: ... line to commit messages to certify that they have the right to submit the code they are contributing to the project according to the Developer Certificate of Origin (DCO).


smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository

smart_battery_driver repository