Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

TTL barcode reader, electric pulse

Status
Not open for further replies.

erpgc82

Junior Member level 1
Joined
Mar 21, 2021
Messages
17
Helped
0
Reputation
0
Reaction score
1
Trophy points
3
Activity points
228
Hello friends, I'm new to programming, but in 1 year I've acquired enough knowledge to make 2 firmwares and everything works accurately, and help from you here. I'm happy.

But I'm trying to accomplish a technical feat, a child's dream! Find out how this reader works and make it work!
:)

I work with access control equipment, which have a barcode reader. This barcode reader only has 3 pins, GND +5V and Signal.

The barcode reader reads when the code passes through the reader in a horizontal movement. Some things influence reading as an example: The speed at which the person will pass the code through the reader's beam.

The point is, I don't know where to start. I've seen in some manufacturers they use a normal PIC pin like RA2 example, no specific pin.

I think the reading is done by converting electrical signals into binary numbers and then converting them into a decimal number.

Someone experienced, could you guide me on how to "try" to start?

Thanks!
 

Basically, when the scanner passes a black area it's a ZERO and when it passes a white area it's a ONE. (Maybe the other way around, but you get the point). The fundamental assumption is that the scan occurs at a constant speed, so that you can determine relative high/low times; speed is irrelevant. Knowing that, you can infer the ONES and ZEROS from the stream of high and low data.

It's actually a little more complex than that, but this explains more:
https://en.wikipedia.org/wiki/Universal_Product_Code
 

Basically, when the scanner passes a black area it's a ZERO and when it passes a white area it's a ONE. (Maybe the other way around, but you get the point). The fundamental assumption is that the scan occurs at a constant speed, so that you can determine relative high/low times; speed is irrelevant. Knowing that, you can infer the ONES and ZEROS from the stream of high and low data.

It's actually a little more complex than that, but this explains more:
https://en.wikipedia.org/wiki/Universal_Product_Code
Hello barry, I called the oscilloscope and a network module that I can monitor via software.

I tested several codes, with 6 digits.

In the software, serial monitor, I get only 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, always 20 hex and always in an average time between 60 68 72 92 milliseconds, depending on the way it I pass the code into the slot of the bar reader.

The only difference is that when I step slower or faster, the time in milliseconds to reach 00 changes, but always the beginning and the end are longer. But it's always 20 hex, which arrives on the serial monitor. Note, it's not UART, it's electrical pulses.

In the oscilloscope, the waves are square, and at the beginning and at the end they remain at a low level for a longer time.

I'm thinking about creating a logic, which may not be good, but it's a start: Monitor a pin for 100ms, and for 50 times, ie every 2ms I see if the pin is at High or Low level.

Once he's at a low level, it's obvious. If it's low level I store '0' in an array of 50, if it's high level I store '1' in another address of this array. That way I'll have 50 binary numbers to work with, and convert to decimal numbers. :-D
 

My guess is your barcode reader has a built in MCU and what it sends out is serial bytes. Most readers produce TTL level 8N1 format serial data or they produce a signal emulating a keyboard so you can plug them into a PC keyboard socket and read the same as though the barcode digits had been entered manually.

Brian.
 

My guess is your barcode reader has a built in MCU and what it sends out is serial bytes. Most readers produce TTL level 8N1 format serial data or they produce a signal emulating a keyboard so you can plug them into a PC keyboard socket and read the same as though the barcode digits had been entered manually.

Brian.
Hi Brian.

I noticed that the electrical pulse ranges from 0 to 2v, but these are not serial characters, they are actually electrical pulses, as I see it. I just got thoughtful, because the ethernet shield, with serial monitor software, reads hex codes 00 00 00 00 00 00 00 00 00.

If it were just electrical pulses would I have this result too? It seems to me that they are serial characters, but because I get exactly 20 times 0x00

This is my first contact with this, and I have only 1 year or less of programming, what would be TTL level 8N1?
 

Hi,

Did you ever mention the bar code reader manufacturer and type? It should come with a datasheet.

What bar code did you scan? I mean which bar code sceme? What bar code data?

What output do you expect?

You talk about serial data and 8N1, this sound like UART. But for proper UART communication you need to know the baud rate.

Can you show a scope picture if the output signal?

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top