This project proposes a way to secure your thing. The final result of the project is a switch commanded by the arduino after two stages of security. The switch can open a portal, replace a remote control or simply command the motor. My project presents only a bloc that unlocks something. So you can adapt this to your project.
The first stage of security is a matrix of 9 photoresistors that are illumunited by a picture on a phone. The second stage of security is a code of 4 numbers.
I'm a french student, so I try to do my best to make everything "English"
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What Do You Need ?
For this project, you will need :
- 9 photoresistors (1MOhm) and 20kOhm resistors
- An analog MUX called CD4051B
- a 3*4 Keypad matrix
- A 2N2222 transistor
- An arduino UNO
Step 2: Make Our "photoresistors-code"
The main idea is to uses the luminosity to unlock our thing. Everyone knows that black is made without light and that white is the most powerful light. This is what we will use. We will use grayscale in a picture to make this.
I made a little python program in which we can setup the size of our screen, and then, the program will create a 3*3 matrix in which every area is a random scale of grey. This picture is unique, and as 255^9 possibilities.
To use my program, you will need python 3.x with the Pillow library installed. If you don't know how to do, you can search on the internet, there are a lot of videos.
You can see what kind of image I gather.
Step 3: How to Properly Use Our "photoresistors_code" ?
To use this picture, you will need to install photoresistors. To do that, I propose to print some little pieces in 3D, with the file i give you. I recommand to use flexible filament. This little piece allows that the whole light of your phone's screen goes on the sensor.
First, solder every photoresistor with two wires. Then, you can glue those little rounds on a plate, drill an hole a little bit bigger than a photoresistor in the plate and then you will see that the photoresistor fit perfectly in the hole. Be careful, you need to glue the rounds on your plate according to your phone's size. Every rounds has to fit with the right grey-square.
Step 4: How to Wire Your Photoresistors and Calibrate Everything ?
Everything is glued, wires are free. You need to connect that to the arduino.
An arduino UNO has only 6 analog inputs, I propose to had 8 more with the CD4051B MUX. We will use the 8 input of this MUX and the last one will be Analog1 on the Arduino. Prepare every photodiode with a 20KOkm reistors according to the picture.
Then put a number to every photoresistors according to the next pictures.
Finally wire the 9th photoresistors to A1 and the other on the MUX like in the picture : photoresistors 1 to 8 on channel IN/OUT 0 to 7.
Finally, once everything is wired properly, you can upload the arduino program.
This program will give you values measured by the 9 sensors. Write them on a paper or simply paste them in the next program.
!!! Be careful, setup your screen on high luminosity and keep the luminonity everytime your will use this program !!!
Step 5: Use the Main Program
Once you have calibrate everything, we can wire the keypad to according to the picture.
Then, download the main program and open it. You can there paste the result of the calibration in the array "code_light", and you can modify your 4 numbers code also in the array "attempt".
Finally, I use a transistor to be actuator. Wire the transistor on the D0 pin but connect it once the program is upload.
The main program is separated on the following way :
- definition of constants and connections
- reading of the 9 photoresistors
- if good, we can test the manual code
- if good, the safe is opened
- if false, try again
- if good, we can test the manual code
Step 6: Have Fun !!!
To verify everything works good, I wire a LED to the transistor. She is shining. Remplace the LED by your idea : a motor for a lock or a servo or keep the transistor to replace a button on a remote.
I hope you will not have problem. If yes contact me at firstname.lastname@example.org
Participated in the
Safe and Secure Challenge