How to wire up a ceiling fan with Particle Photon?

So I have a ceiling fan that I’d like to connect to my Particle Photon so that I can control the fan and the lights connected to it. I’m a beginner and the only experience I have is connecting my photon to a servo and using it to open/close my window blinds. So I’d like to ask the community what I will need to make this happen.

I noticed the wall switch that controls my ceiling fan has black, red, and ground wires connected to it (3 total). I read online that if the lights and the fan are controlled by a single switch, then both the wires for the light and fan are joined together with the switch’s black wire. That’s what I think is going on here (see photos below). I have a breadboard and jumper wires and planning on powering the photon via the USB for now. Are there any other pieces I’m going to need to make this work or can I just hook up the wires that are on the switch to some of my jumper wires and connect them to my breadboard (to some PWM pins)? Thanks

@dag.io, the first think I would do is search this forum for “ceiling fan”. Second, working with AC can be a dangerous for both you and your Photon. The fact that you ask about connecting the wires directly to your photon and use PWM tells me you are not prepared nor knowledgeable enough to do this. So please, before you do ANYTHING, read those other topics you will find in the search and THEN come back with your questions. And please, don’t do anything without an electrician.

5 Likes

I would second this, PLEASE PLEASE don't mess with any wires inside your walls unless you really know what you're doing. You will hurt and possibly kill yourself !!!

taken from a DIY site:

If you don't know what you're doing, electrical work is one of the most dangerous things to attempt to DIY. After all, if you mess up a paint job, you've just got an ugly wall. If you mess up an electrical job, it could mean a fire, muscular paralysis, or even death. It's that serious.

When it comes to electrical work, the stakes are very high. Consider this: Electricians go to school and then spend two to four years in an apprenticeship with a master or licensed electrician before they can take the exam to become a licensed electrician. It's hard, complicated work best left to those with the training to do it.

-- that being said, there are safe ways to control wall current, but you should do a lot of research and small scale testing before opening up your walls.

4 Likes

Also just a bit of info :pencil: the wires in your wall switch carry 120V up to 240V AC (Alternating Current) with a current up to 15A. As stated already, this can kill you :zap:

Your Photon is only 5V DC (direct current) max, tops. Most pins are only 3.3V DC max.

These two things are NOT compatible :warning: do not connect them together.

3 Likes

@dag.io please call an electrician or a friend with electrical experience right now before you attempt to put that back in the wall yourself. The power should be off when working on these things, and from your pictures it’s clearly still on. Be safe!

3 Likes

With safety in mind I’ve closed this topic for now. Continuing the project in its current state can cause major harm and even be lethal, neither of which is something anyone wants to promote.
Please, contact a licensed electrician or someone with enough experience to help you seal this back up. Should you gain enough knowledge and experience that you’re willing to give this another shot, feel free to open a new topic. That’s also the case if/when you want to let someone else with the proper experience/skills do this.
For now, the best help we can offer is for you not to hurt yourself, which I hope you understand.