Design of a digital image acquisition alarm system

Publisher:九九归一74Latest update time:2012-03-16 Source: 21IC Keywords:AT91SAM7S64 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the development of society and the prosperity of economy, modern science and technology are being applied more and more widely. Using modern high-tech means and perimeter anti-theft alarm system can effectively prevent illegal personnel from entering the community through the fence. It plays an irreplaceable and important role in strengthening public security, eliminating potential accidents and preventing crimes. It is one of the important signs of intelligent community entering modern management. Infrared alarm system is a widely used alarm technology at present. It is intelligently controlled by single-chip microcomputer, which greatly improves the efficiency of anti-theft. The characteristic of this system is that as long as illegal human activities are detected in the warning area or non-opening time, the system can be immediately started to automatically alarm. Multiple pairs of infrared beams are installed on the walls of the factory area. The infrared beams cannot be seen by human eyes to form a strict protection network on the walls of the factory area. Once illegal personnel want to climb over the wall into the community, the alarm will be triggered immediately, and the corresponding area will be displayed on the alarm host, and the security personnel can quickly go to the scene of the incident. The embedded image acquisition system designed in this paper uses AT91SAM7S64-AI with ARM7 as the core as the main control chip, controls the CMOS sensor OV6620 for image acquisition, and then controls the image data to be stored in AT45DB041D under the control of AT91SAM7S64-AI, and finally transmits the image acquisition results through multiple communication interfaces. The ARM7 series processor is the mainstream embedded processor designed by the British ARM company. The core is a three-level pipeline with 0.9MIPS/MHz and a von Neumann structure. ARM7 does not have MMU, but ARM720T has MMU.

1 Features of AT91SAM7S64

AT91SAM7S64 is a 32-bit microcontroller from Atmel. It features high performance, low power consumption, full-speed USB2.0 interface and abundant peripheral interface resources. It is an ideal chip for connecting peripheral applications such as PCs and mobile phones. The AT91SAM7S64 microcontroller uses nanowatt technology to meet the industry's requirements for low-power design. Its operating voltage range is between 2.0 V and 5.0 V. When the frequency is 32 kHz and the voltage is 2.0 V, the typical operating current is 8.5 A, and when the frequency is 1 MHz and the voltage is 2.0 V, the typical value is 100 A. When the voltage is 2.0 V, the typical value of the watchdog timing current is 1.

2 Hardware Composition

The image acquisition alarm system consists of an infrared alarm circuit, a power supply circuit, a USB interface circuit, an OV6620 image sensor acquisition circuit, a CPU interface circuit, a CPU external EEPROM and other circuits, as shown in Figure 1.

2.1 Processor

The system processor uses the AT91SAMS64 chip of Atmel Company. Compared with the circuits implemented by other series of single-chip microcomputers, its peripheral expansion circuits are very few. In the alarm system, the communication with the host computer is completed by USB. The processor integrates the port of USB device, making it an ideal chip for connecting peripherals. In addition, the amount of data required for image acquisition is large. AT91SAM7S64 has 64 KB high-speed Flash and 16 KB SRAM, but when the OV6620 image sensor continuously acquires images and transmits data, the space is obviously insufficient. After the infrared sensor acquires the infrared sensing signal, it is processed by the infrared sensor processor and outputs the signal. The signal jumps from 0 V to 3.3 V and can be directly connected to the CPU. After receiving the signal jump via the general input and output port, AT91SAM7S64 communicates with the image sensor OV6620 through I2C to obtain the image, and then transmits the image back to the CPU through 8 parallel interfaces and stores it in the external memory. [page]

2.2 Infrared signal processing

BISS0001 is a high-performance sensor signal processing integrated circuit. It is equipped with a pyroelectric infrared sensor and a small number of external components to form a passive pyroelectric infrared switch. It can automatically and quickly turn on various incandescent lamps, fluorescent lamps, buzzers, automatic doors, electric fans, dryers, automatic wash basins and other devices. It is particularly suitable for sensitive areas such as corridors in enterprises, hotels, shopping malls, warehouses and homes, or for automatic lighting, lighting and alarm systems in safe areas.

