Servo!

One of the final bits of this project is the servo. (A servo's a small motor that'll hold a given position.) In my case, I'm using a servo to actually turn the deadbolt. It's a little bit important.

I'd assumed that a servo's powered by the power and ground and that an analog voltage (0 or +5) on the signal line would move the servo. Surprisingly, that didn't work. It appears that the servo wants a PWM input to the signal line, even if it's just a 1% on, 99% off signal.

The Arduino has a Servo library that does all the hard work for me. I wrote a few more lines, and voila! Moving servo.

To polish the gizmo a little more, I added feedback to the reader. When an illegal key is detected, the reader blinks between red and green, beeping every 100 ms. A legal key turns on the green LED while the door's unlocked.

I also polished up the wiring. I'd been running the HID reader off of a wall wart, with a jack made of electrical tape. The Arduino, meanwhile, was depending on a computer for life support. I used a coin cell and LED as a continuity tester to wire the Arduino up the right way to the wall wart (we don't have a multimeter), and fixed up the connecting jack for better (if not good) reliability.

The entire gizmo runs on wall power, turns a servo, and remembers legal keys across reboots. All that's left is attaching the servo to the wall.

Squee.