
GM65 Barcode Scanner Library for Proteus Simulation

Hello friends, I hope you all are doing great. Today, I am going to share the new GM65 Barcode Scanner Library for Proteus Simulation. The GM65 is the small camera scanner you find in kiosks, vending machines and hobby checkouts: it reads ordinary product barcodes and QR codes and sends the text over a UART. With this library you can run a full Proteus simulation of that scanner, talk to it with an Arduino, set it up with its command frames and their CRC, and read every code it decodes.
GM65 Barcode Scanner Library for Proteus
Latest version: V1.0 (December 2026, this tutorial)
Helping Tools
- Serial Monitor Advance: a serial terminal window for the UART of your board
- Serial Monitor Expert: the serial monitor with extra debugging tools
- LCD Library for Proteus V3.0: 16x2, 20x4 and I2C LCDs to show your readings
The demo is a small shop checkout: an Arduino UNO V4.0 switches the scanner to serial output, puts it in continuous mode, then looks up every product it reads, shows the item and the running total on a 16x2 LCD, lights a green LED for a product and a red LED for an unknown code - and a payment QR code closes the bill.
NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the optical sensors board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the GM65 Barcode Scanner Library for Proteus Simulation:
What Is the GM65 Barcode Scanner?
The GM65 comes in two parts. The scan engine is a small black block, 21.4 x 11.8 x 13.5 mm, with a CMOS image sensor of 648 x 488 pixels behind a window, a white illumination LED and a red aiming LED. It plugs into a carrier board, 27.5 x 36 mm, that adds a round buzzer, a button, a status LED and two 4-pin connectors - one for USB and one for a UART. Together they measure 46.8 x 27.5 mm.
Because it is a camera and not a laser, it reads 2D codes as well as 1D barcodes: EAN-13, EAN-8, UPC-A and UPC-E, Code 128, Code 39, Code 93, Codabar, the 2 of 5 family, Code 11, MSI and DataBar, and the 2D codes QR, Data Matrix and PDF417. It reads them on paper and on phone screens, at any rotation, from about 4 to 25 cm for a normal product barcode.
- Supply 5 V (4.2 - 6.0 V); about 30 mA in standby and 160 mA while scanning.
- The UART connector: 5V, TX, RX, GND.
- The white light and the red aimer come on only while it reads, unless you set them to always on or off.
- A short beep and the status LED on every good read.
The Serial Interface - and Its Trap
The UART runs at 9600 baud, 8N1, from the factory, and any of 1200 to 115200 can be set. A decoded code comes out as plain text followed by a tail - a carriage return (0x0D) unless you change it - so a sketch simply collects bytes until the CR.
The trap: the GM65 leaves the factory as a USB keyboard. Only one interface works at a time, so a brand-new scanner on a UART beeps and flashes on every code and sends nothing at all on TX. You have to switch it to serial output first, by scanning the "TTL output" code in the manual or by writing 0x00 to register 0x000D over the UART. The library starts exactly like a new scanner, so the demo sketch has to do that too.
The Command Frame and Its CRC
Settings live in registers of one byte each, and the host reads and writes them with one frame format:
- 7E 00 - the start.
- The type: 07 read, 08 write, 09 save to the EEPROM.
- The length, then the 16-bit address, high byte first.
- The data - for a read, the number of bytes wanted.
- A CRC-16/CCITT over type .. data (polynomial 0x1021, start 0), high byte first - or AB CD, which tells the scanner not to check.
Every write and the save answer 02 00 00 01 00 33 31; a read answers 02 00 00, the count, the data and its CRC. A frame with a wrong CRC, a bad type or a gap of more than 400 ms gets no answer at all - silence is the error message. For example, continuous mode with the LED and the beep on is 7E 00 08 01 00 00 D6 DF 22, and serial output is 7E 00 08 01 00 0D 00 02 C5.
The Registers and the Four Modes
- 0x0000: the good-read LED (bit 7), the beep (bit 6), the aimer (bits 5-4), the light (bits 3-2) and the mode (bits 1-0).
- 0x0002: writing 1 starts a scan in command mode.
- 0x0004 / 0x0005 / 0x0006: the image stabilisation, the read interval and the single-read time, in 0.1 s steps.
- 0x000D: the interface - 00 TTL serial, 01 USB keyboard.
- 0x002E ... 0x003F: one byte per code type; bit 0 enables it.
- 0x0060: the tail - CR, CR LF, TAB or none.
- 0x00E0 - 0x00E5: the model, the hardware and software versions and the date, read-only.
The mode decides when it scans. In manual mode it reads while the button is held. In command mode it reads after the host writes 1 to 0x0002, until it decodes or the single-read time (5 s) ends. In continuous mode it reads all the time, waiting the read interval (1.0 s) between reads. In induction mode it watches the brightness, and when the scene changes it waits the stabilisation time and reads.
Features of the GM65 Library
- A real-looking module: the carrier board and the scan engine at their true size; the aimer and the white light glow while it scans and the status LED flashes on a good read.
- The protocol of the manual: read, write and save frames with the CRC-16 or AB CD, the acks, and silence on a bad frame.
- The registers: the four modes, the trigger, the timings, the interface, the code enables, the tail and the version registers.
- The USB keyboard start: nothing on TX until 0x000D is 0 - with a warning in the pop-up for every code that is lost.
- Codes: EAN-13, EAN-8, Code 128 and QR codes, from a recorded checkout or a steady code.
- A pop-up: the code in front of the camera, the registers, the last command and reply in hex; graphs, an event log and a check page.
- A complete package: about 2.4 MB with the library, our I2C LCD, resistors and LEDs, our Arduino UNO V4.0 and the demo, without the source code of the model.
The GM65 in Proteus
The device is GM65TEP in TEPGM65.LIB, under Modules > Sensors, with the model TEPGM65.DLL. Search GM65 or barcode in Pick Devices. Its four pins are the UART connector. Its properties: PROFILE (DEMO or STEADY), CODE - the text of a steady code - IFACE, the interface at power-up (USB as from the factory, or SERIAL) and BAUD.
Download GM65 Barcode Scanner Library for Proteus Simulation
Click the button below to download GM65-Barcode-Scanner-Library-for-Proteus-v1.0.zip (about 2.4 MB, without the source code of the models):
GM65 Barcode Scanner Library for Proteus V1.0- README.txt: installation, the demo, the wiring, troubleshooting and the limits of the simulation.
- Proteus Library Files:
TEPGM65.LIB,TEPI2CLCD16X2.LIB,TEPRESISTOR.LIB,TEPLED5MM.LIBandArduinoV4TEP.LIB. - Proteus Model Files:
TEPGM65.DLL,TEPLCD.DLL,TEPRESISTOR.DLL,TEPLED5MM.DLLandTEPARDUINO.DLL. - Arduino Code: the demo sketch (Wire and AltSoftSerial).
- Proteus Simulation: the demo project, its HEX file and copies of the DLLs.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install GM65 Barcode Scanner Library for Proteus Simulation
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy the files from Proteus Model Files into the MODELS folder.
- Delete
TEPGM65.IDXfrom the LIBRARY folder if it is there. - Start Proteus, press P and search for GM65.
Proteus Simulation of a Shop Checkout
The demo uses an A4 sheet with our Arduino UNO Library for Proteus V4.0. The scanner (U1) talks to the UNO through AltSoftSerial: its TX to D8, its RX to D9, at 9600 baud. Its IFACE property is USB, so it starts like a new scanner - as a USB keyboard. A 16x2 LCD from our I2C LCD 16x2 Library for Proteus sits on the I2C bus at 0x27; a green LED on D5 lights for a product found and a red LED on D6 for a code the shop does not know. The Arduino's monitor is built in, the same window as our TEP Serial Monitor Advance for Proteus. Open GM65-Checkout-ArduinoUnoV4.pdsprj.
The DEMO is a recorded checkout, played in fast time: a carton of milk, a loaf of bread, a book, a pack of chewing gum, a product with a code that is not in the shop's table and a second carton of milk pass the camera half a second each, and then the customer shows the payment QR code "TEP-PAY".
The Sketch
The CRC is a few lines; the sketch computes it for every frame it sends:
uint16_t crc16(const byte* d, byte n) { // CRC-16/CCITT: polynomial 0x1021, start 0, over type .. data
uint16_t c = 0;
for (byte i = 0; i < n; i++) { c ^= (uint16_t)d[i] << 8; for (byte b = 0; b < 8; b++) c = (c & 0x8000) ? (c << 1) ^ 0x1021 : c << 1; }
A frame of one data byte is nine bytes, and the CRC covers the five from the type to the data:
byte f[9] = {0x7E, 0x00, type, 0x01, (byte)(addr >> 8), (byte)addr, data, 0, 0};
const uint16_t c = crc16(f + 2, 5);
At start-up it waits half a second for the scanner to boot, then writes three registers and checks each ack - serial output first, without it nothing else would ever arrive:
const bool serialOut = writeReg(0x000D, 0x00); // USB keyboard -> TTL serial: the codes come out on TX
const bool interval = writeReg(0x0005, 5); // the read interval: 0.5 s
const bool cont = writeReg(0x0000, 0xD6); // continuous mode, LED + beep on, aimer + light normal
The read interval matters in continuous mode: the scanner waits it after every read. With the factory's 1.0 s and products coming every second, each read would start a little later than the last, and by the fourth product the scanner would miss one. Half a second keeps up and still reads each product only once. Then it reads the versions from 0x00E1, checks the reply's CRC and saves the settings. In the loop it collects characters until the CR and looks the code up in its table:
if (c == '\r') { code[cn] = 0; if (cn) handleCode(); cn = 0; }
GM65 Simulation Results
Open the project and press Run. The demo runs 7.9 simulated seconds and took about 2 minutes 31 seconds on our PC with the pop-up open and the pictures being taken. Click U1 for its pop-up. Every number below comes from one simulation run, the demo exactly as it ships.
Set-Up
The scanner boots in 0.3 s - as a USB keyboard in manual mode, the way it leaves the factory: the Event log says "booted: manual mode, USB keyboard output". The sketch waits half a second, then talks to it. At 699.9 ms 0x000D = 0x00 switches the interface to TTL serial, the next write makes the read interval 0.5 s, and at 737.1 ms 0x0000 = 0xD6 sets continuous mode with the LED and the beep on. Each write is answered 02 00 00 01 00 33 31. At 756.1 ms the sketch reads two bytes from 0x00E1 - the reply carries 64 6E, versions 1.00 and 1.10 - and at 776.6 ms it saves the settings: the pop-up's last command is the save frame 7E 00 09 01 00 00 00 DE C8. The monitor confirms "Serial output on, interval 0.5 s ok, continuous mode ok" and "Scanner HW 1.00, SW 1.10; settings saved". In continuous mode the white light and the red aimer stay on - on the sheet the aimer's dotted line points out of the window.
The First Product
At 1.6 s the milk carton comes in front of the camera. 0.15 s later the scanner decodes its EAN-13, 5901234123457, and sends the thirteen digits and a CR - the Event log has it at 1.752 s. The sketch finds it in its table: the monitor prints "1.70 s 5901234123457 Milk 1 L 1.20 total 1.20", the green LED flashes and the LCD shows the item and the total. The pop-up at 2.0 s still has the carton in view, but the scanner does not read it again: the read interval runs until 2.25 s, and the carton is gone at 2.1 s.
A Book
The bread follows at 2.751 s and the book at 3.751 s - each one second after the last, the product's arrival plus the 0.15 s decode. At 3.9 s the pop-up draws the book's barcode, 9780201379624, with the last read under it: three codes read, five commands and five replies. The LCD shows "Book 12.99" and "3 items 16.69", and the green LED is on.
An Unknown Code
The chewing gum carries an EAN-8, 96385074, read at 4.750 s: 0.99, total 17.68. Then comes a product whose code, 8901030865275, is not in the shop's table. The scanner neither knows nor cares - it decodes it at 5.750 s like any other and sends it. It is the sketch that cannot find it: the monitor prints "UNKNOWN - not in the product table", the red LED lights and the LCD shows "Unknown code!" with the digits. The pop-up at 5.9 s shows it as the fifth code read.
The Same Product Again
At 6.6 s a second carton of milk passes. It has the same code as the first and is read at 6.750 s - the read interval only spaces the reads in time, so the same product a few seconds later is read normally. The sketch counts it: "Milk 1 L x2 1.20 total 18.88". The pop-up at 6.9 s shows six codes read.
The Payment QR Code
Last, at 7.6 s, the customer shows the QR code "TEP-PAY" on a phone. QR codes are enabled from the factory (0x003F), so it is decoded at 7.750 s like the barcodes. The sketch closes the bill: "QR "TEP-PAY": 5 items, total 18.88 - PAID, next customer"; the LCD reads "PAID 18.88" and "Thank you!", and the bill starts again from zero. The pop-up at 7.9 s draws the QR pattern - seven codes read, five commands, five replies, nothing rejected and nothing lost.
The Graphs, the Event Log and the Check Page
The Graphs page plots when the scanner was scanning, when a code was in front of the camera and the number of codes read. The Event log lists every command with its result and every code decoded. The Check page sums up the run: the supply at 5.00 V; the output TTL serial, every one of the 7 codes sent on TX; 5 commands, 5 replies and none rejected; continuous mode with the read interval 0.5 s and the single-read time 5.0 s; and the UART at 9600 baud 8N1 with no framing errors.
The Arduino's built-in serial monitor prints the set-up in three lines - the three register writes, the versions and the save - then one line for every code: the time, the code, the product and its price and the running total, a line of its own for the unknown code and the payment line at the end. Its times come from millis(), which starts when the sketch starts, a few hundredths of a second after the simulation does.
Barcode or RFID?
A barcode costs nothing - it is printed on the packet already - but it has to be in sight of the camera. An RFID tag, as in our MFRC522 RFID Library for Proteus or our EM18 RFID Library for Proteus, is read through a wallet or a box and cannot be copied with a photocopier, but every item needs a tag. For products, books and tickets the barcode or QR code wins; for door cards and key fobs RFID does.
Try It Yourself
- Click U1 while the simulation runs and use the chips: Show EAN-13, Show QR code, Nothing.
- Remove the 0x000D write from the sketch: the scanner still decodes every code - the pop-up counts them as lost - but nothing reaches the UNO.
- Change 0x0005 back to 10 (1.0 s): watch the reads drift later until a product is missed.
- Use command mode (0xD5) and send the trigger frame 7E 00 08 01 00 02 01 AB CD when a button is pressed.
- Spoil one CRC byte in sendFrame(): the scanner stays silent and the pop-up counts the command as rejected.
Ideas to Extend the Demo
- Keep the product table on an SD card and the bill on a small printer.
- Read QR tickets at a gate and open a servo barrier for a valid one.
- Count stock: scan each shelf item and send the counts over Wi-Fi.
Your Own Sketches
The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.
Things to Know Before Using a Real GM65
- Serial output first: write 0x00 to 0x000D and save (type 09), or the settings are lost at power-off.
- Repeats: continuous mode reads the same code again after the read interval - ignore repeats or lengthen it.
- Distance: hold the code 5 - 20 cm from the window; glossy labels read better at a slight angle.
- Power: about 160 mA while scanning at 5 V.
- Lengths: codes have different lengths - always read until the tail.
Troubleshooting
- Nothing arrives at all: it is still a USB keyboard - write 0x00 to 0x000D.
- No answer to a command: a wrong CRC (use AB CD while testing) or TX and RX swapped.
- A product counted twice: the read interval is shorter than the time it stays in front of the camera.
- A code is never read: its type is switched off in its enable register.
- The part is not simulated:
TEPGM65.DLLis missing from MODELS and from the project folder.
Limitations of the Simulation
- The frames, the CRC, the acks, the registers, the modes, the interface and the tail follow the user manual; the module is our own drawing.
- Our own figures: manual mode and USB keyboard at power-up (the manual's two defaults disagree), 0.3 s to boot, 0.15 s to decode, the versions HW 1.00 / SW 1.10, 30 mA and 160 mA.
- The DEMO is a recorded checkout in fast time.
- Not modelled: the image itself (print quality, angle, distance), the USB side, prefixes, suffixes and Code IDs, the other code types.
- Arduino is a name of Arduino; this library is not made or endorsed by Arduino, Labcenter or the maker of the GM65.
- Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.
So, that was all about the GM65 Barcode Scanner Library for Proteus Simulation. I hope it helps you build your own checkout, ticket gate or stock counter. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!






















Comments
0