Hardware Reference
In-Depth Information
I'M FOREVER FORGETTING things - usually important documents. Luckily with com-
puters and the cloud, I can go online and access my documents whenever and wherever I
need to. Unfortunately, I can't download physical objects, such as a door key, particularly
when the door has swung shut behind me. Luckily, the Raspberry Pi can come to the rescue.
In this chapter you'll build a computer-controlled door lock that will unlock the door when
you prove to it who you are. You'll take advantage of the general-purpose nature of the
Raspberry Pi, so you can extend it to have a range of diferent ways of unlocking your door.
his chapter shows you how use an RFID reader, but you could go on to modify it to unlock
using your mobile phone; lucky for me, as I'm just as bad at remembering passwords as keys.
If you don't have a door lock, you can instead use the Raspberry Pi to activate and deactivate
an alarm - it won't physically prevent entry, but it can warn you that someone has been in
your room without permission.
here's a bit of an art to designing computer programs, and hopefully, after this chapter
you'll also appreciate the need to design things modularly - that is, in a way that allows
chunks to be easily switched out for another one. You'll also see that it can be easier to design
with a simple block, get the system working and then go back later to make it more compli-
cated. In this chapter you'll see how to break the task down into separate aspects, and then
switch out one block and switch in another.
The System Overview
When starting work on a new system, computer scientists will often sketch out a system
diagram showing how the main components will work together - it would be far too compli-
cated to try and design everything all at once.
Figure 12-1 shows the system diagram for the door lock. It shows how the system needs to
get input (this could be from a code pad) and check whether the input is valid, and if it is,
then it unlocks the door. You should recognise that Figure 12-1 maps well to the familiar
“input, process, output” of computers.
Figure 12-1:
he system
diagram of the
door lock.
Safety-Critical Systems
his project also introduces an important aspect in computing, that of safety-critical systems. If
your desktop computer crashes, you might lose hours of work, which probably at worst is just
Search WWH ::




Custom Search