Introduction: DIY Datalocker

How to turn and ordinary external harddrive into a datalocker using only a PIC microcontroller, a keypad and some various other components.

Step 1: Parts

The parts you need:

- 3.5" SATA harddrive enclosure
- 2.5" SATA harddrive

NOTE: This will not work with a 3.5" IDE enclosure and a 2.5" IDE drive without a special adapter, they have different connectors.

- LED with resistor to power it from 5 Volts
- 3x4 Matrix keypad
- 470 Ohm resistors (4x)
- PIC 16F628A microcontroller
- 5 or 6 Volt relay, 1 Amp should be enough
- 1N4148 diode (Without this you will fry your USB port)
- BC337 transistor (or similar)
- 2K2 resistor
- Some prototyping board


- Hot glue gun
- Soldering iron and solder
- Double sided tape

Step 2: Preparing the USB Board.

First you need to disassemble the hard drive enclosure and take out the board.

Then you have to desolder the power connector and solder wires where the connector was.

After you have done that, solder the pin on the back of the power connector to the corresponding wire.
(The one that is now where the pin on the back of the connector used to be)

Last, solder wires to the other two pins of the power connector.

Step 3: Finding a Power Source for the PIC

Now you need to find a way to power the PIC.

I think the easiest way is to solder wires to the usb connector. If the connector on your board is a SMD type and/or the pins are hard to reach, find a solder connection that is connected to the correct pin of the USB connector.

I chose to solder a wire to a via (a little hole in the board that carries a trace from one side to the other) for the positive connection and another one to the metal shielding of the USB connector for the negative connection.

The second picture shows the connections on the different types of USB connectors.
1: Positive
2: Data -
3: Data +
4: Ground (negative)

Step 4: Build the Circuit

Build the circuit that will be controlling the drive according to the schematic.

The design, as well as the code for the PIC are based on this

The circuit is built around the PIC 16F628A microcontroller, which needs to be programmed with the attached HEX file.

Build the circuit but do not connect everything yet! (see the notes on the schematic)

Step 5: Cutting the Circuit Board to the Right Size

Before we connect all the wires, we need to cut the circuit board to size, it would be difficult do do this afterwards.

Start by planning where you are going to connect all the wires, mark where you are going to cut the circuit board and then cut it.

Step 6: Routing the Wires for the Keypad and LED

Now you need to find a way to connect the wires from the keypad and LED, which are on the outside, to the circuit board, which is on the inside.

Find a way to get the wires from the outside to the inside. Every enclosure is going to be different, so I cannot tell you how to do this. You may need to drill holes through your enclosure.

My enclosures consist of two "shells" a plastic outer one and a metal inner one.
I did not have to drill any holes because I could route the wires between the plastic pieces it was made of and the metal shell already had holes for airflow.

You may want to mark off the minimum length of the wires that you have to leave to be able to mount the keypad and the LED on the outside of the enclosure..

Step 7: Connect the Rest of the Wires

Now you need to connect the rest of the wires to the circuit board.
Do this according to the schematic.

Step 8: Reassembling It All Again

Start by hotglueing the power connector, upside down, back onto the board, where it used to be. Then just put the board back where it was and screw it back down.

After that, connect the harddrive to the USB board and figure out where you want to place the circuit board.
First you have to stick some ducttape or electrical tape onto the metal case where you want to put the circuit board or else it might short out against the metal enclosure.

Use double sided tape to stick the drive to the case or drill new mounting holes for it and screw it down. If you use double sided tape, make sure that you do not cover the "do not cover this hole"-hole, also make sure that the contacts on the bottom of the drive are not touching the metal enclosure. Then use some more double sided tape or some hot glue to stick the circuit board to the case.

Now you can reassemble the enclosure.

After that you can mount the LED and the keypad to the outside of the enclosure in any way you want. (I used more hot glue)

Step 9: Using Your New, Homemade, Datalocker

How do you use it?

First connect the USB cable and the power cable.

Now, enter the code and press # (the default code is 1 2 3 4)
If you did everything right, your drive should now power on.
If you want to turn the drive back off, enter the code again and press #

How to change the code:
Enter the current code and press * (the star symbol)
Now the LED should light up.
Enter the new code (only 4 digits allowed) and press #
Enter the new code again and press # again.
Now the LED should turn off.
You can now use the new code.

(6-April-2009): Added video and corrected spelling errors.