SOP Alarm System
Gather Your Supplies!
Below are the list of supplies you might need for this project. You may switch up your input and output options as you wish but you will need 5 inputs and 3 outputs of you choice. As seen below my inputs are a PIR Motion Sensor, Slide switch and 3 Dip switch pins.
As for the logic gates, you will need quite a bit as this project has 5 inputs connections, causing some of the expression to have three inputs to one gate. However, there is an option to get a [74HC11] Triple 3-Input AND Gate. This AND gate has 3 inputs for an output and would not need extra [7408] AND Gates.
It's alright if a 7411 is not available, instead you would need 2 extra [7408] 2 input AND Gates.
Please make sure you have 2 breadboards to work with so there is more space to utilize. The resistors would depend on which components you decide to pick for your input and output. For LED's I suggest 330 ohm resistors and for dip switches, 10k ohm resistors. Please see below for the possible costs for each component, you can find them all on Amazon.
7411 3-Input AND Gate ------ $ 0.49 each
7408 QUAD AND Gates (x2) ------ $ 32.19
7432 QUAD OR Gates (x2) ------ $ 32.19
7404 NOT Gate ------ $ 32.19
Red LED ------ $ 11.49 for 100
Green LED ------ $ 11.49 for 100
Piezo Buzzer ------ $ 8.56 for 10
PIR Motion Sensor ------ $ 15.01
Arduino ------ $ 7.99
Breadboards (x2) ------ $ 5.00 each
Slide switch ------ $ 10.18 for 10
10k Resistors ------ $ 28.79 for 100
330 Resistors ------ $ 7.19 for 10
Dip switch ------ $ 16.99 for 35
_____________________________________________
Total Possible Cost: $ 219.75
Truth Table
The Truth Table is a list of all the possible combinations from the 5 inputs. It's from 0 to 31 in binary digits. The outputs were created accordingly. Where if the on/off switch is on the green light turns on. If the lock password is set to anything other than 000, the red light reminds the user to set the numbers to 000 as a reset. When the on/off switch is off, all the outputs are set to 0 including both LEDs and the Alarm.
The Alarm turns on only when the on/off of the system is on and when motion is detected. Until the password lock is set to 011, the buzzer does not turn off. The red light will be on constantly to remind the user that the password is incorrect or that it is not reset. Once again the buzzer only turns off if the password (BCD) is set to 011, or if the entire system is turned off by the on/off switch.
A in the truth table refers to the Motion Sensor. If it detects motion, the input is set to equal "1".
B, C, and D in the truth table are the digits of the passcode respectively. The password to turn off the alarm is 011.
E in the truth table is the on/off switch which is demonstrated using a slide switch in this circuit.
Downloads
Logic Simplifications: Expressions
From the outputs in the truth table, we pull the expression that make each output true. From here we can see which simplifications in binary logic transform each possible combination to have the desired output.
As seen in the picture, the simplified expressions are as follows. The "~" indicates that the input goes through a NOT gate first before being an input with the rest.
For the buzzer or the Alarm: A~CE + A~DE + ABE
For the Red LED: DE + CE + BE
For the Green LED: ~AE +~BCDE
From these expressions, this is where we derive the right connections to the right number of logic gates we need. So, let's put together the logic expressions from all the inputs and draw the connections we see from these expressions.
Schematics
With the expressions we have written out, it's time to draw out the gates. In the picture above, you see the schematic that is drawn from the expressions we have written out using our knowledge in binary logic algebra. From each expression we see which logic combines which input or output. In the end, the total comes out to 9 AND Gates, 4 NOT Gates, and 3 OR Gate uses for these logic simplifications. The diagrams attached show 3 different ways for these schematics to be drawn out. They all have the same outputs but you can see the difference in context. The PDF file is the schematic from the actual build and it will be attached for each part of the build if that it easier to follow for you.
Downloads
Build for Alarm
Here is the first part of the build! This the wiring for the Alarm output. Please keep in mind that only the first 3 switches of the dip switch are used here.
We are connected the wires from the input to each gate and finally to the output as indicated by the expression and schematic. Most of the gates have 3 inputs for one output, therefore I resulted in using the 3 input AND gate. But, there is another you can go about this. You can have 2 of the input have one output. This output would then be another input combined to the third input that was excluded. The output of these two would be the final output of that logic expression. Make sure to follow which wire goes where, because otherwise it would hard to figure out where it went wrong if something doesn't work.
Downloads
Build for Red LED
Alike the previous step, this step and the one after is the wiring for each output. This wiring is following the expression for the Red LED. I've colour coded all of the connections from the start. You will be able to see if from the truth table PDF as well as the expressions, and schematics. These steps also have the schematic for each step of the wiring. You can definitely follow that if it's much clearer.
Downloads
Build for Green LED
And lastly, the final step of the wiring process. The Green LED expression. You can see me utilizing the second breadboard to separate the outputs so they can be seen clearly. All of the gates, and inputs are labeled in case it's hard to follow with the number of wires going through.
Downloads
Final Run
And now, we put it all together!
You're right it does look messy, but feel like to take the time to clear this up. Just remember how dip switches are wired, the current is passed over the bridge and the jumper wires must be connected from there to receive connection.
Thank you so much for following with me all the here. Trust me this was a lot of fun to build than it might seem. Please refer to the start of this Instructable to see how this circuit works. Thank you and good luck with you're projects!