Quantcast
Channel: SparkFun Tutorials
Viewing all articles
Browse latest Browse all 1123

Lockitron Hardware Hookup Guide

$
0
0

Lockitron Hardware Hookup Guide a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t393

Lock It up

The Lockitron Mechanical Assembly from SparkFun is a perfect solution for the DIY home automation or Internet of Things (IoT) enthusiast, whether you want to make your life easier by not awkwardly fumbling with keys or add some extra security in your home with three-factor authentication.

The Lockitron

Lockitron, the company, offers a complete solution that includes the mechanical assembly, embedded electronics that can connect to the Internet via Wifi or your phone over Bluetooth, and apps to control your deadbolt. That is definitely the easy, done solution to your automated locking needs.

But, you’re not here for easy, are you? What we have is the mechanical assembly, including motor and battery pack, to help you complete the automated security in your evil lair. An off-the-shelf solution just won’t cut it.

Covered in This Tutorial

In this guide, we will go over the guts of the Lockitron assembly and show you how to connect it to an Arduino Pro Mini. The Pro Mini, by itself, has no wireless capabilities. How you ultimately control your Lockitron will be up to you, whether it’s a tap sensor or through a WiFi connection.

Materials Used

In addition to the Lockitron Mechanical Assembly, you will need a few additional components:

Recommended Reading

Before getting started with the Lockitron, there are a few concepts that you should be familiar with. Consider reading some of these tutorials before continuing:

Lockitron Overview

Before we connect the Lockitron to anything, we should take a look at its internals to get an idea of what it does. Remove the black, plastic cover, and take a look at the inside.

Lockitron annotated internals

  • Motor Housing - This section contains the motor and gears necessary for rotating the outer ring.
  • Motor Wires - The + and - wires for controlling the motor.
  • Outer Ring - This ring has teeth around the edges so it can be turned via the motor. It also contains a number of “bumps” that the 2 bottom limit switches can use to determine its position. Additionally, it holds the inner ring in place and allows it to freely spin 90º.
  • Inner Ring - The inner ring can freely spin 90º within the outer ring. If the outer ring spins past this 90º stop, the inner ring will begin to spin with the outer ring (in either direction). This free spinning motion allows a user to manually lock and unlock the deadbolt.
  • Rubber Insert - This piece fits over the deadbolt’s thumbturn. It can be removed so that you can install the Lockitron on your door first before fitting the rubber insert onto the thumbturn.
  • Battery Holder - A place to put 4x AA batteries and power the rest of the Lockitron (and possibly your electronics).
  • Battery Wires - These wires (red for + and black for -) connect to the 4x AA batteries.

If you plan to wire up the limit switches (a good idea), now is a good time to remove the battery holder. Unscrew the two black Phillips screws from the bottom of the battery holder (underneath where the batteries would go), and carefully remove the holder.

Limit switches and button hole

  • Limit Switches - There are 4 limit switches that are pressed whenever one of the “bumps” on the rings moves by. The top 2 switches coincide with the “bumps” on the inner ring (orange), and the bottom 2 switches look for “bumps” on the outer ring (black).
  • Button hole - On the original Lockitron, a button stuck out of this hole that allowed you to configure the Lockitron’s wireless properties. Since we don’t have the original electronics, we are going to use the hole to route wires out of the Lockitron housing.

Lockitron annotated limit switches

We are going to assign arbitrary names to the limit switches so that we know what to call them in our code. We also recommend labeling the wires (e.g. with a piece of tape and a pen) that are connected to the limit switches. When we put the battery housing back in the Lockitron, it will be very difficult to see which wire connects to which switch.

  • 1A - First to be hit when the inner ring (orange) spins counterclockwise.
  • 1B - First to be hit when the inner ring (orange) spins clockwise.
  • 2A - First to be hit when the outer ring (black) spins counterclockwise.
  • 2B - First to be hit when the outer ring (black) spins clockwise.

Hardware Hookup

Hook up Wires

We first want to connect a set of wires to the limit switches, motor, and battery compartment. In the end, we should have something like the picture below. The following steps will show you how to get there.

Lockitron annotated wires

Connect Wires to the Switches

Unscrew the battery holder, and set it aside (if you have not done so already). Examine the limit switches.

