CURRENT ISSUE
Contests
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
CIRCUIT IMPLEMENTATION
The circuit is developed around the ATmega32, with most interfacing
reduced to straight connections (see Figure 5).
One notable exception is the PIR movement sensor (ITM256), using a series
resistor to adapt its 5-V output to the 3.3-V input level of the ATmega32.
The camera module connects to the UART’s RX and TX pins. With communication running at 115,200 bps, I selected a 7.3728-MHz crystal for exact bit timing. The SD card connects directly to the SPI port pins. The card connector is a Yamaichi Electronics FPS009-3202. I like its space-saving outline, with most of its pins placed inside its body, instead of sticking out. The connector also features extra signals indicating the card-insertion status and the position of the write-protect tab of the card. I routed them to two spare I/O pins, enabling the pull-ups.
The ATmega32’s three interrupt pins are used for the external trigger, the PIR input, and the remote control. The latter pin connects to a Vishay Semiconductors TSOP34836 infrared receiver IC, which is tuned to the 36-kHz carrier for RC5 encoding.
As for the outputs, four status LEDs take half of Port A. A spare bit on Port C drives the relay output with a typical transistor/diode pair. The same conventional circuit drives the speaker coil in an unorthodox way. I tried it for fun, and it worked so well that I didn’t change it.
Another unorthodox section is the serial port built around Port C, bit 5. Since it is a bit-banged implementation, its polarity is reversed, compared to a hardware UART, usual polarity inversion circuitry is not required. You can connect it straight to a PC running a serial terminal program. Admittedly, this circuit doesn’t meet RS-232 specifications: no negative voltages, just 3.3-V swing, and interrupt delays limit practical speeds up to 9,600 bps. Nevertheless, it’s a costless solution that is invaluable for debugging.
The power supply is less parsimonious. It’s easy to overlook power-related issues. Both camera and flash memory disks have impulsive behaviors. They consume almost nothing when not in use, but they draw intense bursts when writing or compressing an image. Thus, I provided both a 100-µF electrolytic and a 0.1-µF ceramic capacitor for most parts. Be careful to place the capacitors as close as possible to all active parts.
Power comes from a wall wart adapter. A battery pack keeps the clock running during power outages to ensure the completion of disk operations. A 15-V varistor cuts the power spikes and Shottcky diodes mix the power sources prior to low-dropout power regulators for 3.3- and 5-V supplies.
The ATmega32 monitors its own power to safeguard disk integrity. Two identical divider networks for battery power (R3-R4-C5) and mixed power (R7-R8-C8) reduce voltages to levels suitable for ADC pins. Don’t omit the capacitors that smooth the measurements and provide a charge tank for sampling.
|