Design of wireless video surveillance smart car based on OPenWrt open source system

Publisher:chaohuangmeitaoLatest update time:2016-03-16 Source: 21icKeywords:OPenWrt Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
introduction

With the continuous development of computer science and technology, various intelligent devices have emerged. In particular, the recent frequent exposure of news about unmanned remote-controlled aircraft, from celebrity proposals to express delivery, all reflect that unmanned remote-controlled devices will be a new starting point for future industrial development and innovative applications. However, at present, drones are mostly used for aerial photography or aerial mapping. For indoor applications, such as dust-free, anti-theft, and enterprise warehouse management with high environmental parameters, drones have shown disadvantages in terms of endurance and indoor directional cruising; and for the transportation of supplies in narrow places and the detection of underground life that are common in natural disasters such as earthquakes and mudslides, the functions of drones are greatly reduced.

Based on the above reasons, this paper proposes a design of a wireless remote control video surveillance smart car based on open source hardware, combining open source hardware with the Linux system, turning the video surveillance car into a smart device with WiFi function. Users can add the smart car to the existing WiFi network through reasonable system configuration, so that users can wirelessly control the movement of the smart car and transmit real-time video surveillance images, solving the problem of monitoring the internal environment and transporting materials when some places are inaccessible due to certain reasons. At the same time, the use of open source hardware also avoids the high design and debugging costs of hardware equipment, providing a new solution for the development and application of smart devices in the future.

1 Overall system design

This design adopts dual-core and dual-system architecture design, so as to clarify the responsibilities of each subsystem, reduce the burden of the hardware system, improve the cohesion of each subsystem, and reduce the coupling between subsystems. Among them, the intelligent car control system adopts the ATmega32U4 chip based on the AVR core. The clock frequency of the chip is 16 MHz, with 20 digital interfaces, 12 analog interfaces, and 7 PWM interfaces. At the same time, the built-in USB communication function can save the UART to USB design in the peripheral circuit. The wireless video monitoring system adopts the currently recognized relatively stable WiFi solution, namely the Atheros AR9331 chip solution. The chip adopts the MIPS architecture, the CPU main frequency reaches 400 MHz, and only 3.3 V is required to implement the ultra-low power consumption 802.11n protocol. Therefore, for this system, only a 5 V USB interface is needed to realize the power supply and program burning functions for the entire system, making the system development extremely convenient.

In addition, during the software operation, users can easily communicate with the smart car system through the REST API provided by the intelligent system, control the various movements and obstacle avoidance of the smart car, and even switch between automatic control and manual control of the smart car. At the same time, the video surveillance system has a built-in Open Wrt system based on embedded Linux, and a real-time video transmission system - MJPEG-STREAM is built based on this system. Users only need to use the HTTP interface to easily realize the transmission of real-time image data.

The hardware adopts an open source design. Through the continuous improvement and perfection of hardware engineers around the world, the stability of the hardware system is guaranteed. At the same time, the open source design also saves a lot of early hardware development costs, improves the development efficiency of the hardware system, and reduces the development cost. In terms of software, its main features are reflected in the user interface. Whether it is the intelligent car control system or the video monitoring system, HTTP communication is adopted, which can support various terminal devices, such as mobile terminals, PC terminals, and even Web terminals. The system structure is shown in Figure 1.

a.jpg

2 Implementation of MJPEG-STREAM video stream

MJPEG-STREAM is a camera image acquisition system based on "motion image compression technology", and the system transmits real-time images via the Web. Users only need to use a browser to perform video surveillance and other tasks. At the same time, since the system is developed in an open source manner, there are no copyright issues for any modification and use of the system, which reduces the cost of video development and improves development efficiency.

This project is based on the construction of MJPEG-STREAM on the OpenWrt system. OpenWrt is also an open source embedded Linux system that contains more than 3,000 software packages. Users only need to follow simple instructions to download, compile, install and use the software. The specific construction steps are as follows:

①Update OpenWrt's software source.

OpenWrt:~# opkg update

② Download and install the UVC camera driver. After the installation is complete, insert the camera. If you see the video0 file in the /dev directory of OpenWrt, it means the installation is successful.

OpenWrt:~#opkg install kmod-video-uvc

③Download and install the MJPEG-STREAM open source library.

OpenWrt:~# opkg install mjpeg—streamer

④Connect the camera, start MJPEG-STREAM, and set its output resolution and address.

OpenWrt:~# mjpg_streamer-i“input_uvc.so/dev/video0—r 640x480”-o”output_http.so-p 8080-w/www/webcam”

⑤Finally, enter the following address in the browser to conduct video surveillance.

http://local_ip:8080? action=snapshot

http://local_ip:8080/?action=stream

3 Design of REST interface

REST (Representational State Transfer) is a software architecture style proposed by Dr. Roy Fielding in 2000. It is a design and development method for network applications that can reduce the complexity of development and improve the scalability of the system. It defines a set of architecture principles that developers can use to design Web services centered on system resources, including how clients written in different languages ​​process and transmit resource states through HTTP. Currently, REST has become the most important Web service design pattern.

In this project, the REST interface mainly implements three applications, namely, multi-angle rotation of surveillance cameras, motion control of smart cars, and acquisition of real-time data from various sensors, as follows.

