Discuss this article in the Nuts & Volts forums at http://forum.nutsvolts.com.
Fortunately, there is a language that meets all our
needs. RobotBASIC is very powerful with nearly 700
commands and functions. It can handle all standard I/O
operations including serial, parallel, Bluetooth, and many
USB devices (including direct support for USBmicro I/O
boards). As an interpreter, RobotBASIC simplifies program
development and provides for interactive debugging, yet
finished programs can be compiled into stand-alone
executables. RobotBASIC is easy to learn, and totally free
for individuals, clubs, and schools.
RobotBASIC also has commands for capturing images
from TWAIN compliant web cams, as well as a host of
image processing functions for dealing with the images
once they are captured. Internet communications (both
TCP and UDP) are supported, as is the sending of email
through an SMTP host. These features make RobotBASIC
an ideal language for many control applications, including
our security project.
Let’s start by seeing how easy it is to implement the
basic functionality of a security system. Once we have a
basic framework established, you can add custom features
to meet your particular needs and desires.
The first thing our system needs to do is obtain
pertinent sensory information. One way to accomplish this
is to utilize conventional sensors such as the magnetic
window switches used with standard alarm systems as
shown in Figure 1. Typically, such switches
can be obtained in either N.O. (normally
open) or N.C. (normally closed) varieties.
Standard switches are not your only
option. Many alarm sensors — including the
infrared motion detector and glass breakage
detectors shown in Figure 2 — are just as easy
to interface. The setscrew connections (shown
in the open unit) provide both N.O. and N.C.
terminals that can be interfaced exactly like
The output from switches and switch-like
devices can be arranged in series and parallel
to implement zones and easily interface to a
computer input port as shown in Figure 3. For
those new to interfacing, let’s examine this
figure in more detail.
Figure 3 shows details of two zones: one
using N.O. switches and one using N.C.
switches. As you can see, the N.O. devices
(you can use as many as you like in each
zone) are wired in parallel, while N.C.
contacts are wired in series. The two pull-up
resistors shown ensure that the associated
port pin is normally high (a logical one) unless
the state of the switches pulls the input to
ground (a logical low). Notice that means that
the N.O. pin will be HIGH unless any of the
associated switches are activated, while the N.C.
FIGURE 2. A WIDE VARIETY OF SENSORS ARE
pin will be LOW until any of its switches are opened. A
typical input port has eight inputs. The unused pins can be
used for additional zones as indicated with Zone 3.
In order to turn on external devices, signals from the
computer’s output port must be sent to a control circuit. If
FIGURE 3. WINDOW AND DOOR SWITCHES ARE EASILY
INTERFACED TO A COMPUTER.
August 2012 47