Adding new I2C devices for PX4

Hello, I am new here. I am trying to add multiple I2C devices to my PX4. I am using a tailwheel high-wing airplane to do data collection, and have three I2C differential pressure sensors. They are all the same type of device, so they have the I2C address, so I have a PCA9545 to connect each sensor in a pattern over time to the I2C bus. I have an Arduino Uno that runs the setup well, but I have had some trouble finding where in the PixHawk code I can implement the same system. TIA.

Dan

Hello,

I think you have the right setup, using an arduino as a multiplexer is OK.
Now the question is , what do you want to do with these signals ?

  • Telemetry
  • Data Logger
  • Fuse them into the Kalman Filter for a very specific flight condition

Based on the answer we may look on the ‘‘how’’

Hi Ppoirier,

I am using it to collect data to correlate with the other data the PixHawk is generating. My end goal is to save all of the gyroscope, accelerometer, magnetometer, and GPS data, along with the pressure sensor data, to a file in binary that I can process after the flight. I feel like just adding the Arduino to the aircraft won’t accomplish that goal, as the Arduino wouldn’t have access to all of the other data.

I think the best way to do this would be to add the new sensors and their controller to the source code for the PixHawk. Any help with this pursuit would be greatly appreciated.

Dan

Might take a look at this : http://ardupilot.org/dev/docs/learning-ardupilot-storage-and-eeprom-management.html#the-dataflash-library

I have talked to my research director. It looks like all I need to do is add a few lines to send a command to a new I2C device before every differential pressure reading. Any help finding the file where the I2C commands are sent to the differential pressure sensor would be appreciated. TIA

Dan

I that case you will have to write a driver for this, http://ardupilot.org/dev/docs/code-overview-sensor-drivers.html

Hi ppoirieer,
I am working on a chip design that consists of a PIC micro-controller and several sensors (e.g. light, etc) and a GNSS (Ublox M8Q). I was able to communicate these sensors with the PIC via I2C bus (PIC acts as the master and all sensors act as slaves). I also communicated GPS information from the GNSS module to the Pixhawk2.1 (PX4, ProfiCNC) via UART on the 8-pin GPS1 port of PixHawk. Depending on the GPS information communicated to the Pixhawk, I believe that the Pixhawk sends some information back. Based on this information, I need to turn on LEDs on my PCB. I need a way to get these messages to my micro-controller.

Going through Pixhawk documentation, the GPS1 port has 1 UART and 1 I2C port. As mentioned above, the UART Pins are used by GNSS device to communicate GPS information to Pixhawk, and it does it fine (I have verified that the Pixhawk receives GPS information via Mission Planner). However, I have no clue of how to read the information sent back by PixHawk. I know that I should use the I2C on GPS1 port of Pixhawk (connected to my micro-controller), however, how do I implement this in software. How do I know what messages does the PixHawk sends and in what order? Does it act as a master or a slave? Can you point me in the right direction?

Thank you in advance.

You could consider communicate with the Flight Controler or GCS using MavLink. Uavcan could be an option but it is still in developement.
All the messaging and control can be implemented using MavLink

1 Like