Arduino Safe With Multivibrator Changeable 4-digit Combination

by Prabhpreet in Circuits > Arduino

156 Views, 0 Favorites, 0 Comments

Arduino Safe With Multivibrator Changeable 4-digit Combination

F67T1Q8KKQVDPX4.jpg

This instructable will explain how to wire, code, and build a functioning DIY arduino safe with multivibrator changeable 4-digit combination. Well what does that mean? A arduino safe with multivibrator changeable 4-digit combination is a functioning safe with a changeable password/combination, it features a series of multivibrator circuits to create the 4-digit combination, a input panel to enter in combination, open/closed detection using a magnetic switch, and more.

Supplies

F67T1Q8KKQVDPX4.jpg

Wiring the 555 Timer

F1LMBHIKKQVCXSG.jpg

Start with the breadboard in front of you, then place your NE555 timer over the middle of the breadboard 2 slots on from the left, make sure the notch on the timer is facing to the right. Then connect pin 1 of the timer to the ground rail using a jumper wire and connect pin 8 of the timer to the power rail. Connect pin 5 & 6 to ground, connect pin 5 with a 0.1uf capacitor and connect pin 6 with a jumper wire. Connect pin 3 to a row on the breadboard left of the timer that is not connected to anything with an LED, then using a 560 ohm resistor connect the rail with the LED to ground. Next two slots to the right of the timer place two push buttons over the middle of the breadboard with one space in between them. Then connect the bottom right leg of each button to the power rail using 10k ohm resistors and the top left leg of each button to the ground rail using jumpers wires. Then connect the top right leg of one button to pin 2 on the timer and the top right leg of the other button to pin 4 on the timer. Then finally three spaces to the right place the second NE555 timer and repeat all the steps above.

Wiring Gated SR Latch

FRLTE1VKKQVCXVS.jpg

First take the breadboard from the last step, directly to the right of the furthest right pushbutton connect the two ground rails of the breadboard with a jumper wire, do the same for the power rail with a wire in between the two timer circuits. Next directly to the right of the wire connect the ground rails and place three push buttons over the middle of the breadboard with no spaces between them. for the first two buttons connect the bottom left legs to the power rail with jumper wires and the connect the top right legs to the ground rail with 10k ohm resistors. For the third button do the same but switch the placements connect the bottom left leg to ground and the top right to power. Next one place to the right of the last button place the AND gate (7408) over the center of the breadboard, make sure the notch on the chip is facing to the right. Then two places over place the NOR gate (7402) over the middle of the breadboard, ensure that the notch in the chip is facing to the left. Next complete the following connections between the two gates:

AND---------NOR

pin6 ------> pin11

pin8 ------> pin3

NOR--------NOR

pin2 ------> pin13

pin1 ------> pin12

Next connect the bottom right pin of the furthest left push button for the latch to pin10 on the AND gate, then do the same for the next pin over but connect the leg to pin9 & pin4 on the AND gate. Finally connect the last button from the top right leg of the button to pin5 of the AND gate. Then place two LED's to the right of the NOR gate one on the top and bottom, connect both short legs to the ground rails using 560 ohm resistors. Then finally connect the other leg of one LED to pin1 & for the other LED connect the other leg to pin3 of the NOR gate.

Wiring Dip Switch & RGB LED

F0EOE06KKQVDQ3J.jpg

First place the breadboard in front of you and place the dip switch over the middle of the mini breadboard one slot in from the left. Next on one side of the dip switch connect each leg individually to the power rail with 10k ohm resistors and on the other side connect each leg individually to the ground rail with jumper wires. Next to the right of the dip switch place your RGB LED in the breadboard and connect it to the power or ground rail with a 560 ohm resistor dependent if it is a common anode or cathode LED.

Connecting Breadboards to Aurdino

FV5JVACKKQVDQ3K.jpg

Dip Switch & RGB:

