# A Message from Pi to QGC

**URL:** <https://discuss.px4.io/t/a-message-from-pi-to-qgc/47202>\
**Category:** MAVLink\
**Created:** [August 27, 2025, 7:49am UTC](https://discuss.px4.io/t/a-message-from-pi-to-qgc/47202 "2025-08-27T07:49:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhruvil](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@Dhruvil](https://discuss.px4.io/u/Dhruvil)\
**Post date:** [August 27, 2025, 7:49am UTC](https://discuss.px4.io/t/a-message-from-pi-to-qgc/47202/1 "2025-08-27T07:49:53Z")

</div>

Hello, i am planning control DC motor through Raspberry Pi zero 2 W, which is connected to the Pixhawk 6C via Telem2 port. I am using PX4. I have established the connection and the plan is to control the DC motor movement (forward or backward) via RC9 switch, which i am able to send from Pixhawk to Pi.

```auto
#!/usr/bin/env python3
from pymavlink import mavutil
import time

def pwm_to_distance(pwm: int) → int:
if 900 <= pwm <= 1100:
return 50
elif 1400 <= pwm <= 1600:
return 100
elif pwm > 1900:
return 150
else:
return 0

master = mavutil.mavlink_connection(‘/dev/serial0’, baud=57600)

master.wait_heartbeat()
print(“Connected to PX4, system ID:”, master.target_system)

master.mav.statustext_send(

mavutil.mavlink.MAV_SEVERITY_CRITICAL,

‘PI Connected‘.encode
)

while True:
# Get RC_CHANNELS_RAW messages
msg = master.recv_match(type=‘RC_CHANNELS’, blocking=True)
if msg is not None:
rc9_pwm = msg.chan9_raw
stepper_dist = pwm_to_distance(rc9_pwm)

status_message = f"RC9 PWM: {rc9_pwm} → Stepper target: {stepper_dist} cm"
print(f"status_message: {status_message} at {time.time()}")

master.mav.statustext_send(

mavutil.mavlink.MAV_SEVERITY_INFO,

status_message.encode
)

time.sleep(0.5)

```

i have this code and it runs without any error, but i don’t see any message anywhere. There are no messages in speaker icon (in Fly view) nor in MAVLink Inspector. i don’t even see the STATUSTEXT tab under MAVLink Inspector.

MAV\_1\_MODE = onboard  
MAV\_1\_CONFIG = TELEM2

The connection is properly established between Pi and PX4, when i flick the switch on remote control, it prints different messages on Pi screen.

Could some guide me on how to send message to QGC via this channel?

---

<div class="post-metadata">

**Author:** ![dotanAtTrim](https://discuss.px4.io/user_avatar/discuss.px4.io/dotanattrim/32/14833_2.png) [@dotanAtTrim](https://discuss.px4.io/u/dotanAtTrim)\
**Post date:** [August 27, 2025, 9:10am UTC](https://discuss.px4.io/t/a-message-from-pi-to-qgc/47202/2 "2025-08-27T09:10:14Z")

</div>

Format your code block so they’ll show as code blocks, easier for everyone to read.

Use search option and Google, this question (or similar) is repeated every once in a while.

Also try to enable forwarding. Please comment what solved your issue.

---

<div class="post-metadata">

**Author:** ![Dhruvil](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@Dhruvil](https://discuss.px4.io/u/Dhruvil)\
**Post date:** [August 27, 2025, 10:12am UTC](https://discuss.px4.io/t/a-message-from-pi-to-qgc/47202/3 "2025-08-27T10:12:32Z")

</div>

If you want to see the message only in MAVLink inspector, you must switch from system 1 to system 245 manually from top right corner. (this won’t show messages in vehicle message in fly panel)

`master = mavutil.mavlink_connection(‘/dev/serial0’, baud=57600, source_system = 245)`

if you want to show message in vehicle message in fly panel, change source\_system = 1.

Other option is to change to code of QGC so it will show system 245 messages in vehicle message as well.

---

<div class="post-metadata">

**Author:** ![system](https://discuss.px4.io/uploads/default/original/3X/7/3/73ce918bdcd64854de904f0c8d9ab70ca9723f2a.png) [@system](https://discuss.px4.io/u/system)\
**Post date:** [September 3, 2025, 10:13am UTC](https://discuss.px4.io/t/a-message-from-pi-to-qgc/47202/4 "2025-09-03T10:13:30Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
