Vehicles should travel at a speed that matches the road conditions on the highway. If they travel too fast, accidents are likely to occur. If they travel too slowly, they will become a stumbling block for the following vehicles. However, some drivers often violate traffic rules by not following the prescribed speed, resulting in frequent accidents. In order to collect evidence and correct violations, the traffic control department currently uses radar speed measurement systems (using the Doppler effect) to measure the speed of illegal vehicles and collect evidence, and impose penalties.
However, recently, an anti-radar speed measurement device called "electronic dog" has appeared on the market. When approaching the radar speed measurement area, this device can capture the radar speed measurement information in advance and alarm, so that the illegal vehicle escapes punishment, and the potential for accidents still exists. Therefore, it is particularly necessary to study a reliable speed measurement and management system that can accurately measure the speed of the car and will not be discovered by the "electronic dog".
The new speed measurement system with infrared light sensor and ARM as core components studied in this paper will not be discovered by the "electronic dog" when measuring speed. It can not only identify the size of the car speed V, but also measure the value (+△V) of its speed exceeding the upper speed limit (Vmax) or the value (-△V) below the lower speed limit (Vmin). According to this information, the evidence collection system (printing, taking pictures) can be driven to work as appropriate, which can effectively improve the strength of traffic control.
2 System working principle
The system consists of a modulated infrared light sensor, Philips' LPC2294 ARM embedded processor, a color LCD display with a touch screen, and an alarm camera system, as shown in Figure 1. In Figure 1, points M and N are two points on the guardrail on one side of the road, each of which is equipped with an infrared light-emitting tube that can emit 38KHz and emits modulated infrared light all the time. The modulated infrared light is received by the photoelectric receivers placed at the corresponding two points M' and N' on the guardrail on the other side, forming a light-controlled speed measurement area. When a vehicle passes through the light-controlled speed measurement area, the light emitted from point M is first blocked. The first photoelectric detector M-M' converts the optical signal into an electrical signal and sends it to the signal conditioning circuit. After amplification and shaping, it is sent to the ARM processor. ARM receives this trigger signal, turns on the internal counter to start counting, and the value of time t increases accordingly. When the car reaches point N, the second photoelectric detector N-N' converts the optical signal into an electrical signal and sends it to the ARM processor through the signal conditioning circuit to stop the counter counting, and the value of t is determined. The speed V is obtained by dividing the distance L between points M and N by t. If the calculated V value is within the set safe speed range, the display screen will display the current safe speed value, and the camera and alarm circuit will not work; if the V value exceeds the set range, the speed offset △V = Vmax-V is calculated, and the vehicle is displayed as speeding, and the camera and alarm circuits are started. Similarly, if the vehicle passes through the light-controlled speed measurement area at a low speed of V
3 System Hardware Design
3.1 Photoelectric Transmitting and
Receiving System The principle of the photoelectric transmitting and receiving system is shown in Figure 2. The oscillator generates a signal with a frequency of 38KHz to drive the infrared light-emitting tube to emit light. The photoelectric receiver receives the light pulse emitted by the infrared light-emitting tube, and the received light pulse signal is connected to the input end of the detector through the adjustment potentiometer. The received modulated light pulse signal is sent to the amplifier for amplification, and after threshold detection, it becomes a logic level pulse output synchronously with the synchronous oscillator, and then through pulse synchronous demodulation, the photoelectric signal related to the vehicle's motion state is obtained and output through buffering.
3.2 Signal Reception and Timer Operation
As shown in Figure 3, when no vehicle passes through the light-controlled speed measurement area, points M' and N' can always receive 38KHz modulated infrared light, both output high level, and the temporary steady-state circuit is in a steady state. The output of gate G is logic 1, and UL is always high. When a vehicle passes through the light-controlled speed measurement area, the light emitted by point M is first blocked, UM changes from high level to low level first, and the temporary steady-state circuit 1 is triggered and enters the temporary steady state, as shown after time t1 in Figure 4. At this time, UM' is low level, gate G is triggered, and the output UL is low level. CAP1.0 of the ARM system captures UL from high level to low level, and a falling edge capture occurs. The value of T1TC is automatically loaded and transferred to the capture register T1CR, and an interrupt is generated. The interrupt service subroutine is entered to read the value of T1CR and save it.
Then, when the car reaches point N, that is, at time t2, the transient steady-state circuit 2 is triggered, UN' changes to a high level, and then changes to a low level UN'' through the NOT gate. At this time, the output of the G gate changes from a low level to a high level, and the CAP1.0 of the ARM captures the change of UL from a low level to a high level, a rising edge capture occurs, and the value of T1TC is automatically loaded into the capture register T1CR, and an interrupt is generated to enter the interrupt service subroutine. The difference N between the two capture registers T1CR and the working frequency f of the counter are calculated to obtain the time difference t2-t1 when the vehicle passes through the two test points M and N. [page]
3.3 ARM core board and touch display system The
system core board adopts the DEVICEARM2200 industrial control board, which is embedded with Philips' LPC2294ARM7TDMI-S embedded processor with a maximum frequency of 60MHz, and has 8M PSRAM memory and 16M NANDFlash. The performance fully meets the requirements of the high-speed vehicle speed measurement system. Due to its small package and extremely low power consumption, it can be powered by batteries, so it is very suitable for working in the field without an external power supply.
The circuit connection is shown in Figure 5: the display screen uses a 320×240 color LCD screen, and the AB0 to AB16 of the LCD controller S1D13503 is connected to the address bus A1 to A17 of the LPC2294, and operates in 16-bit bus mode; the data bus DB0 to DB7 of the S1D13503 is connected to the external memory data line D0 to D7 of the LPC2294, and DB8 to DB15 is connected to VDD to achieve the 8-bit data bus connection with the LPC2294; its hardware configuration is completed by two high-speed CMOS static memories IS61C1024 to S1D13503 VD0 to VD15. The four-wire resistive touch screen can detect the touch signal and convert the analog signal into position coordinate data through the touch screen controller FM7843, and pass it to LPC2294 for processing.
4 System Software Design
4.1 uclinux system transplantation
Although uclinux currently supports ARM architecture without MMU, the specific ARM processor chip used has different storage system, different on-chip peripherals, and different interrupt systems. Therefore, it is necessary to add or modify specific codes related to the LPC2294 chip. Including: adding chip model, startup code and data structure describing the model; modifying the interrupt system related code and adding irq.h, irq.c and irqs.h files in the include/asm-armnommu/arch-lpc/ directory to realize system interrupt; adding dma.h, memory.h, processor.h and other header files in the include/asm-armnommu/arch-lpc/ directory, and defining the register addresses including clock, serial port, interrupt controller, etc. in the hardware.h file; creating files time.h, timex.h and serial.h in the include/asm-armnommu/arch-lpc/ directory to realize the transplantation of clock serial port driver; modifying the config.in file in the arch/armnommu/config directory to set the menu configuration and modifying files such as mach-lpc/makefile, linux-2.4.x/makefile and arch/armnommu/makefile.
4.2 Device driver design
Since the uclinux 2.4.x kernel is non-preemptive, the process time slice is 10ms, and the real-time performance is not high. However, since there is only one high-real-time task in this system, the capture of the vehicle passing signal, the TIMER1 device driver can be used to operate the timer on the LPC2294 to achieve the double-edge capture of the CAP1.0 pin signal. The TIMER1 device driver consists of a driver initialization function, a clearing function, a device information structure, open, release, read, ioctl and other methods, and an interrupt service program. When loading the kernel module, the uclinux system will first execute the initialization function timer1_init(), register the character device by calling result = register_chrdev (MAJOR_NR, DEVICE_NAME, &timer1_fops); and judge whether the device registration is successful based on the return value result; when the kernel unloads the module, the clearing function timer1_cleanup() is executed, and the character device is deregistered by calling unregister_chrdev(MAJOR_NR, DEVICE_NAME). The device information structure is used to describe the open, release, read and other operation methods of the device: Among them, when the system and application use this timer for the first time, first execute the timer1_open(struct inode *inode, struct file *filp) method to call the request_irq(IRQ_timer1, timer1_irq_handle, SA_INTERRUPT, "my" DEVICE_NAME, NULL) function to register the interrupt response function, configure the timer T1IR, T1PR, T1TC, T1TCR and other registers to complete the timer initialization, and use the interrupt switch function local_irq_save() and local_irq_restore() to control the critical section; finally, the uclinux system receives the hardware interrupt and calls the interrupt service program; when the system and application no longer use the timer, call timer1_release(struct inode *inode, struct file *filp) to close and release it. The interrupt service program timer1_irq_handle (int irq, void *dev_id, struct pt_regs *regs) completes clearing the interrupt source, resetting the timer counter, and reading the value of the counter in the capture register through the macro inl (T1CR) provided by uclinux, and calling the system function copy_to_usr () to copy the data from the kernel space to the user space. Finally, copy the device driver timer1. c to the linux-2.4.x/driver/char directory, and add the function timer1_init () to timer1.c to complete the device registration. Add the timer1_init () external function description to the mem.c file, add the timer1_init () call to the chr_dev_init () function, and compile to get the new kernel.
4.3 MiniGUI transplantation
At present, the common GUI systems under the embedded Linux platform include: MicroWindows, QT/Embedded, XWindows, OpenGUI, MiniGUI and many other options. Considering the ease of use, cross-platform and development cost, this paper uses MiniGUI of Feynman Company to develop the GUI human-computer interaction graphical interface. To facilitate debugging, VMware software is used to establish a host machine of Linux platform under Windows system, enter the Linux environment, download the function library source code package libminigui-str-1.6.2.tar.gz and resource file package minigui-res-str-1.6.tar.gz from www.minigui.com and expand them.
In order to realize its cross-platform characteristics, MiniGUI uses GAL (Graphics Abstraction Layer) and IAL (Input Abstraction Layer) to isolate the upper layer of MiniGUI from the operating system. Therefore, first create the lcdgal.c file, refer to the native graphics engine data structure and Framebuffer driver to write the interface function according to the GAL interface; then put the LCD driver lcddriver.clcddriver.h and the LPC2294 header file lpc2294.h in the /src/gal/native directory under libminigui and modify the Makefile.am file. Add ialinput.h and ialinput.c to the /src/ial directory of libminigui to write the IAL interface function, and add the touch screen controller driver fm7843.c and fm7843.h to the /src/ial directory, and modify the Makefile.am file. Add the MINIGUI extension library libmgext support, cross-compile in Threads mode and link the obtained MiniGUI static link library with the cross-compiled user application to generate a target file that can run on the target board, and finally install the resource files required to run MiniGUI on the transplanted uclinux system.
4.4 User Interface Design
The user interface mainly includes a main window for displaying speed information and a dialog box for vehicle speed alarm. With MniniGUIMain( int argc, const char* argv[ ] ) as the entry point, the display area is defined, two concurrent threads are created using the CreateThreadForMainWindow() function, the thread entry function address is defined and the thread identifier is returned; the initialization operation of timer1 is completed in the main thread, the main window is created through hMainWnd =CreateMainWindow( &Createinfo ) and the various properties of Createinfo are configured, the ShowWindows( hMainWnd, SW_SHOWNORMAL ) function is called to display the window as the user main interface, and finally enter the message loop. The monitoring thread and the main thread are started at the same time. After that, the monitoring thread monitors the vehicle speed information data in real time in the background and sends the corresponding message to the main thread through SendMessage(). The message processing and speeding alarm judgment can be implemented in the main window procedure function SpeedWinProc(). The SET and About drop-down menus in the main form are implemented by the CreatMenu() and CreatePopupMenu() functions, which are used to pop up the speed setting dialog box and the system description dialog box respectively. The menu handle is assigned to the hMenu property of the main form and the corresponding menu processing code is added to the form procedure function. When the menu is clicked by the administrator, the form will receive the corresponding MSG_COMMAND message, and the system will execute the speed setting processing program or the system description display program under the corresponding menu according to the message. In the speed setting dialog box, the button uses the ordinary "OK" button CTRL_BUTTON, and the two static boxes CTRL_STATIC respectively identify the functions of the two single-line edit boxes CTRL_SLEDIT: "Upper speed setting" and "Lower speed setting". The two edit boxes are used to receive the upper and lower speed limits entered by the administrator. The speed setting value in the edit box is input by the digital button implemented by the CTRL_COOLBAR control through the MSG_GETTEXT message. The creation of each control is realized by calling the Createwindow function with the control class name.
5 Conclusion
The modulated infrared light vehicle speed recognition system can not only accurately measure the vehicle speed, but also avoid the capture of the "electronic dog" type anti-speed measurement device, making it difficult for illegal vehicles to escape punishment. It plays an important role in improving the quality of traffic control, eliminating potential accidents, and ensuring the safety of people's lives and property. It can also be used in other speed measurement occasions, and its application prospects are very broad. Since the sensor head is only sensitive to 38 kHz modulated infrared light, other infrared light has almost no effect on it, so the system has strong anti-interference ability. The system uses an ARM embedded processor, uclinux operating system and touch screen. It not only has good human-computer interaction, but also has strong upgrade and expansion capabilities, stable operation, and great application prospects.
Previous article:Design of CAN/CAN bridge in bus network control
Next article:Research on Automobile Electric Power Steering System Based on ARM Single Chip Microcomputer
Recommended ReadingLatest update time:2024-11-16 13:28
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University Hall -- Experts teach you how to DIY a pocket PC
- Chapter 6 Application of SPI - OLED Display
- PCB circuit board questions
- STMicroelectronics SiC products and industrial application guide live data collection
- MSP430 capture device is simple and practical
- Colorful wallet programmed with CircuitPython
- The storage and downloading of time values sent by customers require sum verification or CRC verification
- EPWM CMPA register configuration problem
- Allegro's latest solution for 48v system
- EEWORLD University Hall----Live Replay: Microchip Security Series 12 - PolarFire? SoC FPGA Secure Boot