I2C communication between Pixhawk and Arduino

Hello,

I’m looking for a way to establish a serial I2C communication between a Pixhawk and an Arduino board.

The idea behind it is to connect one (and more) sensors to the Arduino, process the data and send (MAVLINK) messages to the Pixhawk.

Being a noob, does this make sense at all ? If so, where do I start :slight_smile:

Cheers,
Hans

I’m also trying to figure this out. I have an analog pitot tube, but there’s no analog port on the pixhawk mini.

I’d prefer to not buy anything new, so if I can figure out how to use an Arduino to emulate the i2c sensor, that would be awesome

After reading the dev.px4.io pages during the last days, I’ve skipped the plan the use an Arduino. Actually I’m going to have to write a device driver (Looks like I’ll have to dive up my C++ OOP courses again :grin:) for the sensor and connect it to the I2C port of the PixHawk.

Can someone explain me how to get access to the PX4 console (not NSH) of a PixHawk mini ? Unfortunately there is no information about this on dev.px4.io.

Cheers,
Hans

The simplest way is to emulate the sensor as @m.perreman. To do so, you’ve to mimic existing I2C sensor for the same data.

The other way is to create a new driver for your device which means you have to:

  • Use your sensor on the arduino
  • Define data transmission protocol
  • Read the sensor from PX4
  • Publish your data in the correct format in uOrb

Finally, you could instead go for a serial communication where you should just send the correct MAVLink message and maintain a 2Hz heartbeat.