I think it's best to start with a video. If it's successful you will be irritated by the end of it, and possibly a little amused.
Inside the box are some simple electronics, the component section lists them in detail. An actuated switch (that cost me £13, the most expensive button I have ever bought) is the key to the project. When you apply 24v it will move to its default position. The switch I used can only go one way but for this project that didn't matter.
An Arduino Pro Mini is used to control the LEDs, buzzers and the switch. It also reads values from an accelerometer (that maybe has something to do with switch it off!). The whole thing is powered by 3x 18650 3.7v lithium batteries. The astute reader will have noticed that's not enough to activate the switch. Fortunately I spotted this before making the case and left room for a big boost converter that takes the battery voltage up to what's needed for the switch. The case was designed using a modified OpenSCAD file from Thingiverse. I laser cut it from 3mm plywood at the Fablab in Strathclyde University (I'm a post-grad student there).
The code and files for the laser cutter are are available on Github. I would love to write a full guide on how to make this but I don't have time at the moment. There is nothing particularly complicated about it but you might need to modify some of my stuff. For instance, unless you live in the UK with a local Poundland that stocks the nuts and bolts, you will need to modify the sizes in the OpenSCAD file.
I would like to make a bulletproof version out of aluminum and tidy up the all the wiring. Maybe make it even louder and annoying. Yes, I am looking forward to The Most Annoying Machine Version 2!
Feel free to ask me any questions and I will do my best to answer them.
Are you still reading because you want to know how to switch it off?! Fine. The accelerometer inside detects if the box is in freefall or being held in place. If you throw the box in the air and then switch it off, it will stay off. I got the idea from another of my projects - Smart LED Juggling Balls.