Help me please.

I am a beginner and I have finished all the projects in the starter book. I have built a motion sensor, but I want it to ring loud instead of using a piezo buzzer. So can I connect a 12/24 volt warning alarm in the piezo buzzer's place, or will the microcontroller be damaged? Plz help. Thanks in advance.

you should place e.g. a 5V relay in between.
Google images will show you how to connect, you need a diode too