Build a fan timer with a Particle Photon

Hi all!

I would like to achieve the same functionality of this device (a simple bathroom fan timer) with a Photon:

The main problem is that I don’t know what could be the best option to use current wiring as is and let the light switch be an input for the photon.

What kind of hardware do you suggest me to use?

I would like to be able to detect, from the Photon, if the light switch is on or off in the way that is more electrically safe.

Currently I have, at the fan: blue cable, brown cable, black cable (for the switch).

Thanks for your kind help and patience.

Please don’t take me wrong, but by the wording of the question I’d deduce you are not very experienced in working with mains voltage, right?

If so, before we can give any advice we must point out the potential risk for life and property when you are working with mains voltage without the required competence.
You may also run the risk to violate local regulations and/or lose insurance coverage.

2 Likes

You are right, I thank you for your suggestion.
For this reason I will ask a professional to make the final install.

Nonetheless I would like to complete the project hardware list in the safest possible way, this is the reason why I’ve decided to ask on this community forum.

Not only I have experts answering but also Photon specialists that probably have already been testing several different hardware solutions for similar applications.

Maybe is there a hat for this kind of tasks?
Or I could use a relay that is just using the mains on one side (like this, maybe: https://bit.ly/2OQDybb)?

@ltpitt, using mains wiring for low voltage is typically against code. Adapting the existing switch and wiring is a bad idea. You are better off replacing the existing switch with a digital timer designed and certified to work at your local voltage. Or use a myriad of fan-capable wifi switches available from Amazon or Aliexpress. I use a non-dimming wifi wall switch to have my exterior lights go on and off at sunrise and dusk. I can control the timing via an Android app and it integrates with my Alexa units.

Save yourself the risks and hassle and use a the right product for the job.

3 Likes

I’d second @peekay123’s suggestion.

However for the sake of pointing out options:

If you intend to use the Photon in a similar way to the linked Velleman relay, I’d assume you don’t intend to control the light but only the fan as a kind of slave to the light, right?

If so, and the light has some “considerable” current draw, one safe way to detect the state of the switch may be a non-contact current sensor that measures the magnetic field around the “hot” wire - alternatively you could use a light sensor.
And to control the fan, you could use a solid state relay.

1 Like

The whole plan was to turn an old “dumb” bathroom fan into the fan of my dreams.

  • Automatic fan turn on when light is turned on
  • Turn off fan after X minutes if light is off
  • Automatic fan turn on if humidity is more than X
  • Automatic fan silent mode (off) during night

All of this could’ve been quite doable with a Photon but I understand your suggestions, I will desist.

@ltpitt, using a Photon might still be possible and make for an interesting project. It may be possible to combine a switch like the one I proposed and use IFTTT and a Photon to control things. It also sounds like you have a separate switch for your light so you could “smarten” that up as well.

You could use your Photon to detect humidity and temperature and use IFTTT to publish the state of the fan/light back to your Photon. It could then fire off a publish to control IFTTT to turn off the fan and/or light. This is entirely conjecture on my part and someone with more IFTTT experience could provide better advice but it may be feasible, fun and SAFE to implement.

@ScruffR, any thoughts on this?

1 Like

That is interesting indeed.

At the moment being the light switch is connected to the fan:

If light is on fan is on, if light is off fan is off.

@ltpitt, that is typical of a single-circuit fan unit. I suspect there is a chain on the unit to control the light, correct? One way to be able to control your light separately is to use a WiFi bulb, which again, can be controlled via a phone app or IFTTT. However, there will not be a separate switch for the light and when you turn off the fan, power to the bulb will be cut. In review, here is what may be possible if you use a WiFi bulb:

  • Automatic fan turn on when light is turned on - This is how it works now
  • Turn off fan after X minutes if light is off - No since both fan and light use same power
  • Automatic fan turn on if humidity is more than X - yes
  • Automatic fan silent mode (off) during night - I believe so

I’m not sure there is any value to adding a WiFi bulb. The hassle is that the light will always be on when the fan is on.

As for the “smartening” of the fan with a separate smart switch, an important factor might be space. European wall outlets are usually smaller than American ones. So if there only is one of the standard outlets with 74/70mm diameter adding a separate switch might not be an option and I’m not sure if there are smart dual switches to fit in one of these.

But smartening the fan itself with a Photon, a non-invasive sensor and a solid state relay shouln’t be too much of a problem - the tricky bit might be to make a neat integrated power supply for the Photon.

@peekay123, another possible setup might be that the master is the light and the slave is the fan (which has it’s own power line) - but @ltpitt may need to clarify, what it actually is.
One common, cheap, non-smart delay setup is that you switch on the light, which also powers a secondary (hidden) switch which has some bi-metal “override” contact to keep the fan power on after the light is switched off till the bi-metal has cooled down again and subsequentially opens the override too.

With a similar setup (two hot wires) smartening a fan the way @ltpitt imagines should be fairly straight forward.

@ScruffR, the wiring configuration is typical and uses a single-circuit to control both fan and light. The only place these could be separated is IN the fan/light unit. This would require changing the wiring in the unit which would again, add risk to the project.

The power wiring TO the unit should not be changed to low voltage. Powering a photon from mains inside a wall switch is dangerous and imprudent IMO as it will not be certified or meet local codes. This limits the possibilities at the wall switch.

I wonder if this could be adapted to the task:

http://sonoff.itead.cc/en/products/appliances/sonoff-ifan02

2 Likes

I think you’ve found the best solution for this issue!

Sonoff has everything I’d need in a single and super cheap package.

Thanks :slight_smile:

@ltpitt, the wiring in the fan unit would need to be modified (as in done by an electrician) and I’m not sure the type of motor used would lend itself to speed control. The light being used would need to be changed to a dimmable LED type as per the module’s description. However, for such a low price, it is worth trying!

I’ve replaced most of the switches in my house with Insteon-compatible switches available on smarthome.com. When I went to retrofit my ceiling fan, there is a fan module that I was able to tuck away behind the large escutcheon plate that hides the electrical wiring. Unfortunately, the fan module wasn’t small enough so I removed the plastic enclosure and wrapped the electronic module in electrical tape. It works. And you can’t even tell the fan has a controller up in there. I have a 6-button switch on my wall with High, Med, Low, Off (for the fan) and 2 big buttons for the light (Light On, Light Off.)

With the Insteon setup, or the competing Z-wave or others, you could use a Photon to send the Insteon commands to the relevant devices (using a Power Line Module/Bridge). However, I chose to get an Insteon automation controller rather than re-creating the wheel. The controller has other integrations such as Alexa and IFTTT which is probably easier to interface with than recreating the protocols on the Photon. I can still say “Alexa, turn off the dining room” and I could always integrate with a Photon through IFTTT whenever I want to go deeper.

1 Like