Giter VIP home page Giter VIP logo

gm60_micropython's Introduction

GM60 barcode scanner driver for MicroPython and ESP32

Background

To make the GM60 barcode scanner work with an ESP32 using MicroPython, a driver is needed to handle the input/output to the scanner. The driver folder contains this driver, further development resources are located in the docs folder. This driver is used in another project for inventory handling using Grocy, a great software project.

Features

  • Comfortable I/O commands make working with the datasheet easier
  • CRC support for incoming and outgoing packets

Example usage

See example.py for runnable commands.

# Load driver
>>> from gm60_micropython import GM60_Driver


# Initialize UART connection to GM60 barcode scanner
    # UART port/naming hint:
    # GM60 RX (green cable) needs to be connected to ESP32 TX (e.g. here pin 25)
    # GM60 TX (yellow cable) needs to be connected to ESP32 RX (e.g. here pin 26)
>>> scanner = GM60_Driver(rx=26, tx=25)


# Prints hardware and software version information
>>> scanner.get_version()
{'hardware': 1.0, 'software_date': '2021-09-16', 'software': 1.08}


# Resets scanner back to factory settings
>>> scanner.reset_to_factory_defaults()


# Prints register settings in hexadecimal and binary format for easier development
>>> scanner.get_register_settings(0x0000)
(['0x8e'], ['0b10001110'])


# Set LED always on
>>> scanner.set_register_settings(0x0000, 0b10001110)

# Set LED to maximum brightness
>>> scanner.set_register_settings(0x0015, 0x63)

# Read barcode from sensor
>>> scanner.read_barcode()
'4066447241358'

Circuit diagram for GM60 and ESP32

Photo of GM60 and ESP32 proof-of-concept build

References

See docs/references.md for other projects using the GM60 barcode scanner. Linked there also is the GM60 datasheet for future reference.

gm60_micropython's People

Contributors

foo-git avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.