Electrical – How to turn a coffee machine on/off with a microcontroller?


So the thing is, I'm a computer science major and working on an IoT project which is a coffee machine powered by a Particle Photon and controlled with an Amazon Alexa skill. The problem is I have absolutely no experience with electrical engineering and am terrified I'm going to hurt myself with this. I have a bread board, jumper wires, and relays and have done a fair amount of tutorials with the photon and arduino so I know the basics of how they work.

But today, I tore into the coffee machine to see the wire configuration and am at a complete lost. I've never done anything like this.

The coffee machine is operated by a simple ON/OFF switch. You flick the switch ON- it brews coffee. I just don't know how to achieve that through a micro controller.

I've included some photos of what the inside of the coffee machine looks like. Any help in pointing me towards the right direction would be great. I truly have very little idea where to start with this.

photo 1
photo 2
photo 3

Thanks so much! Like I said, a total newbie at this so sorry if I sound super naive and out of place.

Best Answer

Since you're a beginner at electrics/electronics, I strongly advise not attempting to modify the coffee machine or work with mains voltages unless you can find someone experienced to check your work. Instead, plug the coffee machine into a ready-constructed outlet that you can switch on and off using a signal from your Photon. If you're in the US then this looks ideal, though of course it's your responsibility to be sure it's suitable for your intended use.

For a more general answer if the linked product is not suitable: obviously there are Wifi-connected mains sockets available (e.g. the TPlink Smart Plug and many others) that you could control via their API, but if you or your project supervisor feel that using an off-the-shelf IoT device would be 'cheating' then another idea would be to get a 'dumb' remote-controlled socket, like this or the equivalent wherever you live, which is operated by a low-powered radio transmitter. You could then modify the remote so that a digital GPIO output from the Photon can 'press' the button on the remote by connecting the two contacts of the button together.

You could do that using a reed relay, as long as the Photon's output can supply enough current to drive it, or an optoisolator - I'm sure you can find example circuits using either of those devices on here or elsewhere.