The infrared signal processing part uses BISS0001 infrared signal sensor processor, which is a digital-analog hybrid special integrated circuit composed of operational amplifier, voltage comparator and state controller, delay timer, blocking timer and reference voltage source. It can be widely used in a variety of sensors and delay controllers. BISS0001 uses operational amplifier OP1 to form a sensor signal preprocessing circuit to amplify the signal. Then it is coupled to operational amplifier OP2 for the second stage of amplification. At the same time, the DC potential is raised to VM (≈0.5 VDD) and sent to the bidirectional amplitude detector composed of comparators COP1 and COP2 to detect the effective trigger signal Vs. Since VH≈0.7 VDD and VL≈0.3 VDD, when VDD=5 V, the noise interference of ±1 V can be effectively suppressed to improve the reliability of the system. In the infrared alarm circuit, when the infrared sensor receives the signal, it is processed by BISS0001 and then output by pin 2 of BISS0001. In this chip, since the pin is measured to be 3.3 V when the signal is output, the pin can be directly connected to the CPU. The circuit design diagram of the infrared signal sensor circuit is shown in Figure 2.

2.3 Image Sensing

OV6620 needs a stable voltage of 5 V for power supply. It is a color/black and white image sensor that communicates with the CPU through I2C. The maximum pixel is 352 × 288 and the frame rate is 26 fps, with 2 fields per frame and about 50 fields per second, that is, an image is generated every 20 ms. It supports two scanning modes, continuous and interlaced, two image formats, CIF and QCIF, and three data formats, including YUV, YCrCb, and RGB, which can meet the needs of general image acquisition. There are 50 programmable registers inside OV6620, which are set through the TWI protocol of AT91SAM7S64, and the 8-bit parallel data output of the Y0~Y7 channels of OV6620 is transmitted to the CPU in real time in the interrupt mode to synchronize the image data output.

2.4 External Memory

AT45DB041D is a 2.5 V or 2.7 V, serial interface Flash memory, ideal for a variety of digital voice, image, program code and data storage applications. AT45DB041D supports RapidS serial interface, suitable for applications requiring high-speed operation. RapidS serial interface is compatible with SPI, with a maximum frequency of 66 MHz. AT45DB041D has a storage capacity of 4 325 376 bits, organized in 2 048 pages, 256 or 264 bytes per page. In addition to the main memory, AT45DB041D also contains two 256/264-byte SRAM buffers. The buffer allows data to be received when the page of the main memory is reprogrammed, and continuous data strings can also be written. EEPROM emulation (settable to bits or bytes) can be easily implemented through independent "read-modify-write" 3-step operations. DataFlash accesses data sequentially through the RapidS serial interface, rather than random access through the multiplexed bus and parallel interface like traditional Flash memory. The simple sequential access mechanism greatly reduces the number of effective pins, facilitates hardware layout, enhances system reliability, and minimizes switching noise. In order to achieve simple in-system repeated programming, the AT45DB041D does not require a high input voltage to support programming. The AT45DB041D operates at independent 2.5 V to 3.6 V or 2.7 V to 3.6 V voltages for programming and reading operations. [page]

3 System Software Design

3.1 Overall process of system software

The infrared digital image acquisition alarm system detects the signal jump of the infrared sensor and notifies the CPU, thereby controlling the image sensor processor. Since AT91SAM7S64 has 32 I/O ports, one of the ports, PA18, is selected as the infrared signal receiving port. First, it is set as the input port in the CPU. After power-on, its port is high level. When the infrared receiving signal is triggered, it jumps from low level to high level after processing. After the chip is initialized, it can be judged whether PA18 is 0 through the PIO controller pin data status register. If it is 0, control OV6620, otherwise it should continue to judge until the port is low level, then communicate and set OV6620, and when it responds, it will acquire the image and transfer the data to the external memory. The main program flowchart of the system is shown in Figure 3.

3.2 Image sensor processing

3.2.1 Register settings of OV6620

