Particle Photon + RF Outlets + Echo Dot | Pt.1

Check out this short tutorial on putting together your own home automation setup using an Amazon Echo or Echo Dot (optional), a Particle Photon, RF transmitter/receiver, a breadboard and wires, some Etekcity 433MHz power outlets, and a little elbow grease.


About a year ago, I followed Sam Kear’s awesome guide to set up my first attempt at some home automation. It was perfect. I had high hopes to use a Raspberry Pi to control my RF lights and outlets from a simple web page controller. The sky was the limit at that point. And, I decided I was all in.

I bought a cheap RCA Android tablet to mount on the side of a cabinet to control said lights/outlets via the web interface. I bought another Raspberry Pi in order to run voice activation using an open source library, Google vocal recognition, and the Alexa Voice Service for responses. After the new Pi failed to meet my standards for voice, I again dished out some cash for 3 greatly discounted Android phones to run some simple “OK, Google” tricks for sending web requests to my controller page. And again, of course, I found out that the Android microphones are anything but equipped for far-field and can barely hear commands even from up close. Bummer, dude. The investment was stacking up, and I was no closer to my goal.

And then, the Echo Dot became a reality in early March 2016. Shedding most of the Echo’s height and weight, the Dot is no bigger than a hockey puck, but packs the same far-field microphone punch and Alexa usage for a fraction of the price: $90 $50 before tax to be exact. As Sam Kear points out, though, part of his setup was centered at the aim to save money as compared to the traditional Belkin or Philips smart lights. So, the Dot may not be a budgetable item for this project, but adding it in will wow your friends and impress your family – always a worthy cause.

In the couple months since the Dot surfaced, I also stumbled onto the Particle IO team’s website, originally known for creating the Spark Core. They are now offering something called the Photon – a fairly inexpensive Arduino-like chip meant to run a single firmware program, but is always connected to the cloud via WiFi.

Here, I’ve compiled all aspects of my new project into this post (and a Part 2 to follow) including a schematic, some screenshots, and code repos for creating your own setup. So, without further ado, let me break it down.

Parts and Prices

Part Price
Particle Photon w/ headers $19 (~$28 after shipping)
Micro USB Cable $4
Breadboard + Wires $6
433Mhz RF transmitter and receiver $3
5 RF Outlets $30 ($6/outlet)
Amazon Echo Dot (optional: see Part 2 steps) $90 $50
Total $71 ($121 w/ Dot)

Other materials:

  • Android or iPhone smart phone – for setting up the Particle Photon (and possibly your Echo or Echo Dot)


Step 1: Connect Particle Photon to WiFi

After receiving your Photon in the mail, tear that packaging open (be careful though – there’s not much there) and plug it in with a Micro USB (b) style cable to either a computer or an existing cell phone charger plugged into a wall outlet.

The Photon will power on and start blinking a bright blue in order to let you know it’s ready for setup. From here, use the Particle iOS or Android app to bring the Photon onto your home or local WiFi. Particle has a pretty good walkthrough (at least Steps 1 & 2) for it also.

Step 2: “Mix” in breadboard, RF transmitter/receiver, and wires


If you’re not a computer engineer, this step looks intimidating because…electricity…circuits…maybe breadboards that have nothing to do with wheat-based food products. Believe me, it’s not. The breadboard is simply a far easier way to prototype circuits which haven’t yet been soldered or connected straight together. It’s a really useful piece of hardware and definitely less complicated than I thought after pondering that I was getting in over my head when I bought it.

The basic principle of the +/- columns on the outside are one straight line or “rail” that connect the circuitry of anything plugged into the holes on that line. The rows of numbers on the central section of the board labeled with columns as letters operate slightly similarly. Each row hole is connected to its respective row except where the center separator has split the board down the middle. See the illustration below:


For our purposes, the Photon will be situated at one end of the breadboard evenly spaced on either side of the center line of the board. From there, you’ll add on the RF transmitter and receiver and the wires as connections between holes. Each solid colored line of the schematic represents a separate wire. See the finished schematic below:


The lightning bolt denotes that the RF transmitter needs its own wire to act as an antennae in the corner either twisted or soldered to the hole on the transmitter. You can see an example of this change via Sam Kear’s tutorial image here:


Step 3: Flash the Photon firmware

Next, you’ll need some firmware on your Photon in order to record the RF codes sent from the clicker that came with your outlets or other RF devices. You can copy my .ino file and use it in the Particle Build tool available after you log into your Particle account. Create a New App there (name the file whatever you like; mine is thecantina.ino) and copy in the source code.


To record RF codes, you won’t need to modify any of the .ino file. Simply hit the ‘Verify’ button to compile it, and once finished, hit the ‘Flash’ button. Your Photon will download the firmware from the cloud and restart with some different blinking color LEDs. Once it gets back to a “breathing” light blue, you are set!

Step 4: Plug in the Outlets

Do it. Plug ’em in. I dare you. I triple dog dare you. I know, I know…breach of etiquette. OK – but seriously. You bought them. Go nuts!

