QR scanner give unprintable word in Serial monitor

Hello everyone, Here I come with the new different issue,

I try to interface the QR scanner module with teensy4.1 through MAX232,

in detail:
in teensy4.1 I am using UART5, this UART connection is given to the MAX232 T1IN and R1out, and the output of MAX232 is connected to the QR scanner module,

I set the baud rate (in the code and serial monitor) as 115200 for both teensy4.1
and the scanner

But I am getting unprintable words in the serial monitor.

Please anyone say how to rectify it

#include <Arduino.h>

#define QR_SERIAL Serial5

void setup()
{
  Serial.begin(9600);    
  QR_SERIAL.begin(115200); 
}

void loop()
{
  while (!QR_SERIAL.available())
  {
    Serial.println("Waiting for QR code...");
    delay(5000);
  }

  String qrData = "";
  while (QR_SERIAL.available())
  {
    char c = QR_SERIAL.read();
    qrData += c;
    delay(2);
  }
  qrData.trim();
  Serial.println("QR Code Data: " + qrData); 
}

Here is the product link:
teensy4.1 => teensy4.1
Scanner module => Scanner_module

My output: ��j��i�

I would check to see what data type the QR library read function returns as a first guess.

I am not using a QR library, I am directly read data from the QR scanner module Serial.read(). However, I'm getting unprintable characters (?) instead of valid data. Could this be related to baud rate, data format, configuration, or encoding issues?

Is baud rate of the Serial device the same as the sketch (9600)?

Oops, sorry I missed the use of Serial5 as the serial port for your QR code scanner.

The "datasheet" for the QR scanner available from the website you linked to doesn't indicate a default baud rate or the format of the data that the QR scanner outputs. A quick google search didn't provide many clues either.

Do you have a more detailed user manual for the scanner?

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