Archives

All posts for the month September, 2013

Evey time I stroll by these electronic deadbolt units at my favorite big box home improvement store I always have 2 thoughts pass through my mind in turn:
‘Man, that would be cool to add to my home security system’ followed shortly by
‘I’m sure it can be easily hacked to directly control the motor from the outside or brute force the 4 digit pin code.’

The latter thought has always prevented me from shelling out the dough for a nice unit that could potentially pose a bigger security risk than a simple keyed lock.
deadbolt5
I also did not feel the wifi and z-wave models were worth the $200-300 price range, especially when they add another layer of vulnerability. On a recent weekend, however, I came across a $60 keypad model (no remote control) and decided I would attempt to remotely control the unit using an arduino, raspberry pi, or other embedded system I already have in place for home security.

Initially I envisioned a hard wire from a micro-controller or other device to the embedded controller, motor, or some combination of those. I would have preferred to use the built in circuit and simply send simulated button presses, but for a number of reasons I decided to cut corners and control the motor directly using a simple TIP120 darlington transistor circuit.

deadbolt4deadbolt3

 

 

 

 

 

 

 

 

There’s no feeling quite like opening a product I just purchased and immediately voiding the warranty. That is my real hobby.

deadbolt

Here you can see the simple TIP120 circuit with a zener diode to protect the controller board from evil kickbacks. You may already be able to tell from the photo of my circuit where this post is going….
Half way through this ill-advised plan I realized this circuit would only have one-way control of the motor direction, unless I used an H-bridge. So basically I could open the lock on the door, but never close it…. or stay locked inside forever.

After much contemplating, googling, and forum trolling, I changed course and decided against building an H-bridge circuit with the darlington transistors I had on hand. I decided instead to use a
TB6612FNG 1A Dual Motor Driver I picked up on the cheap for servo motor control. I would supply the motor driver with voltage from the MCU board while using the deadbolt’s power supply (replaceable AA batteries) for the motor voltage. This solution offered bi-directional control of the deadbolt motor, allowing me to lock and unlock via the web interface and the GPIO pins of the webcontrol board. In addition, I could use other GPIO pins for a position indicator circuit and update the web console with the lock status.

Below you can see the early ‘prototype’ with the TIP120. You can also see the webcontrol board I decided to use for the controller. It was a plug and play solution that was faster than writing arduino code from scratch,  and this was obviously a lazy Saturday. I’m still working out the kinks in the lock position sensor, but the lock is functional and I am able to lock and unlock the deadbolt via my phone, when connected to my WiFi. Once I clean this up and finish the sensor wiring, I will post some updates with the motor controller board, web interface, and a nice demo video for PoC.
deadbolt2

I promise not to hijack the company website and make it into my own personal blog but, as promised, I will be posting some fun projects to keep the site fresh and active while products for the store are being developed. Here is the first installment:

ml370-6

I love my old HP Proliant Ml370 G4, but it has begun to show it’s age. I could not turn down this behemoth of a server workhorse when I was offered it free of charge by a company that was upgrading their entire infrastructure. The only stipulation was that I would wipe the data from the hard drives and not use the OS that it was running. I was happy to oblige by wiping Windows and replacing it with an x64 Ubuntu Server. That process became a mini-project, as the bootloader was not a fan of the hardware RAID and failed to recognize the logical drive presented to it. I finally stumbled across a great little utility which iirc is now built in to many distros and aptly titled “Boot-repair”. This effortlessly corrected the boot issue and I was on my way to building a powerful home server.

Over the years I built the box up with several useful roles such as: media server (samba, NFS & CIFS) including XBMC and all of it’s goodies, home automation server for x-10 and Z-wave, and a home PBX using Asterisk. Like I said, I love this big ‘ol beast of a server, especially the 5 drive (10K U320 SCSI) hardware RAID array for my media library, but eventually I had to face the music: 146GB SCSI drives with a 548GB total array size was not sufficient for my rapidly growing media library. Using tools such as MakeMKV, Handbrake, and DVDshrink I added my entire physical library of DVD and Blu Ray movies to the media server with some HD files around 4GB each.