Step 5: Discover the Outlets’ RF codes

The Particle Dashboard is a great place to see what exactly is going on on your Photon since I’ve set up a lot of its actions to include log messages that are sent to the cloud. Any RF codes picked up by your RF receiver and Particle Photon will register here. So, grab that outlet remote clicker, get close to the Photon, and uncover those codes just like a pirate looking for buried treasure. Except, X never marks the spot.

Step 6: Update the .ino file

A couple places in the .ino file should be customized to your outlet and room setup. Defined at the top of the file are RF codes (my own outlets) that you should switch with your own.

// This #include statement was automatically added by the Particle IDE.
#include "RCSwitch/RCSwitch.h"
#include <string.h>

//CUSTOMIZE HERE: change the RF codes and their naming conventions here
#define OFFICE_Light_1_Toggle 87489 //these are light bulb holders that use a toggle code instead of individual outlet on/off codes 
#define OFFICE_Light_2_Toggle 87345
#define OFFICE_Light_3_Toggle 87309

#define LIVINGROOM_Light_1_On 5330227
#define LIVINGROOM_Light_1_Off 5330236
#define LIVINGROOM_Light_2_On 5330371
#define LIVINGROOM_Light_2_Off 5330380
#define LIVINGROOM_Light_3_On 5330691
#define LIVINGROOM_Light_3_Off 5330700
#define LIVINGROOM_Light_4_On 267715
#define LIVINGROOM_Light_4_Off 267724


Secondly, the if/then/else statements should be changed to reflect your room logic. For example, I have living room, bedroom, and office outlined here. You may want to include ‘kitchen’ or ‘family room’ in which case you’ll need to modify those statements using a similar format to mine.


//CUSTOMIZE HERE: use your naming conventions and RF code definitions in this if/then/else to perform the logic you'd like to see.
    //(i.e. send multiple codes in order to turn a group of outlets on/off)
    if (strcmp(room_location, "office") == 0){
        if (light_number == NULL){
            switchTx.send(OFFICE_Light_1_Toggle, 24);
            switchTx.send(OFFICE_Light_2_Toggle, 24);
            switchTx.send(OFFICE_Light_3_Toggle, 24);
        }else if (light_num_val == 1){
            switchTx.send(OFFICE_Light_1_Toggle, 24);
        }else if (light_num_val == 2){
            switchTx.send(OFFICE_Light_2_Toggle, 24);
        }else if (light_num_val == 3){
            switchTx.send(OFFICE_Light_3_Toggle, 24);


Step 7: Re-flash the Photon firmware

After you’ve updated the .ino file with your own RF codes (and room logic), verify and flash your firmware via the Particle Build IDE just like in Step 3.

Step 8: Create a Web Server and outlet controller page

The one advantage to Sam Kear’s setup is that the Raspberry Pi can double as a web server making it a cinch to host a web page that controls your outlets. The Arduino nature of the Particle Photon means it only runs a single program – the task to create a web server on it would be pretty involved and far beyond the scope of what I tried to put together here.

The HTML, Javascript, and PHP files from my Trick Candles repo should be all you’ll need to control the outlets. Obviously, customize and rename the creds-example.php file to match your Particle login credentials. And, customize the index.html to match your outlet/room setup.

<!-- index.html that may be customized -->
<label>Office Lamp 1</label>
    <div class="btn-group btn-group-justified" role="group" aria-label="...">
      <div class="btn-group" role="group">
        <button type="button" data-outletId="1" data-outletStatus="on" data-outletLocation="office" class="btn btn-default btn-lg toggleOutlet">On</button>
      <div class="btn-group" role="group">
        <button type="button" data-outletId="1" data-outletStatus="off" data-outletLocation="office" class="btn btn-default btn-lg toggleOutlet">Off</button>

As for hosting the pages, a couple of solutions exist. One would be to use web hosting from a company like HostGator or BlueHost to serve the page. Be sure whoever it is can serve PHP pages, as well. Or, if you are feeling brave (kudos!), you can host it yourself. Some great tutorials exist on how to set up your own web server from your house computer. If you are running a Raspberry Pi at home – even better – Sam Kear’s tutorial includes a quick section (Step 3) on adding Apache + PHP to your Raspberry Pi.


Test It

Once you have the HTML, Javascript, and PHP pages hosted on a web server, navigate to your server’s address via a web browser and smash some buttons to see if your setup is functioning like it should. A lot of troubleshooting can be done using the Particle Dashboard log messages, but if you do have trouble that is becoming a roadblock, don’t hesitate to comment here for help.

Part 2: Adding Amazon Echo

Additional Resources

  • Sam Kear’s Post
  • Particle Photon Datasheet
  • The Hack-a-Joe team has created Hook that is the all-in-one buyable option to the Photon + RF transmitter/receiver + wires + breadboard + USB cable portion of this tutorial.
  • If you have any questions, feel free to drop them in the comments!
  • Finally, here’s a video of controlling the outlets (lights) using a web page. Proof you can do it too!

Leave a Reply

Your email address will not be published. Required fields are marked *