1 system process architecture
The operating system platform of this system is Linux, the kernel version is 2.6, the target board includes video capture, GPRS module and controller S3C2440. The controller is mainly responsible for providing image data to the customer display and back-end service. The way the video server is started is initiated by the background or trigger. When the user triggers an event, the acquisition program is automatically started or remotely initiated by the user, and then the image data is captured.
2 system design
2.1 Device drivers under Linux
Linux is a free operating system, its source code is public, and we can make the necessary research and modifications according to the needs of the experiment. In the Linux operating system, devices exist in the form of files. The operation of the device is the operation of the file, so that the user can call the general file operation function to access and operate the device. A device driver is an interface between the Linux kernel and an external device. They are executed according to a series of standard function calls that the user operates. By calling a separate driver, the device of the actual hardware is called to perform a specific operation. The programming interface enables the driver to run independently of the rest of the kernel as if it were "embedded" into the kernel. This modular design makes the Linux driver easy and efficient to write. The operation is simple and risky, because the device driver is running in the kernel. If there is a problem with the driver writing, it is very likely that the entire Linux system will run into problems. Drivers run differently from normal applications. Drivers can only call their own functions and standard functions in the kernel. Generally, applications can only call application functions such as external databases. Kernel module source files can not include general library files, only kernel functions specified in the kernel can be used, otherwise problems will occur. This is also the difference between the way the driver is written and the way the application is written. The other difference, of course, is that the kernel is different from the way normal applications handle errors:
The error in the application is that it will not cause a system failure, and the debugger can be used to trace the source code to find the problem, but the kernel error may affect the entire system, even if it does not affect the system, it will kill the current The problem with the process, and you can't use debugging to find the source of the problem.
2.2 Infrared Interrupt Trigger Design
The monitoring system is driven by an infrared pyroelectric sensor and driven by a character device. Since the S3C2440 has 117 I/O lines. The I/O lines are divided into 8 groups of ports, namely GPA, GPB, GPC, GPD, GPE, GPF, GPG, GPH. When someone enters or leaves the sensing area, the level of the pyroelectric infrared sensor will occur. Change, causing an interruption. The pyroelectric infrared sensor senses that when someone enters, it will automatically start the sleeping video capture device and collect data for the target. At the same time, the driver of the pyroelectric infrared sensor needs to call the interrupt mode to notify the kernel, so that the kernel notifies the video collector that it has entered the working state, thereby facilitating device management.
The S3C2440 is configured and controlled by functions and macros on the GPIO pins; the function S3C2440 _ GPIO _ CFGPIN is used to configure the multiplexed GPIO pins; the function SET_ IRQ _ TYPE sets the external interrupt triggers. This monitoring system uses the macro IRQT _ BOTHEDGE to configure the interrupt. The interrupt number is defined in the kernel header file, and each external interrupt is assigned a different interrupt number for control. When the kernel receives an interrupt response, it uses the asynchronous notification method. In order to resolve asynchronous communication of files, the user program must do two things: first, the process must be assigned the "owner"; second, in order to run the asynchronous notification, the user program must set the FASYNC flag in the device. According to the kernel driver, the driver must define its own fasync method. When the program starts to F_SETFL, FASYNC is started, and the kernel calls the driver fasync. The kernel space uses an asynchronous signal to send a signal to the user. The corresponding signal function is:
Void kill_fasync(struct fasync_struct **fa,intsig,init band)
The function of the signal function is to trigger the interrupt response when the output level of the infrared sensor changes from high to low or low to high, and the external device obtains a level change generated by the processing function, so that the read method is defined in the driver.
2.3 video capture driver
Initialize some default values ​​of the camera in the initialization process, start the camera program according to the camera command sent by the infrared sensor, start taking photos, save the image data in JPEG format, and send it to the mobile terminal Wheel (1)
{
If(paizhao)
{
_pal=0;
sendPaiZhao() ;
readJPEG() ;
keepData() ;
sendData() ;
}
}
2.4 JPEG compression encoding of image data
In general, uncompressed JPEG image data takes up a large amount of storage space, which is very expensive, and is not conducive to network data transmission. Therefore, it is necessary to compress image data. For image compression methods, there are already implementations in the Libjpeg library under Linux. Libjpeg is a standard library under Linux that can be called directly to implement image compression. The main function of this library is to compress the image into a JPEG file format at a certain compression ratio. Since Linux is open source, this library is also open. Not only can work under the general Linux operating system, but also work under embedded Linux. This reduces a lot of underlying work and helps avoid repetitive development efforts.
Before using this library, you first need to install and compile this library. For embedded Linux, the libjpeg library is included in the embedded Linux source code package. This library is added when configuring the relevant library file options, and the kernel can be used to compile the libjpeg library.
The image compression package calls the compress function of the image class as follows:
Int image compress(image *newone, int quality) The function of this function is to compress the image into JPEG format according to the specified quality ratio. The two parameters in the function are pointers to the new image class data (ie, compressed image data), and the other parameter is the specified compression ratio, generally ranging from 0 to 100. The larger the number, the quality of the compressed image The higher, the clearer, but the larger the data file size after compression. Therefore, the compression ratio is not as large as possible, and needs to be determined according to the actual needs of the experiment to meet the experimental functional requirements and the storage cost and transmission cost are the minimum standards.
2.5 Sending and receiving short messages
The embedded monitoring system connects to the GPRS by using the serial port, and uses the GPRS module to send and receive short messages. There are two modes for sending and receiving SMS messages, text mode and PDU mode. Text mode can only send flexible ASCII characters. The content of the short message is simple. The biggest shortcoming is that other characters cannot be sent or received. The PDU mode performs new encoding according to a certain format. Generally, the PDU sequence of the hexadecimal number is mainly used, and all Chinese or images are encoded and then sent (see Figure 2-1).
Indoor LED Linear Tube is not IP65, The led tube is rgb color dmx lighting, can be used as Xtube, mediatube, outdoor tube for creative lighting solutions, such as make a 3D cube. led tube color have rgb color tube, rgbw color tube. Regarding how to program led light, because the light is dmx programming, so ISEELED dmx Led Controller or Artnet Controller are suggested. ISEELED DMX512 Led Linear Tube compete with eurolite led tube, osram led tube, Philips led tube, american dj led tube. The pixel tube have 1led 1pixel, 2led 1pixel, 3led 1pixel, 6led 1pixel. Address setting have two type, one is auto address, another is manual address. That's to say we have led tube auto and led tube manual. Auto LED Linear Tube , you don't need assign dmx address, it's convenience for event show and led light rental. Manual led linear tube, you need assign dmx address by Address Writer before light up, for DJ club, architecture light, it's ok.
Photo show of Indoor Led Linear Tube:
Indoor LED Linear Tube
Indoor Led Linear Tube,Rgb Led Lights,White Indoor Led Linear Tube,Led Linear Lighting For Indoor
Shenzhen Iseeled Technology Co., Ltd. , https://www.iseeledlight.com