This project was done in a maker group couple of years ago. My daughter & I resurrected it to share it with the wider audience and to develop STEM interests in kids.
It contains an IR sensor, 2x LEDs and speaker connected to Arduino. When the sensor detects someone in the proximity, Arduino will blink LEDs and turn on a nasty audio sound.
It is good enough to startle the little ghosts who come to get candy, but not to scare them.
See the project on hackster.io.
Replicate the project with kids to teach them the basic principles of electricity while having fun.