GM67 Bar Code Reader Module

Hello,

I am trying to read the output of the GM67 barcode reader using uart bus.

I have a NodeMCU ESP8266, which already reads the value of 2 pins for 2 binary sensors.

I’m trying to, at least debug the uart bus, however there is nothing in the logs. The config looks like this:

uart:
  tx_pin: D1
  rx_pin: D2
  id: uart_bus
  baud_rate: 9600
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);
logger:
  baud_rate: 0
  level: VERY_VERBOSE
  hardware_uart: UART1

I tried adding this: Custom UART Text Sensor — ESPHome but with no luck, still nothing in the logs (VERY_VERBOSE level).

I tried switching pins to TX and RX, manually telling the logger to use UART1, but I still have nothing on the logs.
Am I missing something obvious? (yes, the GM67 Bar Code has been setup to use the TTL 232 Interface… this sets: Serial port related configuration: Baud rate:9600, Data bit:8, Verification: No, Stop bit:1)

Thank you

EDIT: start logs with logger on UART1 and uart pins TX and RX:

[15:32:07][V][wifi:359]:   Priority: 0.0
[15:32:07][C][wifi:361]:   Channel: 6
[15:32:07][C][wifi:362]:   Subnet: 255.255.255.0
[15:32:07][C][wifi:363]:   Gateway: 192.168.1.254
[15:32:07][C][wifi:364]:   DNS1: 0.0.0.0
[15:32:07][C][wifi:365]:   DNS2: 0.0.0.0
[15:32:07][C][logger:233]: Logger:
[15:32:07][C][logger:234]:   Level: VERY_VERBOSE
[15:32:07][C][logger:235]:   Log Baud Rate: 0
[15:32:07][C][logger:236]:   Hardware UART: UART1
[15:32:07][C][uart.arduino_esp8266:100]: UART Bus:
[15:32:07][C][uart.arduino_esp8266:101]:   TX Pin: GPIO1
[15:32:07][C][uart.arduino_esp8266:102]:   RX Pin: GPIO3
[15:32:07][C][uart.arduino_esp8266:104]:   RX Buffer Size: 256
[15:32:07][C][uart.arduino_esp8266:106]:   Baud Rate: 9600 baud
[15:32:07][C][uart.arduino_esp8266:107]:   Data Bits: 8
[15:32:07][C][uart.arduino_esp8266:108]:   Parity: NONE
[15:32:07][C][uart.arduino_esp8266:109]:   Stop bits: 1
[15:32:07][C][uart.arduino_esp8266:111]:   Using hardware serial interface.
[15:32:07][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Ajouter'
[15:32:07][C][gpio.binary_sensor:016]:   Pin: GPIO0
[15:32:07][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Consommer'
[15:32:07][C][gpio.binary_sensor:016]:   Pin: GPIO2
[15:32:07][C][ota:082]: Over-The-Air Updates:
[15:32:07][C][ota:083]:   Address: 192.168.1.154:8266
[15:32:07][C][ota:086]:   Using Password.
[15:32:07][C][api:134]: API Server:
[15:32:07][C][api:135]:   Address: 192.168.1.154:6053
[15:32:07][C][api:139]:   Using noise encryption: NO
[15:32:07][C][mdns:084]: mDNS:
[15:32:07][C][mdns:085]:   Hostname: barcode
[15:32:07][V][mdns:086]:   Services:
[15:32:07][V][mdns:088]:   - _esphomelib, _tcp, 6053
[15:32:07][V][mdns:090]:     TXT: version = 2022.1.2
[15:32:07][V][mdns:090]:     TXT: mac = 40915145fd19
[15:32:07][V][mdns:090]:     TXT: platform = ESP8266
[15:32:07][V][mdns:090]:     TXT: board = nodemcuv2

My working config:

external_components:
  - source:
      type: git
      url: https://github.com/ssieb/custom_components/
    components: [ serial ]

text_sensor:
  - platform: serial
    name: ${description} Bar Code

uart:
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: false
      after:
        delimiter: "\n"
      sequence:
        - lambda: UARTDebug::log_string(direction, bytes);
    tx_pin: GPIO17
    rx_pin: GPIO16

Simone

1 Like

I tried using your working config for my bar code scanner. The scanner is a different model, but I don’t think that is an issue as I can see the bar codes I scan show up in the logs. What I am not seeing is the scanned code in home assistant. The text sensor just stays at unknown all the time in Home Assistant. It seems like I am close to having it working I just don’t know esphome well enough to figure out what to adjust. I tried changing the delimiter in the uart section to \r as that shows up in the logs, but it didn’t help.

My log shows:

[11:37:10][D][uart_debug:158]: <<< "850020433223\r"

Which is the correct bar code I am testing with. Any Ideas how to make the text sensor update?

Hi @Lakefire,

did you have any success and can share your solution with us?

Thanks in advance!
Aaron

@Lakefire @boardnick0815

Not sure it this is still relevant to you, but I had the same problem: values weren’t sent to Home Assistant. I created the lambda code myself. So no need for the external component. This is my working code:

Edit: added a character count to avoid misscans. Bar code is 13 characters, but 14 are read from the uart including the r.

uart:
  id: uart_bus
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600
  debug:
    direction: BOTH
    dummy_receiver: true
    after:
      delimiter: "\n"
    sequence:
      - lambda: |-
          UARTDebug::log_string(direction, bytes);
          std::string str(bytes.begin(), bytes.end());
          int nuberCount=strlen(str.c_str());
          if (nuberCount==14) { id(barcode).publish_state(str.c_str()); }

text_sensor:
  - platform: template
    id: barcode
    name: Barcode