CURRENT ISSUE

Contests

bottom corner

Feature Article



Issue #202 May 2007
The Wittness Camera
Build a Self-Recording Surveillance Camera
Grand Prize Atmel AVR Design Contest 2006
by Alberto Ricci Bitti

Start | Solid-State Recording | Full Interaction | Complete Picture | Basic Instinct | Filled To Capacity | Speech Preparation | Circuit Implementation | Concept To Prototype | Picture Inspection |Design Evolution | Sources & PDF

COMPLETE PICTURE
Take a look at Figure 3. Software drivers are placed inside the ATmega32. The file system is split into its constituent parts: the AVR-DOS library (version 5.6), the underlying SD-MMC software driver for low-level access to physical media, and the SD card. The card talks to the AVR via the hardware SPI, which is notably fast in ATmega devices.

Figure 3—Despite the actual component count, the complete block diagram isn’t trivial. It includes both hardware parts and software-only objects and libraries. The ATmega32 is a perfect fit for this design, because almost all of its features are used.

 

Figure 3 shows a file manager layer (archive.bas) mediating between the recorder and the AVR-DOS file system. Its purpose is to provide helper functions, such as determining the oldest files in the archive, deleting unused files to make room for new images, and creating an orderly set of directories and files to archive the pictures according to their time stamps. Another required function (introduced in order to preserve disk integrity) is power monitoring. The system must stop disk writing when problems arise. Therefore, it measures both main and battery voltages using the embedded 10-bit ADC.

The remaining functions are not essential for the camera to work, but they make development and use much easier. With the PC debug port, you can log system operation messages (disk size and free space, JPG file size, remote control codes, etc.) for diagnostic purposes—or just for the pleasure of watching the internal clockwork in action.

As the UART is used for the camera, the debug port works by bit-banging an I/O pin, a technique that is adequate for debugging purposes and allows the arbitrary setting of signal polarity.

The ATmega32 can drive LEDs from all of its general-purpose I/O pins. I provided two status indicators on the front panel. They can be used to verify the PIR sensor range and check if the disk is actually recording. Two extra LEDs are inside the box next to the SD card slot. I call this the “disk semaphore.” When the green light is on, it’s safe to extract or remove the SD card from its slot. A red light signals that a disk operation is in progress and that you must wait before removing the SD card. A simple algorithm inside the main recording loop determines which light to turn on based on the status of the recorder, the card-detect switch from the SD card receptacle, and the lid-detector switch that notifies the system that the camera case is open.

Previous | Next

 


bottom corner