Here's a sound alarm that can detect your voice or any other sound and give out an alarm light or sound. The schematic lets you see that the earphone is used as a microphone in this project.
The sound signal from the microphone is amplified by U1:A, rectified by DA and DB and sent to U1:B, the comparator. When you speak into the microphone, U1:B gives out an output.
When you finish wiring up the circuit, rotate the control volume fully counterclockwise, and turn power on.
Then, rotate the control volume clockwise while speaking into the microphone, and set the control volume in a position where the LED lights up. If the LED goes out when you stop speaking into the microphone, you can be sure the alarm is working well.
You'll notice the LED light up and at the same time hear a caution sound "beep" from the speaker. You've completed an alarm that can give out a caution light and sound.