How to Interface Barcode Scanner Module with Arduino

How to Interface Barcode Scanner Module with Arduino

To test any barcode scanner you can connect the scanner to USB port of PC & Open NOTEPAD or Microsoft WORD.
Scan any barcode to see the code printed on notepad window.
As you connect BARCODE SCANNER to PC it is considered as HID device (like mouse or keyboard) and any result from device will be printed on Notepad.
For connecting the scanner with Arduino you need an USB HOST Module.

CONNECTIONS BETWEEN SCANNER MODULE WITH ARDUINO:-

RXD of host connected to Tx of Arduino
TXD of host connected to Rx of Arduino
Power to scanner taken from Arduino 5v pin
Gnd to Gnd

HOW TO UPLOAD PROGRAM:-

While uploading code , remove connections at Rx/Tx pins.After upload successful connect back the pins.

CODE:-

int count = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if(Serial.available())
{
count = 0;
while(Serial.available())
{
char input = Serial.read();
Serial.print(input);
count++;
delay(5);
}
Serial.println();
}
}

Subramanian
Subramanian

Subramanian MK, currently serving as a workshop instructor at Sakthi Polytechnic College, Erode Tamil Nadu. With a career spanning 25 + years, Subramanian MK has dedicated himself to advancing knowledge in Electronics and Communication Engineering (ECE). His passion for exploring new technologies has led to the development of numerous projects, showcasing expertise in IoT and PCB design.

Articles: 510

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

×

Hi, How can I help you?

×