Dangerous Things
Custom gadgetry for the discerning hacker

The Store is now open! Check out the gadgetry »
Like what you're reading?
Share It.

Stamp based security system

I’m working on a project that involves green computing, and oddly enough an old building. This project has a low budget at the moment, but still requires a flexible security system for an inner and outer door. I figured I could easily put a BS2 chip to the task and come out with a pretty decent security & monitoring system.

I’m posting some pix and the code file because I figured it might help some people get a handle on a basic multitasking project that also includes RS232 host communications.


—–[ Program Description ]—–
This security system monitors two RFID readers, controls two door latches, monitors two door status sensors (open/closed), monitors two security override keys/buttons, and supports two way 9600 baud RS232 communication with a serial host.

Tag IDs received from RFID reader hardware are sent to an attached serial host for both logging purposes as well as host based authentication. A limited number of “failsafe” tag IDs can be stored in memory, however a nearly unlimited number of tags can be supported if the serial host is used to determine if a tag ID should be allowed access.

Serial host communications
Approximately once every 1.5 seconds, the security system will update the serial host with door status sensor data. This data is followed by the string “CMD”, which tells the host that the security system will wait one half second for a latch command from the host. Because the stamp has no built in serial buffer, host communications must be kept to a strict timing schedule. The security system will also output event data such as tag reads, latch triggers, and override keys/buttons being pushed. But the only time at which the security system will listen for host commands is directly following the string “CMD”. Because the system will only process one command at a time, the host must queue its commands and only send one per “CMD” string received.

Data strings sent to host vary depending on event. Approximately every 1.5 seconds a status string will be sent just before a command “CMD” string:


This example indicates that both doors are closed and all inputs or GPIOs are showing LOW status.

In the following example, a tag ID is read from reader 2 and the tag ID is sent to the host. The tag also matches an ID stored in memory and latch 2 is triggered:


Finally, this example shows an override key being used to open door 1:


Host commands are simple ASCII character byte strings:
char    result
====    ===============
1    Trigger latch 1 (2.5 seconds)
2    Trigger latch 2 (2.5 seconds)
A    Trigger GPIO A (1/4 second)
B    Trigger GPIO B (1/4 second)
C    Trigger GPIO C (1/4 second)

Laying out parts

Laying out parts

Assembled board

Assembled board

In the case (top)

In the case (top)

In the case (bottom)

In the case (bottom)

Tags: ,

Leave a Reply

Get Adobe Flash player