① Multi-angle rotation of the surveillance camera: including the control of the angles of the horizontal servo and the vertical servo. The vertical angle is 0° when the camera is facing the ground, 0 to 180° upward, and 0° to the left and 0 to 180° to the right. However, when the user does not set the angle, the default value of 10 is passed to the backend for processing, as listed in Table 1.

b.jpg

② Motion control of smart car: including controlling the vehicle's forward, backward, turning, and stopping operations. At the same time, the user needs to pass the vehicle's forward, backward, and turning speed values ​​to the system, otherwise the system will use the default value to pass it to the back-end system, as listed in Table 2.

③ Acquisition of real-time data of various sensors: To obtain sensor parameters, we must first obtain the types of various sensors. Therefore, this system must provide an interface to return all sensor types included in this system, and then obtain the current real-time data of the corresponding sensor through this type, as listed in Table 3.

4 Design of CGI Program

In this project, in addition to receiving various requests from users through the REST API, what is more important is that after analyzing and identifying these requests, these instructions can be sent to the ATmega 32U4 for processing using serial communication. The bridge that combines the REST interface with local applications is CGI.

CGI (Common Gateway Interface) is one of the most important technologies in the World Wide Web. It is the interface standard and information transmission specification between local applications and Web servers. CGI allows Web servers to execute local applications and send their output to Web browsers, turning Web pages from a single static display into a complete interactive media.

First of all, this project adopts a dual-core, dual-system architecture, so the serial port is used as the data communication method between Atheros AR9331 and ATmega32U4. In addition, since OpenWrt based on the Linux system is deployed on the Atheros AR9331, and the Linux system is very convenient for serial port operation, after receiving the user's REST request, it is only necessary to obtain the user's request data according to the writing specifications of the CGI program, and parse the request type and request parameters from it. Finally, these requests and parameters are sent to ATmega32U4 through the serial port for post-processing. The specific process is shown in Figure 2.

c.jpg

5. Design of Intelligent Vehicle Control System

The smart car control system mainly includes three aspects, namely, smart car motion control, camera PTZ control, and data acquisition of various sensors. By receiving instructions from front-end users and analyzing and transmitting them through CGI programs, users can use HTTP access in any platform to control the motion of smart cars and PTZs, as well as obtain sensor data.

5.1 Design of Intelligent Vehicle Motion System

The motor drive of the intelligent car motion system in this system adopts ST's typical dual H-bridge DC motor driver chip L298N. This chip has strong driving capability and can provide a peak current of 2 A and a peak voltage of 46 V at most. In addition, since L298N only provides 2-way drive, but this project needs to use the drive of 4-way stepper motor, the original 2-way output is expanded to become 4-way two-phase output, so that the 4 independent outputs on the left and right sides are merged into 2-way outputs on the left and right sides, as listed in Table 4.

d.jpg

In Table 4, EA and EB represent the PWM speeds of the left and right motors, respectively. When the PWM is higher, the movement speed of the smart car is faster; I1, I2 and I3, I4 represent the direction of the left and right motors, respectively. 0 and 1 are clockwise, and 1 and 0 are counterclockwise.

5.2 Design of camera pan/tilt system

The camera pan/tilt control system in this system is mainly controlled by the RB-421 one-dimensional servo produced by RobotBase, which can accurately rotate horizontally or vertically.

The servo control system is mainly controlled by the servo control line transmitting variable PWM pulses. Usually the reference signal period of the servo is 20 ms and the width is 1.5 ms. When the PWM signal is transmitted as the reference signal, the servo is in the middle position between the maximum angle and the minimum angle, that is, the 90° position.

When the PWM signal cycle is 0.5 ms, the position of the servo is 0°, and when the PWM signal cycle is 2.5 ms, the position of the servo is 180°. If the transmitted PWM signal remains unchanged at this time, the position of the servo will not change until the external force is greater than its own maximum torque, and the servo will change its angle. The specific relationship between PWM and angle is shown in Figure 3.

e.jpg

5.3 Design of Smart Car Sensor System

A variety of sensors are used in this system. For example, grayscale sensors are used to realize the automatic patrol function of the smart car, ultrasonic sensors and servos are used to realize 180° obstacle avoidance of the car, infrared sensors are used to avoid tail obstacles, and environmental sensors such as temperature, humidity, and smoke are used to obtain real-time environmental parameters.

When the user sends a sensor data request to the smart car, the system sends the request to the ATmega32U4 chip through CGI. The chip matches the various request types to run the corresponding sensor processing function and sends it to the CGI program through the serial port. Finally, the CGI program presents the data to the user through the Web. The process is shown in Figure 4.

f.jpg

Conclusion

This paper discusses the main technologies of wireless video surveillance smart cars based on open source hardware. The dual-core, dual-system architecture improves the overall stability of the system and reduces the workload of each module. Secondly, in this system, user commands and video surveillance use HTTP for data interaction, so that the system can control the smart car through any terminal, expanding the application scope and application occasions of the system, and getting rid of the situation where only special equipment can be used for control in the past.

Finally, both software and hardware in this system adopt open source design, which greatly reduces the system development cost and improves the efficiency of system development. By integrating various resources, this project provides a feasible method for the development of smart devices and unmanned driving technology in the future, which has certain application value.

Keywords:OPenWrt Reference address:Design of wireless video surveillance smart car based on OPenWrt open source system

Previous article:AVR - Several concepts that must be understood when using timers!
Next article:Research on intelligent dividing head based on AVR single chip microcomputer

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号