Quantcast
Channel: ArduPlane - ArduPilot Discourse
Viewing all articles
Browse latest Browse all 7846

Using the the I2C and AP_ADC_ADS1115

$
0
0

@inkk wrote:

Hi,

I’m new to the forum, so if I’m breaking any rules or missing any pertinent information, please let me know, and I will address it as soon as I can.

Hardware/Software:

  • CubeOrange
  • ADS1115 analog to digital converter
  • Analog potentiometer
  • WSL2 + VSCode for editing and compiling. (if it matters)

Goal:
I am trying to create an angle of attack sensor that consists of a potentiometer connected to a 16-bit A2D (ADS1115) that connects to the Pixhawk via the I2C2 port.

What I’ve done:
I’ve added an AoA sensor class to the libraries/ directory and had it call the init method of the ADS1115 class. All it’s doing is grabbing the I2C device and initiating the periodic callback of AP_ADC_ADS1115::_update. --All this compiles and loads onto the Pixhawk without an issue.

The Issues:
The problem occurs when it runs the periodic AP_ADC_ADS1115::_update method. Within update, the AP_ADC_ADS1115::read_registers method fails upon calling of AP_HAL::Device::transfer function and I cannot for the life of me figure out why. This is where I cannot find any information to assist in my problem. Any direction would be great.

I should probably add:

  • I have verified that I can talk to the A2D by using the I2C ports on a Raspberry Pi, so the board isn’t DOA.
  • I’ve gone through the very general sensor driver page. It doesn’t provide much help.
  • I’ve read through this AoA sensor addition with different hardware. I actually used this one as a baseline.
  • I’ve loaded the sensor driver onto two different Pixhawks, both fail the same way.
  • I even hooked the SCL/SDA lines to a scope to verify nothing was being written to the port. Spoiler: something was written to the port, but not what I was trying to send it.

I appreciate your time,
John

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7846

Trending Articles