Lockitron switch annotated

  • COM - Common terminal
  • NO - Normally open. The COM and NO terminals are connected when the switch is engaged.
  • NC - Normally closed. The COM and NC terminals are connected when the switch is not engaged.

Cut, strip, and tin 8x 6-8 inch wires (I used 4 green and 4 yellow wires). Solder them to the outermost terminals on the limit switches. We will be using the COM and NC terminals.

Solder wires to Lockitron limit switches

We recommend you label the wires so you know to which switch it is connected. In this instance, I tagged all the yellow (COM) wires with their respective switch (1A, 1B, 2A, 2B). I plan to connect the green wires (NC) all to ground and the yellow wires (COM) to individual Arduino pins.

Tags on wires for limit switches

Extend the Motor Wires

Cut, strip, and tin another 2x 6-8 inch wires for the motor. Use your favorite wire splicing technique (here are some good ones: 1, 2, 3) to connect to the motor wires. I used red and black to keep with the + and - theme.

Wires to Lockitron motor

Extend the Battery Wires

Once again, cut, strip, and tin another set of wires for the batteries. You will need 2x 6-8 inch wires. Use your favorite splicing technique to connect to the battery wires. I used red and black wires to connect to + and -, respectively.

Wires to Lockitron battery compartment

Route Wires out of the Housing

Carefully pull all the wires through the button opening in the housing.

Routing wires through Lockitron button hole

Solder Headers

Solder headers onto the Pro Mini and Motor Driver board. Don’t forget to add headers to the programming port of the Pro Mini (the part where you attach the FTDI breakout).

Arduino Pro Mini and motor driver board

Attach Everything to a Breadboard

Attach the Pro Mini, Motor Driver board, and 2 buttons to the breadboard. Connect the wires from the Lockitron to the breadboard and add additional wires as shown.

Lockitron Fritzing diagram

Replace Battery Holder

Screw the battery holder back in place, making sure that the limit switch wires do not get caught underneath. Do not add batteries at this time.

Lockitron battery compartment

Example Code

With all of the wires connected, we can upload some code to the Pro Mini.

Example Sketch

Plug in the FTDI breakout to your Pro Mini, and connect a USB cable from it to your computer. Run the code from the Codebender window below, or copy and paste it into your Arduino IDE.

Run

Once the program has successfully uploaded to your Pro Mini, disconnect the FTDI breakout from the Pro Mini. Add 4x AA batteries to the battery holder, and the motor should rotate to a “home” position.

Lockitron controlled with an Arduino

Try pushing the two buttons to mimic the “lock” (top button) and “unlock” (bottom button) functions.

Running the Lockitron Arduino demo code

Installation

The fine folks at Lockitron made a fantastic video showing how to install the Lockitron device. We skipped past the first 1:14 of the video, which shows how to connect the Electric Imp in the housing to WiFi (we don’t need that; we made our own electronics!).

If you want to mount the breadboard next to the Lockitron, you can use the sticky tape on the back of the breadboard or add your own tape/glue.

Lockitron and breadboard mounted on a door

We’re using an RFduino in this picture, but the idea is the same.

Once you have everything working, you can always enclose the electronics for added security.

Resources and Going Further

The Lockitron is a great way to add some advanced technology to your door and venture into the world of home automation. This guide, hopefully, helped show you how to use the Lockitron Mechanical Assembly. From here, the possibilities are endless on how you want to control your door:

Resources

Other Tutorials

Need inspiration on how to interact with the Lockitron? Check out these tutorials:

Bluetooth Basics

An overview of the Bluetooth wireless technology.

SparkFun RFID Starter Kit Hookup Guide

Learn the basics of Radio Frequency Identification (RFID) and how to get started with the SparkFun RFID Starter Kit.

BC118 BLE Mate 2 Hookup Guide

Hooking up and using the BLE Mate 2, which uses the BC118 BLE module from BlueCreations.

ESP8266 Thing Hookup Guide

An overview of SparkFun's ESP8266 Thing - a development board for the Internet of...Things. This tutorial explains the circuitry driving the board, and how to get it up and running in an Arduino environment.

learn.sparkfun.com |CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado


Viewing all articles
Browse latest Browse all 1123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>