Skip to content

HACK: Add support for ADS1115 based voltage readings #3246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: 3.x.x-maintenance
Choose a base branch
from

Conversation

andir
Copy link
Contributor

@andir andir commented Jun 5, 2025

Looking for feedback on the idea and way forward

With this change you can hook up (up to four) ADS1115 devices to the
I2C bus of a receiver in order to measure (each) four values and
transmit them as cell voltage. This (currently) allows for up to 16
different values each being transmitted as from a different source.

In a plane with fours 4S batteries you can transmit each cell voltage
of each of the batteries. There are different I2C ADC chips out there
that could probably do more than just 4 readings. For now I've
selected the ADS1115 because it was inexpensive (10€ for a couple of
them on a PCB) and because my current plane build only requires three
2S batteries.

Scaling of the values isn't currently done nor is there a
concrete plan for it. This is just a POC of the idea.

The way the values are currently collected isn't finalized yet. I
mainly wanted to get the reading part done in a way that isn't
blocking the core for excessive amounts of time. This currently has
the side effect of requiring multiple timeout calls of the code in
order to produce the first full reading of all connected cells.

As one of the next steps of my POC I wanted to add some
hardware.html-ish webui feature to configure parameters for each of
the cells sensors, e.g. scaling, sensitivity, update rate, ... Perhaps
that could even be done via lua without duplicating too much of the
logic in multiple places?!

The ADS1115 turned out to be a not-so-great choice. The measurments
seem to be fine but detecting the device requires too much "guessing"
with the reset-vector values. I'd much prefer a CHIP_ID register to
read from... Perhaps it isn't too bad since this is only during startup?

Also I'm not happy with naming of the files / "subsystem". Naming was
by far the hardest part and I decided to wait for external feedback on that.

The initial "design" was based off the barometric sensor code as that is also I2C with a a couple of devices providing ~similar features.

andir added 2 commits June 2, 2025 19:15
With this change you can hook up (up to four) ADS1115 devices to the
I2C bus of a receiver in order to measure (each) four values and
transmit them as cell voltage. This (currently) allows for up to 16
different values each being transmitted as from a different source.

In a plane with fours 4S batteries you can transmit each cell voltage
of each of the batteries. There are different I2C ADC chips out there
that could probably do more than just 4 readings. For now I've
selected the ADS1115 because it was inexpensive (10€ for a couple of
them on a PCB) and because my current plane build only requires three
2S batteries.

Scaling of the values isn't currently done nor is there a
concrete plan for it. This is just a POC of the idea.

The way the values are currently collected isn't finalized yet. I
mainly wanted to get the reading part done in a way that isn't
blocking the core for excessive amounts of time. This currently has
the side effect of requiring multiple `timeout` calls of the code in
order to produce the first full reading of all connected cells.

As one of the next steps of my POC I wanted to add some
hardware.html-ish webui feature to configure parameters for each of
the cells sensors, e.g. scaling, sensitivity, update rate, ... Perhaps
that could even be done via lua without duplicating too much of the
logic in multiple places?!

The ADS1115 turned out to be a not-so-great choice. The measurments
seem to be fine but detecting the device requires too much "guessing"
with the reset-vector values. I'd much prefer a CHIP_ID register to
read from... Perhaps it isn't too bad since this is only during startup?

Also I'm not happy with naming of the files / "subsystem". Naming was
by far the hardest part and I decided to wait for external feedback on that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant