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

**URL:** <https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041>\
**Category:** General Guidance\
**Created:** [May 7, 2023, 12:34am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041 "2023-05-07T00:34:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 12:34am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/1 "2023-05-07T00:34:44Z")

</div>

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.

```plaintext
#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);
  }

}

```

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 12:40am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/2 "2023-05-07T00:40:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 12:41am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/3 "2023-05-07T00:41:34Z")

</div>

sorry, what do you mean with sub-systems?

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 12:43am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/4 "2023-05-07T00:43:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![qubits-us](https://avatars.discourse-cdn.com/v4/letter/q/5daacb/32.png) [@qubits-us](https://forum.arduino.cc/u/qubits-us)\
**Post date:** [May 7, 2023, 12:45am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/6 "2023-05-07T00:45:49Z")

</div>

doing a SoftwareSerial on hardware Serial1??

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [May 7, 2023, 12:47am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/7 "2023-05-07T00:47:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 12:50am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/8 "2023-05-07T00:50:23Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 12:55am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/9 "2023-05-07T00:55:03Z")

</div>

> [@leshug1n](#):
>
> the wiring diagram is simple, only requires vcc,gnd,tx and rx, tx and rx are in pins 19 and 18.

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.

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 12:56am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/10 "2023-05-07T00:56:31Z")

</div>

> [@leshug1n](#):
>
> the function mySerial.available is not being activated

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

---

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 1:01am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/11 "2023-05-07T01:01:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 1:03am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/12 "2023-05-07T01:03:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![qubits-us](https://avatars.discourse-cdn.com/v4/letter/q/5daacb/32.png) [@qubits-us](https://forum.arduino.cc/u/qubits-us)\
**Post date:** [May 7, 2023, 1:04am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/13 "2023-05-07T01:04:26Z")

</div>

and of course your code looks like this now??

```cpp
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

---

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 1:06am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/14 "2023-05-07T01:06:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 1:07am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/15 "2023-05-07T01:07:18Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 1:12am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/16 "2023-05-07T01:12:28Z")

</div>

![mega](https://europe1.discourse-cdn.com/arduino/original/4X/b/8/8/b881f18f6fed944e1d119471feb9c8e27b86491a.png)  
there is the circuit diagram. tx and rx are in pins 19 and 18

---

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 1:13am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/17 "2023-05-07T01:13:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![leshug1n](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leshug1n/32/933178_2.png) [@leshug1n](https://forum.arduino.cc/u/leshug1n)\
**Post date:** [May 7, 2023, 1:17am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/18 "2023-05-07T01:17:47Z")

</div>

![connections.](https://europe1.discourse-cdn.com/arduino/original/4X/b/c/2/bc2c3dc4947e7765bd742e1b977d9247de1397c6.jpeg)  
and there is my connections

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 1:20am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/19 "2023-05-07T01:20:30Z")

</div>

> [@leshug1n](#):
>
> i put the configuration the manual indicates to serial communication

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

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [May 7, 2023, 1:26am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/20 "2023-05-07T01:26:18Z")

</div>

> [@leshug1n](#):
>
> here is my connections

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

---

<div class="post-metadata">

**Author:** ![qubits-us](https://avatars.discourse-cdn.com/v4/letter/q/5daacb/32.png) [@qubits-us](https://forum.arduino.cc/u/qubits-us)\
**Post date:** [May 7, 2023, 1:26am UTC](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041/21 "2023-05-07T01:26:56Z")

</div>

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

3 yellow is going to 19??

sorry.. ~q

[Next page](https://forum.arduino.cc/t/problem-communication-between-arduino-mega-and-bar-code-reader-module-gm65/1124041.md?page=2)
