# New sensor adding code

**URL:** <https://discuss.px4.io/t/new-sensor-adding-code/17082>\
**Category:** PX4 Autopilot\
**Created:** [June 9, 2020, 11:49pm UTC](https://discuss.px4.io/t/new-sensor-adding-code/17082 "2020-06-09T23:49:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RUDRENDU\_MAHINDAR](https://discuss.px4.io/user_avatar/discuss.px4.io/rudrendu_mahindar/32/5735_2.png) [@RUDRENDU\_MAHINDAR](https://discuss.px4.io/u/RUDRENDU_MAHINDAR)\
**Post date:** [June 9, 2020, 11:49pm UTC](https://discuss.px4.io/t/new-sensor-adding-code/17082/1 "2020-06-09T23:49:47Z")

</div>

I want to add my own sensor code to the PX4 firmware for sending the data Qgroundcontrol(QGC), can I get some directions or resources for implementing this?

---

<div class="post-metadata">

**Author:** ![xdwgood](https://discuss.px4.io/user_avatar/discuss.px4.io/xdwgood/32/5429_2.png) [@xdwgood](https://discuss.px4.io/u/xdwgood)\
**Post date:** [June 10, 2020, 12:19am UTC](https://discuss.px4.io/t/new-sensor-adding-code/17082/2 "2020-06-10T00:19:34Z")

</div>

The easiest and crudest method is to use your own sensor data to replace some messages that have been displayed in QGC (for example: accelerometer data). A reasonable method is to create a new mavlink message and use this message to pass sensor data to qgc

---

<div class="post-metadata">

**Author:** ![RUDRENDU\_MAHINDAR](https://discuss.px4.io/user_avatar/discuss.px4.io/rudrendu_mahindar/32/5735_2.png) [@RUDRENDU\_MAHINDAR](https://discuss.px4.io/u/RUDRENDU_MAHINDAR)\
**Post date:** [June 10, 2020, 8:26am UTC](https://discuss.px4.io/t/new-sensor-adding-code/17082/3 "2020-06-10T08:26:32Z")

</div>

Can you please suggest me some references to look at for creating a new mavlink message and the other dependencies to handle to collect sensor data in PX4 and pass data to qgc? Really appreciate your help

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [June 10, 2020, 9:43am UTC](https://discuss.px4.io/t/new-sensor-adding-code/17082/4 "2020-06-10T09:43:53Z")

</div>

What sort of sensor is it? Maybe we can find an existing message that can be used for your case.

---

<div class="post-metadata">

**Author:** ![RUDRENDU\_MAHINDAR](https://discuss.px4.io/user_avatar/discuss.px4.io/rudrendu_mahindar/32/5735_2.png) [@RUDRENDU\_MAHINDAR](https://discuss.px4.io/u/RUDRENDU_MAHINDAR)\
**Post date:** [June 11, 2020, 12:40am UTC](https://discuss.px4.io/t/new-sensor-adding-code/17082/5 "2020-06-11T00:40:21Z")

</div>

Is there a way to know what data is being recorded on the Pixhawk (or really just within the PX4 stack when running on any hardware) - I want to know if information related to power use is 1) saved, 2) sent back to the ground and/or 3) measured, in that maybe the system has access to this power use data, but doesn’t send it back to the ground?