TWI data transmission is a single-byte transmission. The address of the OV6620 function register is 0x00~0x50, many of which are reserved registers. By setting the corresponding registers, OV6620 can work in different modes. When TWI data is sent, due to the existence of the slave address and the slave sub-address, the slave address should be written in TWI_MMR and the internal address length should be set. The slave sub-address should be written in TWI_IADR. Since TWI_THR saves the transmitted data as 8 bits, OV6620 is set to low resolution, exposure time, automatic white balance and frame clock cycle. The control program is as follows:

AT91_F_TWI_Write_Byte

(const TWI_Mapped, OV6620_addr, 0x14, 0x20)

AT91_F_TWI_Write_Byte

(const TWI_Mapped, OV6620_addr, 0x10, 0x9A)

[page]

AT91_F_TWI_Write_Byte

(const TWI_Mapped, OV6620_addr, 0x24, 0x33)

AT91_F_TWI_Write_Byte

(const TWI_Mapped, OV6620_addr, 0x25, 0x97)

AT91_F_TWI_Write_Byte

(const TWI_Mapped, OV6620_addr, 0x1, 0x02)

AT91_F_TWI_Write_Byte() is a function for controlling register settings. Its first parameter is the mapping address of TWI. The macro definition address in AT91SAM7S64 is 0Xfffb8000, OV6620_addr is the macro-defined slave chip address 0XC0<16, the third parameter is the internal register address of OV6620, and the fourth parameter is the value set for the corresponding register.

3.2.2 OV6620 acquisition process

OV6620 has four synchronization signals: VSYNC (vertical synchronization signal), FODD (odd field synchronization signal), HREF (horizontal synchronization signal), PCLK (pixel synchronization signal). When continuous scanning is used, only three synchronization signals, VSYNC, HREF, and PCLK, are used [5-6]. The input of the VSYNC signal of an external interrupt pin of AT91SAM7S64, the corresponding interrupt service program is VSYNC_IRQ (), and HREF is connected to the ordinary I/O port of AT91SAM7S64. The image acquisition process is: after initializing OV6620 with TWI, enable the interrupt corresponding to VSYNC, wait for the CPU to read a frame of image, and determine whether a frame of image data has been obtained in the VSYNCIRQ () interrupt service program. If not, continue to wait until a frame of image data is completely transmitted.

3.2.3 Image extraction process

The process of image extraction is: when the collected data has been stored in the external memory, use the CPU to retrieve the data and then transmit it to the host computer. First, read and reset the external memory to make the pointer of the external memory point to the first address, and then read according to the format of the RGB data output by OV6620. Among them, the most important thing in the extraction process is the RGB data format output by OV6620, which affects the accuracy of the extracted image. Its data format is shown in Table 1.

From Table 1, we can see that the first row of Y channel is invalid data and should be removed. Starting from the second row, within a row, B and R data only appear in odd items, and G data only appears in even items. In each row, the R data and B data of even points can be obtained by averaging the R and B data of the two points on both sides.

4 Difficulties and shortcomings of software design

Due to the low price of AT91SAM7S64 chip and the large consumption of MCU resources in the image acquisition process, the lack of program space is the bottleneck of the design in the software design process. In addition, the infrared signal processing part is not uninterrupted continuous infrared sensing but requires a period of time, but the interval is about 10s. In the image sensing and processing part, the image denoising and black line extraction are only tested continuously in the setting register to achieve the best effect, and are not automatically completed in the program. AT91SAM7S64 and OV6620 cameras are used for image acquisition, and the acquired image data is stored in the external memory. Compared with ordinary video acquisition cards, this embedded image acquisition system greatly simplifies the system structure, reduces the system design cost, and shortens the development cycle. The acquisition and processing of image data are completed by ARM chips, thereby reducing the probability of transmission errors during data transfer and improving the reliability of the system.

Keywords:AT91SAM7S64 Reference address:Design of a digital image acquisition alarm system

Previous article:Detailed analysis report on SiLabs Precision32 MCU
Next article:Design of integrated wireless data acquisition instrument based on ARM11

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号