I'm working on my own version of the CoffeeTronics (http://www.arduino.cc/playground/Main/CoffeeTronics) project and I'm up against a general electronics problem. I'm not very knowledgeable when it comes to hardware and electronics so hopefully someone on here can help me out. I'm testing things out at the moment and what I've got is 120VAC power that's connected to a primary on/off switch. There's a second switch after that one that connects to an IAC5 opto-isolator. The IAC5 takes 120VAC input and produces 5 VDC logical output. The output side of the IAC5 has a power pin which is connected to the 5V pin on my Arduino, a ground pin which is connected to one of Arduino's grounds, and an output pin that goes to a digital input (with a pull-up resistor thrown in there). That's used to turn on and off an LED.
Now for the problem... When the main power is turned off and the Arduino is running, the IAC5's output is low and the LED is turned off. When the power is turned on but the second switch is turned off (meaning the IAC5 still shouldn't be getting any juice), the output goes high. When the second switch is turned on, the output remains high. That didn't make any sense to me so I completely disconnected the IAC5. Even after doing that, I'm getting the same behaviour! Flipping the power switch is changing the output even though it's not connected!! I'm assuming this is electromagnetic interference at work but I'm clueless on how to fix it. Does anyone have any ideas?