DIY Datalocker Using Pic

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
– 3×4 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 tapeDIY Datalocker

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)DIY Datalocker 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..

Read more: DIY Datalocker

Leave a Comment

Your email address will not be published. Required fields are marked *