RGB Combination Doorlock - Phase 1: Planning and Picking

Several years ago while browsing LED based projects on Instructables and Hack-A-Day I stumbled upon the holy grail of geeky projects. At the time, not knowing anything about the Arduino I brushed it off as "over my head". In early November as my Programming Language Concepts class was switching from Racket (a lisp based programming language) to Occam we were instructed to design a simple project using the Arduino and program it in said language. Thus this project was born.

To start, let's find the original Hack-A-Day article I saw years ago... Ahhh, here it is!

I will be sticking with their keypad design for several reasons. The 2x4 keypad perfectly fits inside a typical double gang wall box, the pass-code will be easier to remember, and I am using a Freeduino (look here for more information) so I have limited I/O pins to work with unless I want to use shift registers.

The Freeduino doesn't come assembled so you'll have to do it on your own, much more fun!

From Tutisduino Build

If it looks like this assembled, more than likely you did something right (minus the writing on the upper left of course).

From Tutisduino Build

Next up: The schematic

To keep things simple I used the schematic from our handy Hack-A-Day article, but modified it before prototyping. Their design calls for two separate circuits, but mine will use three: Keypad, LED grid interface, and the door strike circuit, don't forget, the Arduino is a circuit too, but we don't need to build that from Scratch.The additional circuit is present due to the fact that I don't want on board voltage management built into this. The Arduino already does this and I will be using those outputs, so there is no need for duplicate hardware.

Starting with the keypad circuits: The breakout board from Sparkfun already nicely lays out the buttons in a two layer row/column grid. When the button push is read the Arduino will bring one keypad input line high and checks whether voltage is present at each of the four output lines per row. The diodes that we will solder on this board prevent feedback across the circuit. The schematic from sparkfun uses a bus to clean up the wiring and nicely shows the layout. Because we are only using a half board I only included exactly the remaining board pieces.

From Tutisduino Build

As per my design specifications above, and the one in the linked article we will be driving the RGB LEDs using their own circuit. The brightness of each color in each LED is controlled by the digital resistor. This device allows us to adjust the intensity of the individual RGB colors giving us the ability to make many different colors, as well as adjust the brightness of those various colors. A digital resistor works similarly to a traditional potentiometer, but the chip is controlled by the Arduino instead of an outside user adjusting it with a screwdriver. Each column needs to have the ability to be turned on and off individually, this is where our LED selection circuit comes in. This circuit has a transistor for each of the four columns; by rapidly changing the resistance with our digital resistor and turning on and off the individual columns each LED can be controlled separately.

From Tutisduino Build

Since I plan to use the Arduino to power everything, we won't be able to directly power the door latch as this model (as most) pulls around 1.5a at 6v. I just reused the circuit provided, which uses a TIP120 transistor to supply the power to the latch. Seeing as though the transistor can only handle DC voltage with a maximum continuous current of 5A I decided to change this to be more flexible and allow low voltage AC current also, as most door latches are AC/DC combination or strictly AC powered. To handle this I added a 5VDC relay from Radioshack that can handle up to 120VAC at 5A so we can use either power source. This is a mechanical relay and it uses an energised coil to open and close the contacts. When power is removed from a coil a current is created from the breakdown of the magnetic field. To keep this from burning out the transistor I left the diode intact to handle the surge.

From Tutisduino Build

In addition, when the latch is first activated we will experience a temporary voltage drop which may reset the Arduino in some circumstances. I added one additional diode and a capacitor to even out the voltage drop which is shown in the final schematic below.

From Tutisduino Build

The latest version of the schematic for this build is available for download on the project page. Feel free to modify and use it at your will, but please provide feedback in the comments below where you find necessary!

Now that the design work is complete let's put together a complete parts list. The one available on the reference site is mostly applicable, but remember, some of the parts have been swapped out and some new ones are being used. In addition I am giving a full list of every part (and some tools) you will need to complete the final product, which should end up being mounted in a wall.

To start the build you will need the following (links provided):

The circuits
1 - An Arduino or compatible clone
1 - An electric door strike
1 - 1N4001 diode
10 - 1N4148 diodes
1 - TIP120 transistor
4 - 2n2222 transistors
1 - 5v DC Micro Relay
4 - 100 ohm resistors
2 - 150 ohm resistors
1 - 560 ohm resistor
8 - 1k ohm resistors
1 - AD5206 (If using my boards: Model AD5206BN10, samples available!!)
1 - 100µF Capacitor
1 - 4x4 Button Pad
1 - 4x4 Button Pad PCB
8 - RGB LEDs (Common cathode only. I didn't use diffused but they would probably work better, same price)

From Tutisduino Build

If you are using my board you will also need this:
1 - Arduino Stackable Header Kit
2 - 2-Pin Screw Terminals (2.54mm Pitch)
1 - Solder Strip Female Headers (Will cut to size later on)

From Tutisduino Build

Additional parts needed for mounting this beast:
1 - Sheet of 1/16 plastic (I used ABS, cheaper and two part epoxy still adheres well.
1 - Single-gang, old construction, low voltage outlet box
1 - Double-gang, old construction, low voltage outlet box
Two part epoxy (This stuff sets FAST, don't get it on your fingers, trust me)
1 - One port, single gang, keystone wall plate
1 - Snapin keystone, USB A/A
1 - Two-gang blank wall plate
1 - USB A to Mini-B Cable (Interface between Arduino and wall plate)
1 - USB Type A Male / Type A Male Cable (Interface between wall plate and PC for programming in-wall
6 - Screws (For mounting the keypad in the box)
1 - Pack of nylon standoffs (Used as nuts for the screws, they can be trimmed easily)
1 - DC Barrel jack connector
1 - DC power tip (make sure type matches barrel jack you get)
1 - Switch of your choice (To power on and off from control panel. I used a cool keyed switch for this.)

**I don't have a picture of this stuff. I was over-ambitions and built this forgetting to take photos along the way.**

Miscellaneous supplies:
Lots of jumper wires
IC puller (I didn't use one but you have to be very careful when pulling the IC out of the board, bent pins = bad)
Some random LEDs for debugging.
Lots of 20 gauge wire
Wire strippers
Wire cutters
A good multimeter
Soldering iron, base, and sponge
Lead free solder (PCB is lead free, easier to flow joints if it matches)
Heated exacto knife (unheated is fine, just more tedious to use)

From Tutisduino Build

... oh, and don't forget a door to install this into.

Do you FINALLY have everything? Too anxious and want to look ahead?
Check out Part 2 - Building the Prototype