My upgrade options were limited, as U320 SCSI drives max out at 300GB, and this was not cost effective on a dollar per MB or GB comparison to newer SATA drives. My solution was to expand my storage with modern and relatively inexpensive SATA drives. Unfortunately the cheapo RAID cards I bought online were only capable of software RAID that gave me problems, especially with large file transfers over my home network. After some quick research I decided that I would take 5 1TB SATA drives and replace the aging 10K SCSI drives in the drive bay. I was able to procure the following parts for this project through online auctions:

SATA extension cables $1.36ea (NEW)
ML370G4 SAS backplane $14.95 (refurb)
SAS cables $15 (NOS)
HP 410i SAS RAID controller, PCIe x4 $19.99 (used)

Total investment was under $60, which is not bad considering that some used drive cages (with backplanes) alone are listed online from $35-$85.
A plug and play complete SAS solution pulled from a used ML370 was well over $400 and I would much rather spend that money on drives. Plus I wanted to see if I could cobble something together that worked.

Before:

ml370-1
This is the ML370G4 with a 5 drive SCSI RAID array using a PCI-X RAID card. The 3 drives in the center make up a second RAID using the onboard controller and these run the linux OS.

Pulling the cage was fairly easy: four screws, remove the SCSI cable, remove the power cable, pull the cage.
ml370-2
Unfortunately the SCSI cage backplane mount is not the same for the SAS backplane. To make matters more difficult, the SAS ports are too close together for 3.5″ SATA drives in this SCSI bay, so I had to relocate the new backplane to the middle bay behind the OS drives. The extension cables were plenty long to accomplish this, though the end product was a bit messy looking.
ml370-3
The next task was mounting my SATA drives in the SCSI drive trays. This seemed easy enough at first; however the tray corners are right in the way of the SATA power connector. After attempting to dremel the entire corner off of each tray, I realized that the trays are actually made from (what appears to be) cast aluminum that I could easily score and snap off with pliers. This would not be an issue with the G5 and newer SAS/SATA/FC drive trays.
ml370-4

With the new drives in the trays, and the trays in the cage, I began cleaning up the wires and tackling the next issue: the SAS board power plug was a 10-pin, where the SCSI’s was 8. I was concerned that not all of the drives would get power or that functionality on the backplane would be missing. Luckily this was not the case, and a quick probe of the voltages demonstrated that the  8 pin plug from the ML370’s power backplane board was a direct match for the bottom 8 pins of the SAS backplane (according to a pinout diagram), and the keying was also the same. So this part was indeed plug and play. I still have no idea what the extra 2 pins, a GND and +5V, actually do, but I have yet to experience any performance issues after nearly a year in service.

ml370-5

I placed the new SAS backplane carefully in the the middle bay, being careful not to let it ground out on the chassis. I think my next rainy day project will be to 3D print a proper mount for it, or perhaps make a mount that adapt it to the back of the SCSI drive bay.

After:
The before and after pictures are the same, because with the exception of the coiled up excess SATA wires it is difficult to tell the original configuration has been modded.
ml370-1
I downloaded HP’s ACU (array configuration utility) which was a free download and came complete with a decent GUI from a customized linux live .iso. I was again pleasantly surprised to discover that the utility recognized all drives and configured them without complaint. I have heard stories of non-HP firmware drives having issues, but I have yet to come across this.
The result is a 4TB RAID 5 array for my media library and XBMC server. This project was fun, relatively inexpensive, and I now can easily update the size of my array by swapping in bigger drives and reconfiguring using HP’s powerful ACU. Yay for free hardware, open source software, and a seemingly endless supply of used parts on online auction sites! I heart the internets.

I can’t imagine too many people have old servers lying around, but if you do, or if perhaps you want to add a cool hardware RAID cage for your SATA drives here are some resources to mimic this project:

Hardware:

Sata/SAS extension cables

Drive cage from a G5 with backplane

G5 drive trays (a bit pricey, you may want to watch for a good lot sale or a drive cage with trays)

HP P400 SAS controller with 512MB cache

SAS cable (need 2)

Obviously these auctions will be over shortly after this post, but this gives you an idea of what to look for in acquiring parts.

I spent a lot of time searching and waiting for great deals to get my parts under $60.

Software:

Boot-repair utility

HP offline ACU (.iso image)

Good luck and happy hacking!