Beruflich Dokumente
Kultur Dokumente
W
e have ma-
chines to brew
our coffee, turn
on the air condi-
tioner, and wash
our laundry. Why
then, do we not have machines to
lock and unlock our front doors
automatically? This thought per-
vaded my mind as I had to unlock
not one, not two, but three doors
multiple times per day at my stu-
dent dorm.
When I moved to a campus apart-
ment, the lock situation changed for
the worsemy slick radio-frequency
identification (RFID) card was re-
placed with a large, bulky metal key.
It ripped holes in my pocket, made
noise, scratched whatever else it
came in contact with, and was not
fun to use in the dark. And with a
deadbolt, I had to use the key when
entering and exiting. Using a key
was tedious and inconvenient and
could be easily automated.
The lock I imagined needed these
features:
unlock when either I or my
roommates walk up to it
automatically lock a deadbolt
when the door closes
report all access granted/
denied and door open events
k
oc
to the Internet. hic
st
p
ra
be operable by the school hous- yg
db
se
ing administration lice
n
ge
ma
sei
Hou
0278-6648/152015IEEE IEEE Potentials September/October 2015 n 43
be operable manually with a key wait. It was discreet (nothing showing be a delay between reading and
from the outside and fingers on the outside) and relatively cheap. unlocking.
from the inside (no push to The circuit was also interesting be- 3) The read distance was 3 in
exit button). cause on the other side of the doorbell maximum.
A benefit of building your own you receive an amplitude-shift-keyed 4) There were all kinds of tutori-
door lock actuator is that you get signal, which you have to rectify and als online about how to fake
to choose whatever triggers it. This regulate to logic levels for the micro- these tags.
means you can create as many key- controller. Ultimately, I chose none of These restrictions eventually led
cards as you want in whatever form the above because they were just not me to change the RFID reader to
you wish. You can then hide these as quick and easy as holding an RFID an HID Thinline II that I bought on
keycards in clever places. You can card to a reader. eBay. Now my roommate and I could
also enable and disable keycards Having settled on RFID, I didnt just press our school IDs against the
at will. Compare this to a metal key have many choices. I read about ac- door. The tag-reading process was
that, if lost, cannot be disabled. In- tive RFID, where each user carries much faster with the Wiegand in-
stead, I would be charged a US$50 a radio-frequency tag with a bat- terface. In fact, with a second RFID
key replacement fee, my roommates tery, but I read that this was expen- reader, I had nothing to do with the
would have to have their keys re- sive and I could not find a place to first two tags. I ended up using them
placed, and the lock core itself would purchase tags and base stations. as secret lockout tags that you had
have to be replaced. The modern-day equivalent to ac- to present to the card reader in the
tive RFID is called Bluetooth 4.0 right order to open the door.
The design phase Low Energy (BLE). It detects whether The HID Thinline II was nice, but
All engineering starts with design. In two radios are in a 50-ft range. By it did not solve the small 3-in read
this case, the most important deci- choosing between BLE Class 1, 2, or distance issue. We still had to press
sion to make is what the input 3, you can trade off between range our tags to the door. I solved the
device will be. and transmission power. Bluetooth read distance problem by setting up
My circuit needed two inputs: is what commercial smart locks use an eBay alert for the ultimate RFID
an authenticator today. The user does nothing but readerthe HID Maxiprox (Fig. 2),
a door open/closed detector (only walk up to the door. However, there for use with parking lots. It retails
necessary for the deadbolt). was no BLE in the fall of 2010. for US$400 but has a read distance
The authenticator could be any- My first proximity detection de- of 24 in, which allowed me to read
thing. I saw builds online where vice (Fig. 1) was a Parallax RFID through the wall. If placed correctly,
people used 12-button keypads, reader (model 28140) that read stan- this meant I would not even have
QWERTY keyboards, secret knock se- dard EM4100 tags. However, there to take my wallet out of my pocket.
quences, text messages, and Hack-a- were a few problems. You could not believe my excitement
days RGB light-emitting diode (LED) 1) My roommate and I had to carry when I scored this industrial equi-
pad. The most fascinating one to me special RFID tags in our wallets ment for US$13 at an eBay junkyard
was the single-button entry system instead of using our student IDs. sale. You may still find long-range
in which you have to input Morse 2) The baud rate of the RFID reader RFID readers online, albeit not by
code-like sequences by pressing your was hardcoded at an extremely HID. And if you use Bluetooth, you
doorbell a number of times and then slow 2,400 baud, so there would can avoid this search entirely.
fig1 The first prototype using Arduino, Parallax, and HID RFID fig2 Prototype 4s RFID reader was placed at waist height so
readers along with a servo motor to pull the handle. that it could read through the wall, straight into my pocket.
IEEE Potentials September/October 2015 n 45
Internet logging
I wanted to have all entries and
No, No exits logged on a server that any of
my roommates could view. For this,
5) Deadbolt I used the Xively, the data-logging
Unlocked, Door service made specifically for Inter-
Yes, No Closed.
5 s Passed? net-of-Things applications. Their
Deadbolt SM
Door Open? value proposition is that your appli-
Yes *,Yes cation can be made very scalable.
4) Deadbolt Alternatively, I could have used a
Unlocked and Yes, No more traditional MySQL database to
No
Door Open. Yes,Yes
Door Open? store the logs. This is what I did at
digitalWrite(UnlockPin, Low) first, but using the Xively API was
3) Locking
2) Unlocking much easier than writing custom
Deadbolt.
No,* Deadbolt. SQL queries and opening PHPMyAd-
2 s Passed?
*,Yes 2 s Passed? No,*
Door Open? min to view my database contents.
Door Open?
digitalWrite(lockPin, LOW) I wrote a small front-end using
accessGrand = 0
digitalWrite(UnlockPin, HIGH) plain HTML at first. The page liter-
1) Deadbolt
Yes, No Locked, Door ally had two lines saying Last card
Closed Yes, No scan and Door last opened with
Access Granted?
Yes, Yes Door Open? no styling. It was completely static.
Gotta start somewhere.
No, No I then added some Javascript to the
page to subscribe to Xively Webhooks
and update the webpage in real time
6) Deadbolt as the door opened and closed. I used
Locked, Door the timeago Javascript plugin to cre-
Open.
ate the dynamic text that reads 12
hours ago. I then imported the open-
source CHAPS timeline Javascript
fig5 A state machine that covers all permutations and all valid transitions.
module to list entry and exit events
(Fig. 6). After styling the font and back-
I wanted the elegant dc click, so I State machine grounds with CSS, I added some but-
used a multimeter to figure out the Its one thing to make imaginary state tons at the bottom of the page to finish
house wiring. I actually slowly de- machines in logic design class, but off the minimal, but dynamic, front
stroyed the multimeter in the pro- its another to actually diagram one end. Throughout the entire session,
cess because I was trying to run con- and translate it into real code. All lock I had the Chrome Developer Console
tinuity tests on a live 24-Vac circuit firmware was essentially inside the displayed to diagnose any Javascript
(33 V peak). I didnt know the mul- state machine that tracked the posi- exceptions and errors.
timeter was being destroyed when tion of the deadbolt and whether the
it was buzzing, but it told me what I door was opened or closed. Conclusion
needed to know. Never run continu- To make your own state ma- I made a working electronic door
ity measurements on a live circuit. chine, start by listing all the states lock prototype that satisfied all of my
I rewired my house by disconnect- and the conditions to move to the criteria, and it eliminated the horrid
ing the transformer supplying the next state. Then draw transitions pain of using metal keys. Along the
way, I learned about
the Electric Imp platform
Its one thing to make imaginary state machines in ac household wiring
logic design class but its another to actually how to use a REST application
diagram one and translate it into real code. program interface with JSON
redundancy technology (e.g.,
Arduino watchdog timer)
24 Vac and connected the solenoid from one state to another based on bit-shifting the readings from the
instead to my 5-Vdc circuit. Now I the conditions. RFID reader
had the nice click. I used LucidChart to make my a real state machine.
When I rewired my home door lock, diagram (Fig. 5). You can use Mi- More pictures, a demonstration,
I gift-wrapped the RFID cards and crosoft PowerPoint or Microsoft Vi- and a video of the entire process may
presented them to my family (Fig. 4). sio as well. be found at http://goo.gl/6QJtHP.
03
are some ideas.
02:00
ect because it is cool, but then it
Unlocked
becomes artwork. You want to
01:00
sugar cookies. Remove the pain,
and you will be both motivated
Door Last Opened
and rewarded.
Take shortcuts. With limited time
12 h Ago
00:00
you want to learn and what you
want to outsource. Do you want to
learn how to make pancakes from
flour and raw ingredients, or do
23:00
fig6 My front-end with a little bit of styling and the zoomable CHAPS timeline. Complete with live-updating with the Xively API.
you just want pancakes? Hard-
ware platforms like LittleBits allow
Unlocked
24 h
Android applications.
Access Denied:
21:00
Last 24 h
Show Last:
Access Granted: Andrew Ong
Unlocked
Access Granted:
16:00
Access Granted:
IEEE Potentials September/October 2015 n 47