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.


For more detail: DIY Datalocker

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: