The most important hardware that we used are the four infrared proximity sensors GP2Y0A21YK. Each sensors requires an external supply of 5 Volts. These sensors
detects the hand movements in the space and hence the pattern generated by the user. The sensors are able to detect any obstacle within a range of 10 to 80 cm. We use
this property of the sensors and try to store the pattern generated by the hand that acts as an obstacle. The output of the sensors is an analog output voltage. The
output voltage obtained is 0 volts for the obstacle very near to the sensor and 2.56 Volts for the maximum distance. The analog output is fed to the internal ADC of
the microcontroller that will map the corresponding analog readings to the equivalent digital output. The hardware circuitry also consists of two switches, push button
and toggle switch. One switch is used to accept the pattern from the user when pressed. The toggle switch is used to run the circuit in 'store mode' or the 'check
mode'. In the 'store mode', the circuit accepts the pattern from the user and stores it for further comparison. In the 'check mode', the user again tries to recreate
the stored pattern and check if it matches with the earlier pattern. If the pattern matches, it will indicate that the password is correct and the lock will open. To
indicate the match, we connect the LED to the controller that glows if the pattern matches. The sensors are connected to pins A2, A3, A4 and A5 pins of the
microcontroller. The push button is connected pin B0 and the toggle switch is connected pins B1 and B2.The indicator LED's are connected to pins C0 and C1 of the
The first test was to connect the distance sensors to the internal ADC of the controller and observe the corresponding change in the digital output. Also,
the major issue was to run the four ADC simultaneously. However, this is not possible as the controller does not allow the internal ADC to rum simultaneously. We need
to take a continuous reading from the sensors in the real time, so we run the four ADC after a regular interval of time. Hence, we achieved to take the input from all
the sensors at a small interval of time.
The other issue that we faced was to decide the optimum position of the sensors on the outer box assembly. We first tried to attach the sensors on the four corners
of the box. But later we realized that with the following design, there is a lot of space for the black spots, where the sensor is unable to detect any movement.
Hence, we concluded that this design is not efficient as well as reliable. So, we had to come up with a design that is not only reliable but also has less black spot
and cover maximum area. Then we decide to attach all the four sensors in the horizontal plane at the top of the box as shown in the diagram. This will cover maximum
area and also it will detect the patterns generated easily in the horizontal plane where the user is intended to make the pattern. After deciding the position we
connected the switches and then tested if the desired design was compatible with the algorithm written by us. We also tested the working of the switch and the working
of the LED.
The software part for this project is very important because matching and verification of the pattern is done in the software. The level of security of the system
lies in the software .There are mainly three types of actions to be performed by the software: ADC conversion from the proximity sensors, mode selection and gesture
activation using switches, input reading and pattern matching.
Fig.7 Flowchart for the lock/unlock process
The first task that we focused on while starting the project was to take measurements with the proximity sensors. This involved activating four channels of
the inbuilt ADC's of the microcontroller and creating a loop where the four channels are constantly multiplexed and proximity readings are continuously taken from
them.Here we are using a divide by 128 prescalar and we use internal reference voltage as 2.56V.
Algorithm for four channel ADC multiplexing
Step 1 : Enable first channel of ADC.
Step 2 : Start ADC conversion after setting appropriate prescalar.
Step 3 : Wait until ADC is complete.
Step 4 : Write the higher nibble of ADC to a desired variable.
Step 5 : Turn off current channel and enable the next channel by varying ADMUX.
Step 6 : Repeat for up to four channels.
Repeat the process continuously.
Based on this algorithm, we were able to successfully get the values of distance from the proximity sensor on a scale of 0 to 255 after appropriate conversion of
output voltage in the ADC with a reference voltage.
The next operation we focused on was to implement a toggle switch in the design to toggle the mode of the lock from store mode to check mode. We also added
a push button to start storing or checking the pattern. The lock was programmed in such a way that the input is taken in the appropriate mode based on the state of the
Algorithm for switches and input
Step 1 : Check the state of the toggle switch.
Step 2 : Based on the state, enter the check or store mode.
Step 3 : As long as the push button is pressed, perform ADC conversion and write the readings to the appropriate arrays.
Repeat the process continuously.
Storing and Matching Patterns
This is the most complex part of the project. In this art, the user should be able to create and store a desired pattern and should be able to successfully
authenticate his identity by recreating the stored pattern.
In the store mode, when the push button is pressed, the four channels of ADC's continuously do conversions and write the values to variables b1,b2,b3 and b4
respectively. Due to the overall size of memory available and to avoid a large amount of data to be written to the arrays, we write the values on every tenth
conversion from each channel to the array. After the push button is depressed, the final four arrays are obtained and stored for checking later in the check mode. If
the push button is pressed again, the contents of the arrays are reset and the entire process is repeated again and new values are stored.
Algorithm for store mode
Step 1 : If toggle switch is in store mode, enter store mode.
Step 2 : While the push button is pressed, start ADC conversions in the four channels.
Step 3 : For every tenth cycle, write the value of ADC into the store arrays b.
Step 4 : When the push button is released, stop ADC conversion.
Repeat the process continuously.
In the check mode, the user should be able to recreate the pattern and an algorithm for verifying the pattern with the saved pattern was developed. When the
push button is pressed, the ADC's do conversion and every tenth value of each channel is saved into arrays a1,a2,a3 and a4. After the button is released, the final
array is obtained and now the comparison is done. In the comparison algorithm, we use a linear search across the four arrays. The first elements of all four arrays of
"a" are searched in the corresponding arrays of "b" and if the difference of the values is within a threshold for all four arrays, a line match counter is incremented
and the next elements of arrays "a" is searched from this point in arrays "b". If a match is not found till the end of arrays "b", the reference line is set back to
the last found index of arrays "b" and the next elements of arrays "a" are searched. In this way, the process is repeated until all elements of arrays a1,a2,a3 and a4
are searched. According to the desired level of security, we have set that if at least one fourth of elements in the stored pattern are matched in the checked pattern,
then a match has been found.
Algorithm for pattern matching
Step 1 : Check if the toggle switch is in the check mode.
Step 2 : While the push button is pressed, take ADC measurements and write to arrays a1,a2,a3 and a4 for every tenth reading.
Step 3 : After the button has been released, obtain the final arrays and prepare for pattern matching.
Step 4 : Initialize a line counter for number of matching lines found.
Step 5 : Check if the elements of arrays "a" are found in arrays "b". Here a threshold of 15 is kept for accuracy. If all four elements are found, keep the next element in "b" as reference point and increment the line counter and search for the next elements of "a" in "b" from the reference point. If the elements are not found till the end of "b", search for next element in "a" from the reference point in "b". Repeat this process until all elements in "a" are searched.
Step 5 : If one fourth of the elements in b are matched with the elements in a, then we define that a match has been found. For higher accuracy, we can change this ratio to one third or one half according to the level of security.
Step 6 : Turn on the corresponding LED according to a correct attempt or incorrect attempt.
Speed of Execution
Speed of execution of the program mainly depends on the performance of the controller and its internal processing time of the ADC. The time taken by the ADC
of the controller to convert the analog input from the sensors to the corresponding digital output is the conversion time of the system and it plays an important role
while taking in to account the overall timing considerations of the system. Also, it should be taken care that when the pattern is stored in the controller, the
pattern should be stored slowly in order to ensure maximum look up points (comparison) in the array. This means that the stored array should always be greater than the
checking array. This will avoid ambiguity in the system and make the system more reliable as it has more points to compare.
For increasing the safety of the system, we need to have a lower limit of the speed with which the pattern can be checked. This limit is set at one fourth of the speed
of storing the pattern. The upper limit on the speed is the speed of the stored pattern. Thus the check speed can be anywhere between one fourth the store speed and
the store speed. For instance if the user takes 10 seconds while saving a pattern, he should re-create the same for a valid unlock trial in anywhere between 2.5
seconds to 10 seconds.
As mentioned in the earlier section, the proximity sensor is accurate within the range of 10 to 80 centimeters. This needs to be taken into consideration
while making a pattern as our whole project is based on the distance and obstacle detection. Also in order to obtain the output correctly, we have made some trade-offs
in the algorithm. The first one is that while comparing the pattern generated by the user with the stored pattern, we have kept a threshold of that only one-fourth of
the array should match. If one-fourth of the array in the check mode matches with that stored, than we assume that pattern generated was approximately same. Also, we
have given a threshold of +/- 15 of the reading obtained from the ADC. These both adjustments are needed as it is very difficult to generate the stored pattern at the
same location and with the same accuracy. Hence, we have provided the user with the following trade off in order to obtain accurate results.
To test the accuracy we took a sample pattern as shown in figure 8.
Fig 8. The stored pattern
The pattern was stored by Ankur and the set of readings for the same can be seen in figure 9. As 13 lines are stored, minimum 4 of them should match as per the speed
requirement of more than one fourth. Each of us tried to make 10 unlock attempts for the same pattern and the results can be seen in the table.
Fig 9. Stored pattern on Putty
Figure 10 shows the pattern checked for match by Ankur, where the unlock attempt is successful.
Fig 10. Match found
Figure 11 shows the pattern checked for match by Sai, where the unlock attempt is unsuccessful.
Fig.11 Match Not found
The table below shows the trials and successful attempts by the three of us.
||Number of Successful Attempts
||Percentage of Accuracy
As seen according to the current system, the accuracy if the same person trying to recreate is around 90-100%. For any other person trying it falls in the range of
70-90%. We can increase the system accuracy by increasing the thresholds, but this will affect the safety of the overall system.
The system has satisfactory performance and high accuracy. We even tested for incorrect similar patterns which the system clearly passes off as unsuccessful
attempts. There is a clear tradeoff between the accuracy to safety, out of which we believe safety is of utmost importance as it is a security system.
Safety and Interference
This project is very safe. Since the voltage and the current ratings are very low, no harm would be done to the user even if the wire was frayed or the
circuit was shorted. All the wires are insulated. There are no dangers relevant to this project. While placing the proximity sensors, we found that if the sensors are
placed very close to each other, they interfere with each other. This means that there is a possibility that the signals transmitted from one sensor may be received by
the receiver of the other sensor. This is not desired as it will create ambiguity in the system and the results obtained will not show accurate results. Hence, we
place the sensors in such a way that the transmitter of one sensor is besides the transmitter of another as shown in the diagram.
The system was designed to implement a security system that takes a pattern generated by the hand as the pass key and if it matches when recreated the lock
opens. The user needs to keep in mind that the system not only matches the pattern but also the position of the pattern. In order to make it more user friendly, we
provide grid pattern in the background that will help the user to remember the exact position of the pattern.
Results vs. Expectations
We wanted the system to work with actual test patterns, so we comprehensively checked different patterns and verified the accuracy of the system. As far as
the testing was concerned, we obtained accurate results for all the tested patterns. Initially, we believed that faster patterns could be tested, but later on we
specified minimum number of readings required to unlock, to increase the reliability of the system. Also, we expected to be able to store small patterns and test
accordingly, but we had reliability issues while using smaller patterns because of insufficient comparison involved. Overall, our system performs satisfactorily, and
can be effectively used to create a gesture-based secure unlock. Given more time and budget, we could have made the system 3D by which change in the third dimension
could be used to model the system, which would increase system accuracy and give the user another dimension for creating the patterns.
Intellectual Property Considerations
The entire hardware design of this project was done without referencing any other designs or the intellectual property of others. The software we wrote is
also mostly of our own design, although we did utilize ideas learned from Bruce Land's example code from the previous labs, we did not explicitly copy any of those
programs. We did use the UART.c and UART.h files, which are under the "Beer-Ware License" and were written by JoergWunsch.The patents listed previously are only
related to our project and we did not directly use any of the ideas claimed within them. We did not reverse-engineer a design, so there should be no patent or
Throughout this project, we strictly adhered to the IEEE Code of Ethics. In particular, we believe that two points of the code are pertinent to the way we
conducted ourselves this semester. First, the code states that a member of the IEEE must "seek, accept, and offer honest criticism of technical work, to acknowledge
and correct errors, and to credit properly the contributions of others" This was very relevant to us at the beginning of the final project when we were first hashing
out details with our TA and with Dr. Land. We made sure to discuss our project ideas with our TAs and Dr. Land early in the project planning phase. Secondly, "to be
honest and realistic in stating claims or estimates based on available data". We were honest in writing this report and explaining our project and how we designed it.
As ethical members of the electrical engineering community, in our demonstration we made sure to discuss all of the aspects of our project that do not currently work,
as well as flaws in the current design. Throughout the semester, we adhered to the entire IEEE Code of Ethics, but we thought our specific adherence to the above two
points were noteworthy.
As far as we know, there are no legal considerations involved with this project
IR Proximity Sensor Datasheet
Hand Motion Chess
We would like to acknowledge our advisor Prof.Bruce Land for the constant motivation and inspiration to think
beyond the ordinary.We would also like to acknowledge the FALL 2013 TA's Cameron Glass,Roland Kreiger,Tian Gao and Aadeetya Shreedhar for their support. We obtained
some code for serial communication, ADC conversion in C and template for webpage in html from the 4760 webpage
A. Division of Work
|ADC and Sensor interfacing
||Ankur Thakkar and Darshan Shah
|Check and Store mode algorithm
||Ankur Thakkar and Darshan Shah
|Pattern Matching Algorithm
|General Circuit assembly
B. Parts List and Costs
|IR proximity sensor (Part #SEN-00242)
|3 Pin Jumper cable (Part #SEN-08733)
C. Program Listing