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

FILLED TO CAPACITY
Keeping the disk filled to capacity, without it overflowing, was a challenging problem. In theory, you can compute disk occupation, find the oldest file in the disk, and delete it. In practice, these operations are time-consuming, so you must avoid them as much as possible. To complicate matters, file size isn’t constant. It depends on the scene and how it gets compressed by the JPEG algorithm. It also depends on the time of the acquisition, because storing a picture file may require creating new directories (hence more disk space) each time the year, month, day, or hour changes. You are free to select a different resolution or recording mode at any time, changing the space required to accommodate new files.

To solve the problem, I developed heuristics based on just three common-sense rules. First, when the disk is only partially full, it is enough to check disk occupation only every now and then, and all the files can be conserved without problems. Second, as disk occupation increases, the amount of space left needs to be checked more frequently, and it’s wise to start deleting some files. Since deleting files burns precious machine cycles, it’s better to do it when the camera is idle so recording isn’t triggered. Third, if the disk’s occupation reaches its limit, disk-occupation checks must be performed frequently. You must delete old files anyhow, even if the processor needs resources for recording, because of the risks associated with running out of disk space.

Figure 4 should shed some light on how the heuristics work. After experimenting with the PIR-triggered recorder, I estimate that the algorithm should be able to perform all file erases during Idle, with intervals of no less than 30 min. between time-consuming calls.

Figure 4—Flow chart of the heuristics that keep the disk filled to capacity. The values for deleteOnWrite, deleteWhenIdle, and cleanupInterval are set according to the disk space left, using hard-coded values.

 

Previous | Next

 


bottom corner