Introduction: Google Home Ceiling Fan Control With Particle Photon

I bough a Harbor Breeze fan from Lowe's and went out looking for a cheap way to control it via my Google Home. The fan comes with a remote control so I figured it would be relatively easy to do so. I purchased the Particle Photon and looked for ways to get it to interface with the fan.

After much googling and a few failed attempts with other ideas I settled upon the task of activating the remote control buttons via relays. These would be set off by the Particle Photon. I then used IFTT to interface Google Home with my programmed Photon. My finished product is able to turn my fan off and on at the different speed settings and toggle the light.

So if you are looking to do the same this instructable is for you.

*This instructable is done with the assumption that you have an IFTT and Particle account. If you have not done so you may create them here https://ifttt.com/ and here https://ifttt.com/

*This can be copied and used to control other simple remotes as well

Step 1: Parts and Tools

You will need the following

  1. Harbor Breeze fan with remote control capabilities - I bought this Mazon model from lowes
  2. Particle Photon
  3. Power for the Photon via a USB cable and power adapter
  4. 5x - 3V Relay module - This model I purchased from Ebay has an issue with the way it comes made but there is a workaround explained below
  5. Small wires
  6. Soldering iron
  7. Solder
  8. Wire Stripper
  9. Small screwdriver

Step 2: The Wiring - From Photon to Relay

We will first get the relays wired up. As mentioned in the tools list, the relay modules I purchased have an issue with the way they are engineered as I found out thanks to DIYWaterDog. I followed his instructions and was able to get them to function. More on that in a bit.

The relays will have 3 wires going in and coming from the Photon. There will also be 2 wires exiting the relay and soldered onto the different "buttons" of the remote control.

It will be wired up as in the accompanying diagram.

Going into the relay is a VCC, a GND, and an IN.

GND will have a wire coming from the Photon's GND. This can be shared and jumped between relays.

VCC is the power being supplied from the 3v pin on the Photon that is used to power up the relay. This can also be shared and jumped between relays

IN is the wire running to the digital output pin on the Photon that is activated for each of the different functions. Each relay will need to have one of these wires run to a different digital pin on the Photon. I chose D1 through D5. However, as I mentioned earlier this relay came engineered incorrectly so instead of running the wire into the IN directly in the relay it needs to be soldered to a pin at the bottom as shown in the picture. Otherwise it will not activate.

I wired the pins as followed (will be used as a reference later):

  • Fan off to D1
  • Fan low to D2
  • Fan medium to D3
  • Fan high to D4
  • Light to D5

This completes the wiring from the relays to the Photon. Now comes the part where we go from the relay to the remote.

Step 3: The Wiring - From Relay to Remote

This step involves a lot of soldering. To start off take apart your fan's remote control. You want to get to where you have just the board. When you open it you will notice 4 red circles on top of small squares. This is what is activated when you press the button on the outside. You will have to solder 2 wires from each button to one of the relays. These relays then will "push" the button for you.

To do so you will need to find out where exactly on the board you need to solder the wires to. Each button has a 4 ends attaching it to the circuit board. To know where to solder you need to find which two ends would close the circuit. You may find this yourself or you may solder exactly as shown in the picture, being extra careful so as not to burn the board.

You may test to see if the proper pins were soldered by touching the ends of the wires to each other. If correct, the "button" will activate and you will see the fan respond, assuming you have the battery in.

Once you have all 5 buttons with the wires soldered to them you can now run the wires to the relay. One wire will go into the NO (normally open) pin on the relay and the other into the COM (common). It does not matter which one goes where.

If you look closely on the circuit board you can see a printed label that tells you which button is which. Match the buttons to the relays that are wired to the corresponding pins on the Photon. (See reference from last step)

Finally to clean it up and provide a more safe housing for the remote's board I placed it back in its case and ran the wires through the top openings as shown. If this is not wanted, at least make sure the battery is placed back on the board to provide power to it.

Step 4: Testing the Wiring

Assuming you haven't applied any custom app on the Photon, you should still have the Tinker program in place which you can use to test the relays via the original app.

Set the D1 through D5 pins to digitalWrite. Try setting off the relays by toggling the pins to high and back to low. If everything was done correctly you will hear the relays click and the fan respond.

If the test ran successful you may continue to the next step. If not check your wiring and soldering.

Step 5: Programming the Photon

You will now program the Photon using the Particle build website. You can download the program attached and copy it into Particle build to flash it to your Photon. I have left the code for the original tinker app intact so you can still use it as a kind of remote control on your phone as well.

*My particular fan model allows for light dimming. I started adding the code for this functionality but haven't fully tested it. However, I have left it there to work off of if you choose.

Step 6: IFTT and Google Home Integration

The final step involves using IFTT to integrate Google Home with your Photon. In it you will create 5 tasks that will call the functions in the Photon program and execute them according to the input you provide.

*These steps are done assuming you have an IFTT account and have also linked your Particle account to it. You may visit https://help.ifttt.com/hc/en-us/articles/115010158727-How-do-I-sign-up- for help.
  1. Open up your IFTT app and create a new applet.
  2. You will be brought to a screen that shows "If This Then That". Hit "This".
  3. Find Google assistant in the list and select it.
  4. Choose the "say a simple phrase" option and fill out the form. Once complete hit the checkmark at the top of the screen.
  5. You will be brought back to the "If This Then That" screen. This time choose Particle for "That".
  6. Select call a function
  7. Choose one of the functions from the list, depending on the command you are trying to complete. In the example I chose the fanControl function
  8. Enter the appropriate input for the command in the function you are trying to execute, in this case the low command
  9. Hit the checkmark and hit finish.

You must complete this 5 times for each of the commands you can complete.

Once that is done give it a try with your google home and enjoy!

Microcontroller Contest

Participated in the
Microcontroller Contest