Monitor *and* control a button?

Hi! I just got my first Arduino and I'm having a lot of fun playing around with it. I've got a button (that when pressed, connects ground to a digital input pin) that makes a piezo beep.

My goal is to both monitor and control the button on a 12v appliance. For example, when you hold the button down for x seconds, it will write to the eeprom and make the arduno automatically tap the button whenever it's power cycled.

I have the majority of my logic programmed in the software already, now I just need help with the hardware.

My first question is how to monitor for 12v coming out of the switch when depressed. I understand that the Arduno doesn't like >5v coming into one of its digital inputs. Would the appropriate thing be to use a 7805 to bring the 12v down to 5v, or maybe I could make the switch close a 12v relay that would connect ground to a digital input and have the code function as it does currently?

The second question is how to emulate button presses. I need to send 12v to a line for a few seconds. Is a small 5v relay also the best way to do this? Set a digital output to HIGH which would make a relay connect 12v to the line? I also see schematics calling for a transistor to actually throw a relay. Why is this required (sorry, I'm a total noob)? Is the electromagnet on the relay requiring more current than the arduino can safely provide?

Thanks!

Whether you need a relay or a transistor to control the 12 volt appliance depends on how much current the appliance uses. A car starter motor would need a relay. A 12 volt LED could be controlled using a transistor.

The 7805 would work. Depending on the current flowing when the switch is pressed, a couple of resistors forming a voltage divider might be all that was required.

Tell us more about the 12 volt device, to get better answers.

Thanks Paul. The 12v device is literally just a button that enables a feature on my appliance (think of it as the "hour" or "minute" button on an alarm lock). It sounds like a few resistors may be sufficient for monitoring presses of the button.

Keep in mind I'm monitoring and emulating presses on the same button - I'm essentially just augmenting the feature - making it so holding down the button for x seconds makes my device automatically press the button for 1/2 second every power cycle (the amount of time required to enable the feature the button activates). If the "auto-on" is enabled, then you could hold down the button for x seconds to make it return to normal operation (as if the arduino was not connected).

My second question still remains - how do I emulate presses?

You still haven't told us enough about the 12 volt device. Is it low current, or high current?

If it's a low current device, you can use a transistor. Two legs connect to +12 V and ground. The third leg and ground connect to the digital pin and ground for the arduino. Which leg goes where, you ask? Beats me, I'm a software developer. That's a hardware question. But google knows all.

If it's a high current device, you'll need a relay. The digital pin goes to the +v side of the relay. The ground side of the relay goes to the ground pin on the Arduino. The switch wires go to the output side of the relay.

Also is the 12V source AC or DC. That will make a big difference. If its AC you might want to use some Opto-isolators.

http://en.wikipedia.org/wiki/Opto-isolator

They basically connect two circuits via an optical switch.

It's all DC and very low current. Thanks.