Introduction: Photon Deadbolt

In this instructable you will learn how to make my variant of a wireless deadbolt powered and controlled by a Particle Photon.This project has multiple components to it in order to allow the device to be controlled by a wireless device, such as a phone, using the IFTTT mobile app. This intention of this project is to create a lock for a door that can be programmed through particle and sent wirelessly through the use of IFTTT to the photon that will allow the user to have physical access to the device to input the pass code to move the deadbolt.

Parts to replicate this project:

  • Particle Photon
  • Breadboard
  • 4 buttons
  • 3 LEDs
  • Servo
  • 4 resistors (10k ohm)
  • 4 resistors (330 ohm)
  • Wiring

*Additionally an account through both IFTTT and Particle will be required to access their environments.

Step 1: Setting Up the Photon

The first step to building this project involves setting up the Particle photon. In order to do this the photon must be plugged into a power source and should initially blink green. Once you have the photon ready it must be put into listening mode, which can be done by holding the setup button until the light begins to pulse blue, as shown in the attached video. Now it is time to pull up the mobile Particle app. Once in the app you must log in and then select the option to add a photon. Here the photon you have should be found under the available devices. The next step is to connect the photon to the internet which simply involves inputting the wifi password. After a moment the photon should be all set and ready to push code.

Step 2: The Board

The next step in the process is to configure the breadboard. For this project the components that will be connected include: 4 buttons, 3 LEDs, the photon and a servo.

The photon:

In order to set up the photon on the board it must be set across the middle of the board in order to have access to the pins on either side. Place it preferably flush against one side of the board.

The Servo:

To connect the servo there are three cords extending out from it. The red cord is the power cord and is to be plugged into the VIN slot on the photon. The black cord is connected to GND on the photon. The white/yellow cord plugs into the digital pin of your choice, in this case D0.

The LEDs:

In order to connect an LED to the circuit it must be placed in any free location on the board. The negative edge of the LED is to be connected to the ground of the circuit, via the 330 ohm resistor. The positive edge of the LED is connected to the digital pin selected for that LED. This is to be done the same for each of the LEDs.

The Buttons:

The buttons are to be connected to the circuit in an open location, similar to the LEDs. One pin of the buttons is connected to both a 10k ohm resistor and a wire. The resistor is to be connected to the positive edge of the breadboard (the one connecting to the 3V3 on the photon). The wire is to be connected to the appropriate digital pin for the button on the photon. the pin adjacent to the one being used on the button is to be connected via wire to the negative edge of the breadboard, connecting to ground.

***Note that in order to access the LEDs and the buttons through a container for the circuit, both the buttons and the LEDs will need to be soldered to additional wire to add extra length.

Step 3: The Code

Now that the hardware is all set up it is time to create the code that will run the devices actions. In order to make the code work through a mobile device you need to allow particle to have access to your IFTTT account. This is done by adding certain pieces of code to the particle code.

Inside of the void setup(), you need to add a line of code to initialize the function, in this case 'gong', that will be called to listen for calls from IFTTT.

Particle.function("gong", gong);

Inside the function you must listen for any commands that will be called from the IFTTT app. This is done by creating simple conditional statements to allow the device to listen for specific commands from IFTTT.

if(command == "command_name") {//execute code}

These commands are only accessible if the mobile device is setup to allow IFTTT to send commands. This is done by creating a simple recipe in IFTTT that involves waiting for an action from a button press (this button is created through widgets on an android phone) and then calling a function after that event occurs. Once you select the applet to call a function you select the function found in your particle code and then enter the function name that will be called after a button press. Once this is complete you should be able to call functions within the particle code through the button widgets provided by the IFTTT app on your device.

**Because this project is primarily focused on the concept in general, an entire walk through of the code will not be available, however attached bellow is the completed code. This only walks through the code that works alongside the IFTTT app that allows the device to be controlled through wireless connection.

Step 4: Final Product

Now you have gone through the entire tutorial, and this is where creative freedom takes place. Depending on the needs of this device a container for the hardware may be necessary. If the buttons and LEDs have been soldered to extending wires that should allow easy access to the physical components that make this device possible.

Attached bellow is a video of the completed project working.


DIY Hacks and How Tos (author)2017-02-26

Cool design. You should enter this into the Microcontroller contest.