Need help please - 12v siren + magnetic sensor

Guys, good day.

I am not an eletronics wiz or a long date arduino programmer.

I have bought everything for this project:

But i will be using a magnetic sensor instead.

What i do need is a code that will control that 12v siren.

My home was robbed last year and now i want to make this alarm system.

Thanks in advance for any help :slight_smile:

If you buy a "siren" (instead of a speaker/transducer) your code only has to turn it on & off. ...If you can turn-on an LED you can turn-on a siren.

If you use a speaker/transducer you can use tone() to make sounds, but the driver circuit for a siren is simpler and a siren will probably be louder.

You can use a relay, transistor or MOSFET to drive the siren. If you use a relay, the relay usually requires a driver circuit so it's easier if you get a relay-board with the driver built-in.

Since it's for a house, you might want to get a 120V (or 240V depending where you live) siren. For that, you'd need a relay but you might be able use a smaller (lower current) power supply, since the power supply would only have to power the Arduino. And, the power-line siren would probably be louder.