Introduction: Use Spark.io Photon to Unlock a Door Over WiFi for Less Than $30!

This instructable is based on the Spark.io 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.

Parts:

Step 1: Setup Your Spark.io 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 Spark.io documentation is fairly easy to follow.

So, to get up and running go to http://www.spark.io/start/

Restoring Tinker (recommended for this project)

To restore your device to use the "Tinker" firmware please follow the instructions located at http://docs.spark.io/tinker/#tinkering-with-tinker-the-tinker-firmware

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 Spark.io 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 Spark.io Photon. Check out the Documentation to see what your imagination can "unlock."

Comments

author
JuanpeP (author)2017-08-01

do you have the diagram?

author
shashank7200 made it! (author)2016-02-21

Does my connection seems to be correct..?

PhotoChooser-2f3a4595-83ac-4ccb-bd2b-4b27eee66bbb.jpgPhotoChooser-41c25524-e7a3-4bc4-8e2a-f774eb2d458d.jpgPhotoChooser-7045a6c6-3294-4c8a-89df-9677e067cfed.jpgPhotoChooser-7691ae13-b5da-4ecc-8b20-c428cc6d4e94.jpgPhotoChooser-69677b30-a2cf-467a-b723-3ee049168109.jpgPhotoChooser-a62f8ef2-23fa-4392-bb7f-29a5ed79b530.jpg
author
whady (author)2015-04-08

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

author
electronut (author)2015-02-07

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

author
rwaldron4 (author)electronut2015-03-31

Correct, that's a Core. I have a Photon in front of me, which is pictured here.

spark-photon.jpg
author
asporkable (author)2015-02-22

Nice!

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

author
Bullfrogerwytsch. (author)2014-12-03

I think you could probably do it cheaper with an ATtiny.

author

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 Spark.io 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

author

Bullfrogerwytsch, The spark.io 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. :)

author

VERY cool and with great details!

About This Instructable

15,025views

80favorites

License:

More by keithbrown:Use Spark.io Photon to unlock a door over WiFi for less than $30!
Add instructable to: