Hi everyone,

Does anyone have experience with configuring their own sensors onto the Pixhawk (I have an IRIS)? I purchased a gas sensor that I'd like to wire to it, does anyone know of any good resources to help me get started? I've downloaded the PX4 development environment from the Pixhawk developers website and have gone through some of the "getting started" instructions on there, I have been able to install the firmware through Eclipse as opposed to the Mission Planner. I also purchased 3-position and 5-position connectors for the analog inputs.

I was also wondering if there is a way to view the telemetry log data on Mission Planner during flight? If I did add this sensor, would data be saved through the telemetry logs or dataflash logs?

I appreciate whatever help I can get, thank you!


Views: 14325

Reply to This

Replies to This Discussion

Hi Ben,

This code should work fine on the APM - just use the appropriate ADC pin.

Thanks, we will give it a try.

Hi James,

Thanks, all done with the code modification.

What method of building the firmware did you use?  Make or Microsoft visual basic?

reason I ask is because I am using make and it keeps giving me a variable error?

- Rai Gohalwar

Rai, I use make both from the command line and from Eclipse. What is the error you are getting? 

It kept saying that a float was used in case of a char in id 157 

Weird, never seen that before. By the way i was using the console to do it. How do you build it from the eclipse?

-Rai Gohalwar

I will private message you my skype address

Hi Katie, I have flown with CO2, SO2, and H2S sensors on an APM. I hooked them up via I2C and then added a new dataflash 'GAS' log message and later also a mavlink message. Would be interested to hear more about your application, and happy to show you the code I used. It's in a local branch but if you remind me I'll push it to github. You can see the discussion I started here.

Good stuff James. Q: is this "how to" documented anywhere besides your posts? I've been building and reading the APM code for a few days and had no clue this existed. I would eventually have run across this in the code once I got to these files, but the timing would have been much farther out. Thx! Tim
Hi Tim, not that I know of. It is a bit of a 'hack' overriding existing variables that could potentially be in use so it is not really appropriate for any official documentation. I put it out there as the shortest route to achieve the goal of logging from the adc pins. Given the interest I am thinking that there should be options to log at least some analog pins as standard. I might work on this and make an attempt to contribute...
Agreed that some documented sanctioned option should exist to access the analog pins outside of your, um, shortcut. In the meantime, your posts on this have been very useful. :-) - Tim

It would be great if someone who knows what they are doing could write a set of instructions (including a flow chart) to show how to read an additional ADC pin and send the data to Mavlink and to log the data. 

Anyone ?


Glad to see someone else who's accomplished configuring gas sensors to the APM. I have an H2S gas sensor (link here) that I need to configure to the Pixhawk. How did you test/calibrate the sensors? Definitely interested in hearing about your experiments.


Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service