I would like to use the ADS1115 (from Texas Instruments) to send the voltage and current readings from my copter to the flight controller. The ADS1115 has to communicate over I2C with the flight controller (that is running PX4).
I’m quite new to PX4 (before I used ArduPilot a lot) and I’m wondering how I can configure PX4 in a way that the voltage and current is communicated over I2C using the ADS1115. Do I need to build a whole new firmware or can I just adjust some parameters/use the MavLink shell?
Which flight controller do do you plan to connect ADS1115 to? Normally you’d need to modify the startup scripts of your board to get ADS1115 driver working, as System Startup | PX4 User Guide told.
The case if your board hasn’t compiled the driver by default, then you need to manually include it in your config and build from the scratch.
BUT, due to the unimplemented device_id usage on PX4-Autopilot/src/modules/battery_status at master · PX4/PX4-Autopilot · GitHub and other modules, the on-chip ADC publishes ADC reports which most likely will collision with ADS1115’s data and cause undefined behavior. Sorry but that means on a normal available FC you cannot use this driver…
The flight controller I’m using, does have an onboard ADC. However it’s only used on startup of the system, so I will turn it off after the startup and that shouldn’t cause any problem.
I’m going to build a custom firmware version for this. Which function(s) should I call to start/configure the ADS1115? And which function(s) do I need the call to read an input from the ADS1115?
Does the library configure the ADS1115 in the +/- 6.144 V mode (after the ADS1115 is initialized)?
Does the library uses the default I2C address of the ADS1115? It’s possible to choose between 4 different I2C addresses, the default address is selected when the ADR pin (of the ADS1115) is connected to GND.
Do I need to write some code that makes sure that the ADS1115 measurements are used for voltage and current reading (after I initialized the ADS1115)?