First we will connect the RGB LED and the dip switch as these are placed on the outside of the box, first you will have to make a hole in the box with scissors or a drill close to where you will place your breadboard, this is how you will feed the wires through to the arduino inside the box. If you are not using a box you can simply just make the same connections outside the box. So first use jumper wires to connect individually each pin of the dip switch from the side with the resistors to one of these pins A0,A1,A2, and A3 on the arduino, the order does not matter as you can change the code to match the order you wired them in. Next connect the R, G, and B legs of the RGB LED to pin 11,10, and 9 on the breadboard, make sure each pin is only connected to one of the legs of the LED, each leg should not be connected to every pin.

Multivibrator Circuits:

Next is to connect the circuits used to set the 4 digit combination, first we can connect the two bistable mode NE555 timer circuits. To do this connect a jumper wire from pin3 of the NE555 timer and connect it to digital pin 13 on the arduino, do this for the second NE555 timer as well but connect it to digital pin 7 on the arduino. Next for the gated SR latch connect the short leg of the first LED (the one connected to ground by a resistor) to digital pin 6 on the arduino, do the same for the other LED but connect it to digital pin 5.

Magnetic Switch:

For the magnetic switch simply connect the cable that is running to ground using a resistor to digital pin 3 on the arduino using a jumper wire.

Servo Motor:

Finally connect the signal wire (white, orange or yellow) to digital pin 4 on the arduino using a jumper wire.

Ground/Power:

Finally connect the ground rails on all breadboards together using jumper wires, do the same with the power rails, then connect the 5v pin on the arduino to the power rail of the internal mini breadboard and the ground pin to the ground rail of the internal mini breadboard.

Code

FV5JVACKKQVDQ3K.jpg

#include

int red;

int green;

int blue;

int redpin = 9;

int greenpin = 11;

int bluepin = 10;

int Mswitch = 3;

int inpin[4] = {A2,A0,A1,A3};

int setpin[4] = {5,6,7,13};

int CSpin[4];

int CIpin[4];

int O_C; Servo lock;

void setup() {

lock.attach(4);

pinMode(13, INPUT);

pinMode(11, OUTPUT);

pinMode(10, OUTPUT);

pinMode(9, OUTPUT);

pinMode(7, INPUT);

pinMode(6, INPUT);

pinMode(5, INPUT);

pinMode(3, INPUT);

pinMode(A0, INPUT);

pinMode(A1, INPUT);

pinMode(A2, INPUT);

pinMode(A3, INPUT);

lock.write(90);

while(true){

O_C = digitalRead(Mswitch);

if(O_C == HIGH){

delay(2000);

lock.write(80);

break;

}else{

color(0,255,0);

delay(1000);

color(0,0,255);

delay(1000);

}

}

}

void color(int red,int green,int blue) {

analogWrite(redpin, red);

analogWrite(greenpin, green);

analogWrite(bluepin, blue);

red = 255 - red;

green = 255 - green;

blue = 255 - blue;

}

void loop() {

for(int i = 0; i <= 3; i++){

CSpin[i] = digitalRead(setpin[i]);

CIpin[i] = digitalRead(inpin[i]);

}

O_C = digitalRead(Mswitch);

if(CSpin[0] == CIpin[0] && CSpin[1] == CIpin[1] && CSpin[2] == CIpin[2] && CSpin[3] == CIpin[3] && O_C == HIGH){

color(0,255,0);

lock.write(90);

while(true){

O_C = digitalRead(Mswitch);

for(int w = 0; w <= 3; w++){

CIpin[w] = digitalRead(inpin[w]);

}

if(O_C == HIGH && CIpin[0] == HIGH && CIpin[1] == HIGH && CIpin[2] == HIGH && CIpin[3] == HIGH){

lock.write(80);

color(255,0,0);

break;

}else{

color(0,255,0);

delay(1000);

color(0,0,255);

delay(1000);

}

}

}else{

color(255,0,0);

}

}