Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. question marks on serial monitor raspberry pi and arduino Serial communication problem.
Forum Updated to NodeBB v4.3 + New Features

question marks on serial monitor raspberry pi and arduino Serial communication problem.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 229 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bonoo5
    wrote on 20 Apr 2025, 17:41 last edited by
    #1

    I'm trying to set up communication between an Arduino and a Raspberry Pi 5 using RX and TX pins. Both devices appear to be sending and receiving messages, but the messages (which are strings) show up as question marks (?) in the serial monitor.

    When I run the same code using USB communication instead, everything works fine — the strings are displayed correctly. I've double-checked the wiring (at least 20 times), and it seems solid.

    Could the issue be with my level shifter? I'm using the bidirectional Pololu 2595. Has anyone had similar issues with this model, or have any suggestions on what might be going wrong?
    Arduino code:

    void setup() {
      Serial.begin(9600);  // Let's use a standard baudrate
      delay(1000);
    }
    
    void loop() {
      if (Serial.available() > 0) {
        // Simple echo functionality
        String message = Serial.readString();
        Serial.print("Arduino received: ");
        Serial.print(message);
        Serial.flush();
      }
    }
    

    and the raspberry pi code:

    #!/usr/bin/env python3
    import serial
    import time
    
    if __name__ == '__main__':
        ser = serial.Serial('/dev/ttyAMA0', 9600, timeout=1)
        ser.reset_input_buffer()
    
        while True:
            ser.write("Hello from Raspberry Pi!\n".encode('utf-8'))
            line = ser.readline().decode('utf-8').rstrip()
            print(line)
            time.sleep(1)
    
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Apr 2025, 18:49 last edited by
      #2

      Hi and welcome to devnet,

      Where are you using Qt in your system ?
      As per your code, I would say never so it would be better if you explained exactly what runs where and what exactly are you using.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      2/2

      20 Apr 2025, 18:49

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved