Problem-communication between arduino mega and bar code reader module "gm65"

Hello guys so i try to scan QR code with the module "GM65" and arduino Mega, but is not working.
i have already configurated the module to communicate by Serial port. what am i doing wrong?
There is the code.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(19, 18); // RX, TX

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  pinMode(19, INPUT);
  pinMode(18, OUTPUT);
  Serial.print("scanner initialized");
}

void loop() {
  if (mySerial.available()) {
    byte x = mySerial.read();
    Serial.println(x);
  }

}

Did you test any sub-systems before trying the entire sketch?

sorry, what do you mean with sub-systems?

I didn't realize your code was so short. Please post:

  • a wiring diagram
  • a link and/or specifications of the scanner

Also be specific about the problem - what happens or doesn't happen?

doing a SoftwareSerial on hardware Serial1??

1 Like

Use hardware serial instead, on the correct pins.
Serial1.begin(9600);

1 Like

the wiring diagram is simple, only requires vcc,gnd,tx and rx, tx and rx are in pins 19 and 18.
there is the manual with specifications:
chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://uelectronics.com/wp-content/uploads/2022/03/GM65-Barcode-reader-mudule-User-Manual.pdf
And the main problem, is that the serial monitor is not showing nothing, the function mySerial.available is not being activated

Nevertheless, please draw it. We often see errors between the thought and the execution.

Please fix the broken link. There is an icon in the posting window for URL posting. I see now that it works in spite of the bad formatting. Still we need the wiring.

We've already established that you don't need it at all.

ok sorry
https://uelectronics.com/wp-content/uploads/2022/03/GM65-Barcode-reader-mudule-User-Manual.pdf

Along with a wiring diagram, please post close up images of your connections. The unit can be configured with bar codes from the manual. How much of that have you done, since it came out of the box?

and of course your code looks like this now??

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);

  Serial.print("scanner initialized");
}

void loop() {
  if (Serial1.available()) {
    byte x = Serial1.read();
    Serial.println(x);
  }
}

~q

yes, i configure it to communicate in 9600 bps to serial port, i dont know if it needs other configuration additionally

Why don't you know? Isn't that what the manual is for?

If you aren't going to post a diagram and images, I'll be out of here...

1 Like


there is the circuit diagram. tx and rx are in pins 19 and 18

and about the manual... i put the configuration the manual indicates to serial communication


and there is my connections

Yes, but there are a lot more settings. You really need to check them all.

To my eye, you have TX1 connected to TX on the module...

1 Like

looks like RX and TX are reversed..
1 power
2 TX
3 RX
4 GND

3 yellow is going to 19??

sorry.. ~q