Home is everything for me. Whenever I say the word "home" It means being safe.
One day, my friend`s house was broken into and robbed. They didn`t know but when they came home so many days later and it was so scary for them. None of the neighbors noticed that at all and it was a great shock.
So, I decides to make a device to tell me if anybody is trying to enter my house while I am outside but, in a smart way .
I used Fusion 360 for designing.
Didn`t want the design to be complicated.
After searching the internet and Thingivers, I decided to make a very simple 3 D printed box (Part 1).
While for the magnet holder(Part 2), the bracket was a great inspiration. It is simple and functional as well.
Fusion 360 Logo
Thinkgiverse Logo
The main box (Part 1):
First draw a rectangle (135mm x 75mm ). Make another one inside( 2 mm away from each side ) to make margins. Extrude (2 mm). Extrude the margins only above (50 mm ) and here is a box.
From each side, we have to design places for the screws and nuts.
Add a new sketch. draw 4 rectangles from each side. Extrude to the bottom so it will be suitable for printing (small extrusion will be weak).Draw a rectangles from each side for putting the nuts inside. Extrude cut the rectangles (8x8 mm ). from above make another sketch. Draw a circle (3.5 mm in diameter) from each side and extrude cut.
Add the screws and nuts by making joints. Joint the Arduino and Extrude cut the 4 holes of its screws).
Now, we have to make the cover. Make a new sketch. Draw a rectangle (135 x 75 mm). Extrude 2 mm.
Add the buzzer. Extrude cut (2mm).Don`t forgot that the LED is in a holder(7.8 mm) so, draw a circle 7.8 mm in diameter and extrude cut(2mm).To fix the cover with the box extrude cut the 4 circles for he screws as well. Make fillet 2 mm. for all the box and cover.
For the bracket
Draw L shape (60mm x 30mm). Extrude 15 mm. Make fillet 2mm for better appearance. In one side make a hole for the screw. Draw a circle 3.3 mm. Extrude cut. In the other side make a hole for the magnet (10.5 mm ''change it according to the magnet you have''). Extrude cut 32 mm.
CLICK IN HERE FOR F3D FILE for magnet holder.
CLICK IN HERE FOR F3D FILE for the main box and the cover.
Save the files in .STL files to be ready for printing. Open it in Cura app. Press slice and send it to the USB.
Add the chosen PLA .(blue PLA)
Connect the USB to the printer.
For using the bedding sensor. Add G 51 in preference. Choose the STL file. Press O.K.
1- When the door is opened, the two magnets will be away. The magnetic field sensor will detect it (input 1).
2- When the RF read card 1 or 2 it will stop any action.(input 2)
which reads a signal from the (Magnetic field sensor and the RF).
I used the LED, buzzer, bread board and wires
to illuminate the LED and make a sound.(output 1).
I didn`t find magnetic field sensor or RF in Tinker-CAD so, I downloaded them in Fritzing.
And making "No action" when detecting card 1 or 2 (output 2).
Let`s do them together:
The Arduino UNO Connection
The 5 Volts with a positive N in the bread-board
The ground with the negative N in the bread-board
The Sensor Connections
The Magnetic Field Sensor:
VCC to the positive on the bread-board
Out to A0
Ground to negative N in bread-board
The RF
SDA (brown wire) on pin 10 on Arduino-UNO
SCK (yellow wire) on pin 13 on Arduino-UNO
MOSI (green wire) on pin 11 on Arduino-UNO
MISOI(violet wire) on pin 12 on Arduino-UNO
Ground (blue wire) on pin GND negative N on Arduino-UNO
RST (grey wire) on pin9 on Arduino-UNO
3.3V (red wire)on positive pin on bread-board to 3.3 Volts on Arduino-UNO
LED
The positive leg to pin 2 on Arduino (red wire)
The negative leg to resistor to the negative N on bread-board to the ground of Arduino-UNO(blue wire)
Buzzer
The positive leg to pin 3 on Arduino-UNO (red wire)
The negative leg to the negative N on bread-board to the ground of Arduino-UNO(blue wire)
-5V Adapter
-As the Arduino and buzzer need 5V D.C.
-While the LED need less than 5 Volts, so I will add a 220 Ohm resistor to decrease the voltage.
For the sensors :
-Magnetic field sensor use 5 Volts from the Arduino.
-R.F. needs only 3.3 Volts from the Arduino itself.
I thought of using a battery but nowadays we can allow a socket to turn on a machine even during electricity cutting off.
So, no need to use batteries.
To define :
magnetic sensor Write #include <SPI.h>
RF Write #include <MFRC522.h>
Then write the pins that will be connected to Arduino.
The voltage downward is for defining the electric voltage that is always accompanied to the magnetic fields so it`s a way to define magnetic field.
In void, we informed the code that we have:
Specific magnetic field else we are going to make an action.
familiar cards for the RF, else The Led pin and buzzer pin will be the out put.
We inform the buzzer if the magnet is close turn off the buzzer and LED.
Else:
Turn on them , but if the RF detected any one of the cards turn off them.
Divide and conquer, this is how I worked with the code.
First, I started with testing the Magnetic sensor.
I used it and the magnet to test it`s functionality.
From library I downloaded the following codes:
Testing the north and south poles and testing high or low magnetic field.
Then, I made another code for the RF sensor and the two cards.
Finally, Add the parts above together in one code,
the void in both of them together and void loop in both together as well.
Final code of cards authentication and magnetic field together.
*click on every underlined word for the link of the file
2- Connect the Arduino to the lab-top using the USB cable.
3- Be sure you chose the right USB of Arduino and press upload.
I was so excited to add the circuits and wires inside the box.
First I added the LED with its holder and the buzzer.
Then fixing the Arduino in the main box with screws and nuts.
reconnect the separated wires again.
Add the RF to the cover and fixing it with screws and nuts.
Test the device and add the cover.
Finally Call the family's members to enjoy testing it together.
Yes, in every step I was asking.
I wanted it to be a good project.
Marwa helped me recommending a store for magnets.
Israa bought me another magnet.
We were supporting each other all the time AL7.They were great companions.
I was asking every one about the colors all the time.
yes, this me😅
The code was a little bit confusing but divide and conquer strategy really helped a lot.
At this point I searched a lot, There were so many useless codes in the internet .Mohanad told me about a Maker who used RF sensor before (Thanks Menna-Allah Mahmoud) and it really worked al7.
Keep your magnet in a visible box all the time. It keeps attracting to every metal around.
It wasn`t clear where to put the magnets to be in front of the magnets` sensor so, I opened the device again, put a mark outside the box to be able to know where to fix the magnets exactly.
If I have more time, I will add siren to the device so the voice will be louder(110DPA-12Volt).