Use Photon to Unlock a Door Over WiFi for Less Than $30!




This instructable is based on the Photon, a "postage stamp-sized hackable WiFi module for interacting with physical things." And thanks to its AWESOME mobile UI "Tinker," you won't have to write a line of code!

Its the result of an "Instructables Build Night," with Soha Smart; where I am also a board member and teacher.

We are going to control a 12V Solenoid using one pin from this Arduino based device.


Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Setup Your Photon

New Device with Tinker Firmware

If you're just taking your Photon out of the box you're going to need to name your core. The easiest way to do this is on your mobile device (I used an iPhone). I'm not going to go over how do this, since documentation is fairly easy to follow.

So, to get up and running go to

Restoring Tinker (recommended for this project)

To restore your device to use the "Tinker" firmware please follow the instructions located at

Step 2: Wiring the Circuit

Note: You're going want to setup your breadboard with a 12V rail (the side red and blue lines) and a 5V rail. The 12V is to run the solenoid and the 5V will power the Photon

Using a diode?

In the diagram, there is a diode parallel to the device we are powering. Any time you are powering a device with a coil, such as a relay, solenoid, or motor, you need this guy, and don’t leave home without it. What happens is when you stop powering the coil, a reverse voltage, up to several hundred volts, spikes back. This only lasts a few microseconds, but it is enough to kill our transistor. So this diode (only allows current to pass one way) is normally facing the wrong direction and does nothing. But when that voltage spikes comes flowing the opposite direction, the diode allows it to flow back to the coil and not the transistor.

...A transistor (TIP120) too?

Transistors are are 3 lead components that have 2 simple functions, to switch or amplify (this time it's setup as a switch). You basically have an "in" called the Collector, an "out" called the Emitter, and a "controller" called the Base. When you send a HIGH signal to the base (control pin), the transistor switches and allows current to flow from the collector (in) to the emitter (out).

So we connect it so that our solenoid is connected to V+ but not ground (V-). Ground is connected to the transistor’s collector. When our Photon sends a HIGH signal to the transistor’s base, it switches the transistor (connecting the collector and emitter) and completes the circuit for the solenoid.

We are using a 2.2K resistor to limit the current to the correct value to run the transistor.

Is the Solenoid pushy?

  • To setup your solenoid to "Pull" connect the GREEN wire to V+ and the BLUE wire to the transistor's collector.
  • To setup your solenoid to "Push" connect the GREEN wire to the transistor's collector and the BLUE wire to V+
  • Basically, reverse the wires if the solenoid is working in the wrong direction...

Step 3: Tinkering With "Tinker" and the Photon - Unlocking a Door!

Assuming that you can connect to your Photon from your mobile app. All that is left is to connect D6 in "Tinker" to write either HIGH or LOW.

Program Tinker:

  1. In "Tinker" tap on D6 and select "digitalWrite."
  2. Tap anywhere on the screen to confirm.
  3. Now tap on the D6 button. You should see the word "HIGH" next to the button indicating that the pin is "on."

Congratulations you just "Opened a door" with your Photon!!! (assuming you attached the solenoid to a door's lock, that is...)

Step 4: Going Further With Your Photon!

Where do you go from here?

You might have noticed that the solenoid only either "pushes" or "pulls" based on how it is wired to the circuit. Creating an H-bridge within the current circuit will allow you to control both directions of the solenoid. Essentially, allowing you to "lock" AND "unlock" the door.

The possibilities are endless!

This instructable was a very simple example of what is possible with the Photon. Check out the Documentation to see what your imagination can "unlock."

1 Person Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

9 Discussions


2 years ago

do you have the diagram?


4 years ago on Introduction

can I control the Spark Photon using an android app create by me?


4 years ago on Introduction

Isn't the photo above that of a Spark Core rather than Photon? I though the latter is out only in March 2015.

1 reply

4 years ago on Introduction


Now set up IFTTT to automatically unlock your door as soon as you arrive home and lock it when you leave!

Have fun :) While the RFM12B is about $8 and you could use an unmodified version of the JeeLib library; you'd have to still write a website or app to control the now single use Attiny84 to read or write to the one pin still available. While you saved about $11, you just created hours of work for yourself...You'd have to create a handful more Attiny wifi enabled chips to do individual jobs, while hopefully keeping them networked together and speaking to one another. In reality, your project just got exponentially more expensive... The Photon comes with a free mobile application and web server. Also, with the spark you have 17 more pins to use, and you haven't limited yourself to prove a point - not to mention, I built this project in 10 minutes...But, best of luck! Create an instructable about it - I'd love to read it. Thanks for the comment

Bullfrogerwytsch, The Photon connects to the smartphone over wifi and can also be programmed over a wifi connection. While the ATtiny is awesome, its a PITA to connect via Wifi and $12 more expensive for the extra hardware. :)