I am going to show you how to make a door alarm. It is simple it took me around 20 min with coding, changing camera angles and so on. I will also publish my code if you want to copy. If you are still not sure about building it watch the video I made to change your mind on this link: (if you dont like the melody you can always change it).
Step 1: 1. STEP: HARDWARE and SOFTWARE
Step 2: STEP 2: Wireing
below i have a file that showes you schematics clearer. I alos added a picture, but harder to understand. To view the file you have to download: http://fritzing.org/home/ (not sponsored). And I will also explain how the wireing is done and how it works.
The power source in my case will be a 9v battery. To power the arduino with a battery you must connect the + to vin and the - to ground (keep in mind!!! arduino takes up from 5v to 20v dc). pin 8 is connected to a push button (you can also change the code to a diffrent pin) the other wire of the button is connected to the speaker. Lastly connect the other wire of the speaker to ground terminal.
Thats it for wireing!
Step 3: STEP 3: the Setup
I simply hot glued the button to the door, so that when the door is closed the button is pressed and nothing happens and when the dors are opened the button releses and the speaker starts beeping.
Step 4: STEP 4: Coding
I understand that this step might scare someone who doesnt know how to write code, but dont worry I made I for you so you can download it. You can also add some features to the code to make it more professional. When you have it downloaded open it with arduino ide connect arduino with usb. Make sure that you have the right port and board selected in the tools menu. After that click upload(right pointing arrow). then wait to compile and upload.
Step 5: STEP 5: (OPTIONAL) Enclosure
This step is totally optional, however, I do think it will look nicer to hide all the components. The box can be homemade (3d printed, wood, cardboard...) or you can also buy it.
That is it for this project i hope you enjoyed it, if you did please leave a like. Hopefully you will find a use for it. I sure did!!!