The idea is based on the fact that the lines of the bar code have different thicknesses and this could be scanned to produce unique time intervals across the entire bar code design.
In the figure below we see the circuit design for creating unique 7 segment outputs in response to the opamp sensor feed.
In the proposed barcode security lock circuit, a 4033 IC which is a 7 segment decoder is used with a IC 555 clock generator for generating the unique results in response to the barcode.
Pin4 of the IC 555 is connected with the opamp sensor output which implies that the IC 555 will be active and run the IC 4033 only for the white spaces on the barcode, since the white spaces are supposed to create high logic pulses across the opamp output will keep the IC 555 pin4 reset pin activated during these periods.
And while the IC 555 is clocking, IC 4033 would be busy creating the BCD sequences across its output pins, and across the black lines of the barcode this sequence generation will stay inhibited.
Now in order to get a uniform and consistent outputs from the IC 4033 for individual barcode, the barcode card needs to be swiped using a motor mechanism or a solenoid mechanism with a regulated constant speed and not with hand.
The motor could be operated with a set/reset mechanism such that it moves the entire barcode length in front of the laser/LDR assembly.
The motor switch ON could initiate the opamp circuit which then starts sensing the barcode pulses to transform it into a PWM form.
This PWM is quickly responded by the IC 555/4033 circuit until the entire barcode is read.
As soon as the reading ends the outputs of the 4033 stay latched with a unique set of high and low outputs.
These outputs can be individually configured with relay mechanisms in order to activate an electrical lock, a gate, or any intended security system.
A 4 input NAND gate IC 4012 could be used and configured with any four selected unique outputs of the decoder for activating a security relay.
If 3 high outputs are selected then one of the NAND inputs could be shorted to the positive supply.