Arduino leave me alone box

Good evening everyone. I've had a lot of great help here before, I am thankful for such a great community. I have a new project that I am helping my brother with. It is one of these useless machine concepts but with a different approach. Rather than flipping a toggle switch, it would be opening a box that has a momentary, normally closed switch on it. You open the lid, it has a slight delay, then the arm from the servo closes the lid. My first thought was to copy the useless machine concept but after wanting to tinker with different output options (lights, sound, action!) I said, there is no easier way than to plug in an arduino and get some simple I/O going, completely flexible for tweaks and add-ons.

Anyhow, here is what I have laid out hardware wise:

  • Arduino Uno
  • Battery Pack
  • Switch to cut power to battery pack easily to turn it off when not used
  • NC momentary switch on lid
  • Servo motor (3 lead with signal, geared typical hobby one)

What's the best approach programming wise for this?

My immediate thoughts:

  • Switch on Pin 2
  • Servo on PWM pin 9
  • Switch as input with 5V, ground pulled down so that when the switch is open it isn't floating
  • Logic is so that it reads this input, when the switch opens, delay(x ms to not be instantaneous) and then rotate say 90 degrees to close lid (would need to be tweaked to get it right). This is the part I am not sure of, since i am using one switch, can't I write logic so that I can say, when switch is opened, run servo until switch is closed again? Because the lid closing (servo is doing this) would close the switch at the end of the travel.

Thanks for all of your help!

One of the students in a workshop I did made the classic box with a switch that turns it on, and the top opens and a hand turns the switch off. But he made it more variable. Sometimes it didn't open unless you flipped the switch off again or two flips. Then it sometimes opened, a few LEDs blinked inside (later in a troll head) and then the lid closed. Sometime after a sequence, the lid would open by itself, the troll would blink, and shut the lid again.

So, as Baird Smith said in an IBM lecture 35 years ago, "Software is saying, it never has to be finished!"

Hi,
I'm actually trying to build one
i got lots of informations here : http://www.instructables.com/id/Arduino-Most-Useless-Machine-Ever-project/

good luck