Introduction: Particle Photon - LockBox

This guide will allow you to make your very own lock box using a solenoid and a particle photon! You'll be able to unlock and lock your box using the app "Blynk".

Step 1: You Will Need

Electric Components:

(1) Particle Photon with Headers ($19.00)

The Particle Photon is a powerful device that will allow you to connect to the WiFi.

(1) Mini Push-Pull Solenoid - 5V ($4.95)

A solenoid is a coil of wires that, when charged, acts like a magnet.

(1) TIP120 Power Darlington Transistor ($2.50)

(1) 1N4001 Diode ($1.50)

(1) 220 ohm Resistor ($0.75)

(1) Mini Breadboard ($4.00)

The Particle Photon fits nicely on the mini breadboard, and the wiring doesn't take up too much space.

Total: $32.70

Other:

A Box

This is your box, so customize it however you'd like! For this project, I made a cardboard box simply because it was a resource that was easily accessible to me. It can be made out of wood, metal, or plastic, but it does add complexity to how it is made.

Glue

Any is fine!

Wires

Sizes can vary if you use a wire cutter/stripper.

Fabric

if you want to decorate your box!

Of course, cost will vary, depending on how many of these materials you already have.

Step 2: Wire Up

The wiring isn't complex at all and should fit into a single mini breadboard. It would be advised to use a mini breadboard if you plan to make your box small and to maximize the amount of space you have.

The Solenoid will be used in the port A0

Step 3: Blynk & Particle

If you haven't done so already, download both the blynk and particle app on either your Android or IOS device. Both of these apps are free!

PARTICLE

Follow this handy dandy guide to connect your photon to your smartphone.

PARTICLE.IO

Then go to "IDE" on this site. Login using your particle email and password.

BLYNK

Once you download the "blynk" app and sign up for it, scan this QR code to access to the project that controls the solenoid remotely from your smartphone.



Step 4: The Code

#define BLYNK_PRINT Serial 
#include "blynk/blynk.h" 
// You should get Auth Token in the Blynk App. 
// Go to the Project Settings (nut icon).
char auth[] = "YOUR AUTH TOKEN HERE";
void setup()
{
    Serial.begin(9600);
    delay(5000); // Allow board to settle
    Blynk.begin(auth);

}
void loop()
{
    Blynk.run();
} 

To connect the Blynk app to this code go to the settings (the nut icon) and hit "Email All". Your AUTH Token will be emailed. It's a long string so copy and paste it into the code.

Finally, "Flash the code" on the particle site so that your photon saves the code into its system.

Step 5: How Will It Work?

Now that we have the "technology" component done, we need to work on the physical aspect of this box.

The Solenoid

The solenoid has two states: powered and not powered. When our box is locked, it will not be powered (so it doesn't waste energy!) The only time we will power the solenoid is to either open or lock it. How does this work?

In the first image the box is completely open and the solenoid lies in the hole below the red loop. In this state it is not powered, so if the lid is pushed down it won't close because the solenoid is in the way. To power up the solenoid, open the QR code project you got earlier. Simply tap the button labeled "Solenoid" to power it up.

The gif above shows the solenoid being powered. For the box, the wire loop will go down to where the solenoid coil is, so that when the solenoid is powered off, the coil goes into the loop. This way when the lid is pulled upwards, the loop will be blocked by the solenoid therefore the box will be "locked".

The measurements- The coil is roughly 0.3cm, so the loop must lie within this range so that when it is powered off, the coil will line up with the loop.

Step 6: Layout

The sample box I made out of cardboard is 22cm by 23cm and 4cm high. The first picture shows flaps to the side to allow me to easily form its rectangular structure. Of course your box may look different but the locking mechanism will be the same.

The second picture shows how the mini breadboard will lay and be attached (using the adhesive side) to the front flap of the box. The USB cable is shown to go around the left corner of the box and out through a hole I cut to give the USB a snug fit.

The third picture is more critical to how the solenoid will be placed. The red breadboard is where the particle photon is, please ignore the green breadboard (this was done to even the weight but it is not a critical component). As you can see, a second wall was made to allow the solenoid to be glued on. This will make the solenoid more static as when it is powered it moves.

Step 7: A Box That Will Lock

The first image shows the box locked, while in the second it is wide open. Any type of bendable metal can made to use as the loop that will go into the solenoid. Use a sturdy adhesive to prevent it from wiggling out of the solenoid's range. Attach this loop to the lid of the box and make sure it is in prefect line with the hole (in this case it's the cardboard roof that hides the breadboard) and the solenoid.

I used just a solenoid and a wire loop to lock the box because it cut down the complexity of coding and it is mainly a physical project that was fun to make! Decorate your box however you'd like!