Testing if a 230v AC circuit is closed

Hi,

I have a device (espresso machine) with a AC switch. I would like to know on my Arduino if the switch is open or closed.

What would be the best way to test this? I have direct access to the insides, of the machine and the leads to the switch. I can easily put something parallel or in line with the switch. But what?

Thanks!

Wrap a wire around one “leg” of a hot line and produce induction?

Get a mechanical relay and put it in parallel with the machine’s electronics (downstream of the switch).

Mouser and Digikey both have 230 VAC coil style relays.

Does this unit have any display or power indicators driven by 5v logic? If so you could potentially tap into an LED’s anode lead that comes on when power is on. I did this for a camera that I wanted to time lapse control with a micro controller. I needed to know if the camera was on or not when it was time to take the next photo. If not, I powered it on by toggling the power button. To find out if the camera was on I simply read the anode line of the power LED.

Man, that is a bunch of options.

@exeng: the unit does not have any led or other indicators that light up when the switch is toggled. So no love there.

@DanV: I was thinking along that line. But, I a was worried that these would be bulky… And it raises some questions, like would I need to use something akin to a Flyback diode when using a 230v AC relay… A diode wouldn’t work I suppose due to changing polarity… What is the correct way to hook this up safely?

@therepod: Your comment made me think… Induction… I found these: [Hall-Effect Current Sensor Breakout - ACS712

And some smart video’s about these: https://www.youtube.com/watch?v=UF5jrnXvTlM

I’m tempted to use these in line with on one of the leads leading to the switch… I could use the full logic and determine the actual current, but that’s not needed in my case… Just sensing it deviates significantly from idle is enough for me…

What do you think?](https://www.sparkfun.com/products/8882)

DanV’s answer is the standard way of doing this and it’s the most robust. No, you won’t need a diode unless the switch contacts are really wimpy.