This is my first project released on Hackster and every suggestion is accepted. Well, I've made this alarm just for fun and I hope you will like it!
In order to see from the image to start the alarm, you must put the correct magnetic card on the RC522 Card Reader. If the card is indeed correct, the alarm will turn on automatically (green LED: on; red LED: off), but if the card isn't correct, nothing is happening (green LED: off; red LED: on).
When the alarm is started, the HC-SR04 Ultrasonic Sensor will capture any movement in front of it.
To shut down the alarm, we will again put the correct magnetic card on RC522 Card Reader (green LED: off; red LED: on).
We can go to sleep without activating the alarm because the Real Time Clock will activate the alarm at a certain hour.
Here you can find some code explanation:
On line 29, you can set the code of your magnetic card.
String codiceAutorizzato = "5545A93980";
On line 53, you can schedule the automatic start of the alarm (24 hours format).
if (orario=="21:56" && statoattivato==0)
On line 65, you can set the maximum distance from which the sensor works (it must be expressed in centimeters). Beyond this limit, the sensor won't work and no movement will be notice.
For every explanation or suggestion, feel free to comment below.
I'm sorry, I can't make my real schematics because with Fritzing I can't compact the circuit, please forgive me ;-)
You can try to compact the circuit on your own.
Have a NICE DAY.
Simone from Italy <3