CAN data recording method and system for explosion-proof vehicle

By building a main control system and dual storage system based on CAN bus, stable storage and real-time analysis of CAN data of explosion-proof vehicles is achieved, the problems of inconvenient data access and easy transmission are solved, and the specialization and explosion-proof requirements are met, and flexibility and convenience are provided.

CN120452085APending Publication Date: 2025-08-08CHANGZHOU DEV & MFR CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510802117.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The existing CAN data recording system has problems such as inconvenient data access, easy transmission loss, inability to resolve real-time, and inability to meet the requirements of specialized functional functions and explosion-proof MA requirements in explosion-proof vehicles.

Method used

Build a main control system based on CAN bus, set up a dual storage system, use SD and USB storage devices, store data through the FAT32 file management system, and establish wireless data interaction between SD and mobile APP to realize real-time data viewing and parsing.

Benefits of technology

It solves the problems of inconvenient data access and easy transmission loss, ensures the stability and integrity of data, meets the requirements of specialized functional functions and explosion-proof MA requirements, and provides flexibility and convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120452085A_ABST
    Figure CN120452085A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of CAN data recording, and particularly relates to a CAN data recording method and system for an explosion-proof vehicle. The CAN data recording method comprises the following steps: constructing a master control system based on a CAN bus; establishing a data real-time display system of the CAN message; a double-storage system is arranged; carrying out self-updating setting on the SD storage equipment; and establishing a data interaction relationship between the SD storage device and the mobile phone APP. According to the invention, data in the CAN master control system is stored in the SD storage device, the storage space and the storage stability for storing CAN message data records are ensured, the data in the SD storage device is backed up and copied, and the data is stored in the USB storage device or wirelessly transmitted to a mobile phone APP through a built-in AP hotspot signal. The problems that in the prior art, an SD card needs to be frequently plugged and unplugged, data are damaged or lost, and the integrity of the data is affected are solved, and meanwhile, the problems that an operator directly plugs and unplugs the SD card on the explosion-proof electric cabinet in the underground coal mine is unsafe and inconvenient are effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of CAN data recording, and in particular relates to a CAN data recording method and system for explosion-proof vehicles. Background Art

[0002] CAN data logging methods and systems available on the market are generally general-purpose. For the specific application scenario of explosion-proof vehicles, they only offer basic CAN data logging functionality and lack flexible customization and specialization options. This generality leads to a mismatch between the tools' functionality and actual needs, thus hindering their adaptability and efficiency. Existing CAN data logging systems store data in real time to an SD card or wirelessly transmit it to a server, providing limited data storage and preventing offline, timely data analysis and processing. This forces users to rely on additional software or tools for further analysis after acquiring the data, complicating workflows.

[0003] The CAN data recording method and system for explosion-proof vehicles in underground coal mines uses SD cards for storage. Inserting and removing the SD card from the explosion-proof electrical control box in underground coal mines requires opening the box, posing a safety hazard and inconvenience. This also increases the risk of data loss or equipment damage, failing to meet both specialized functional requirements and explosion-proof MA requirements. Wireless data transmission to a server is susceptible to the limitations of different on-site wireless networks, resulting in unavailable, unstable, and even lost data transmission. Furthermore, wireless data transmission to a server requires authorization, making local, real-time data reading and analysis by third-party software impossible, lacking flexibility. Summary of the Invention

[0004] The purpose of the present invention is to overcome the defects of the prior art in that the stored data is inconvenient to access, the transmission is easily lost, the data cannot be parsed in real time, and it cannot meet both the requirements of dedicated functions and explosion-proof MA. The present invention provides a CAN data recording method and system for explosion-proof vehicles with dual storage and built-in WIFI wireless transmission, which has high data storage and transmission stability, can view and analyze data in real time, and can meet the requirements of dedicated functions and explosion-proof MA.

[0005] The technical solution adopted by the present invention to solve its technical problem is:

[0006] As a first aspect, a CAN data recording method for an explosion-proof vehicle includes the following contents:

[0007] Build a master control system based on CAN bus to receive, store, parse, send and record CAN messages in the CAN bus;

[0008] Establish a real-time display system for CAN message data; use the STEMWIN display module to display the parsed CAN message data online or offline;

[0009] Setting up a dual storage system; that is, establishing a one-to-one correspondence between the main control system and the SD storage device, the main control system and the USB storage device, and the SD storage device and the USB storage device, by creating a FAT32 file management system in the SD storage device and the USB storage device, the CAN message data and time information in the main control system that have been preliminarily processed and saved in a specific format are first written to the SD storage device, and then the data in the SD storage device is copied and saved to the USB storage device;

[0010] Set the SD storage device to self-update; that is, when the remaining capacity of the SD storage device is insufficient, the data in the SD storage device will be deleted from the oldest to the newest;

[0011] Establish a wireless data interaction relationship between the SD storage device and the mobile phone APP; that is, wirelessly transmit the data in the SD storage device to the mobile phone APP in point-to-point AP mode, and perform data analysis in real time.

[0012] Furthermore, the receiving and storing of CAN messages in the CAN bus includes the following:

[0013] According to the characteristics of explosion-proof vehicle equipment data, several data buffer areas with priorities are set up;

[0014] Get the CAN message in the CAN bus, and obtain the time information corresponding to the received CAN message through the timing module;

[0015] The received CAN message and time information are preliminarily processed, and the data and time information formed after the preliminarily processing are stored in a specific format in the corresponding data buffer area; that is, the CAN message received by the main control system consists of a string of hexadecimal characters, including frame type, frame format, frame ID and data, etc., and is preliminarily processed according to the characteristics of the explosion-proof vehicle, and only the frame ID and data are retained. Together with the time information provided by the timing module, they are stored in the corresponding data buffer area in a specific format of time, ID and data according to the priority of the data buffer area; the storage capacity of several of the data buffer areas is the same.

[0016] Furthermore, the parsed CAN message data includes the temperature, torque value, speed value of the motor in the explosion-proof vehicle, the speed of the explosion-proof vehicle, the vehicle battery voltage, current, power and various fault information.

[0017] Furthermore, when the main control system receives CAN message data and time information, it classifies the received CAN message data into standard frames and extended frames according to the characteristics of the CAN data of the explosion-proof vehicle equipment, and places them in several data buffer areas in a time-sharing manner;

[0018] When one of the data buffer areas is full, the data in the data buffer area is written into the SD storage device.

[0019] Furthermore, when the SD storage device or / and USB storage device is connected to the main control system, folders and TXT format files are established in the corresponding SD storage device or / and USB storage device based on the FATFS module, and the folders and TXT format files established in the SD storage device and USB storage device have the same names.

[0020] Furthermore, the self-update setting of the SD storage device includes the following contents:

[0021] Set a self-update threshold for the remaining capacity of the SD storage device;

[0022] When the SD storage device is connected to the main control system, the remaining capacity of the SD storage device is detected; if the remaining capacity in the SD storage device is greater than the set self-update threshold, the received data is stored; if the remaining capacity in the SD storage device is less than or equal to the set self-update threshold, the folders are sorted according to the folder creation time, and the old folders in the SD storage device are deleted in order from the oldest to the newest until the remaining capacity is greater than the self-update threshold, and then the data is stored;

[0023] Set the maximum capacity value of any TXT format file in the SD storage device; if the data written into any TXT format file in the SD storage device is equal to the maximum capacity value, create a new folder and TXT format file in the SD storage device.

[0024] Furthermore, the main control system parses the received CAN message data including the following steps:

[0025] Identify the frame ID of CAN message data;

[0026] Parse CAN message data according to the corresponding frame ID in the CAN protocol, and use the data format conversion function to convert hexadecimal to decimal;

[0027] The display data in decimal data format is extracted, recorded, and transmitted to the STEMWIN display module.

[0028] A CAN data recording system for explosion-proof vehicles, using the CAN data recording method for explosion-proof vehicles as described above, comprises:

[0029] Main control module, used to receive, store, parse, send and record CAN message data;

[0030] The CAN communication module is connected to the CAN bus signal through the CAN interface, filters the CAN message data based on the explosion-proof vehicle CAN communication protocol, and receives the CAN message data in the explosion-proof vehicle through the CAN interrupt function;

[0031] A timing module, which adds time stamp information to the CAN message data received by the main control module;

[0032] The SD storage module is connected to the SD storage device signal, initializes the SD storage device, and stores the data in the main control module in the SD storage device;

[0033] The USB_HOST module is connected to the USB storage device signal through the USB_HOST interface to initialize the USB storage device. The USB_HOST module drives the USB storage device to copy and save the data in the SD storage device;

[0034] The STEMWIN display module is connected to the display screen through a display screen interface and is connected to the main control module through a TTL serial port signal, and is used to obtain the data after the CAN message is parsed in the main control module and display it on the display screen;

[0035] The WIFI communication module is connected to the main control module via SPI serial port signals to realize wireless data interaction between the SD storage device and the mobile phone APP.

[0036] Specifically, the main control module includes:

[0037] The data receiving module is used to receive the CAN message transmitted by the CAN communication module and the timestamp information of the CAN message data by the timing module, and save it in the data buffer area according to the format of time, ID and data after preliminary processing;

[0038] A data analysis module is used to analyze and classify the CAN message data that has been preliminarily processed by the data receiving module;

[0039] The data sending module transmits the parsed data to the STEMWIN display module;

[0040] As well as the data recording module, it is created based on the FATFS module, establishes a FAT32 file system in the SD storage device and the USB storage device, manages the data files in the SD storage device and the USB storage device, and writes the CAN message data and time information in the data buffer area of the data receiving module to the SD storage device and the USB storage device.

[0041] Specifically, the timestamp information includes hours, minutes, seconds, and milliseconds;

[0042] When receiving data, the data receiving module performs preliminary processing on the received CAN message, and then saves the data into the data buffer area according to the time, ID, and specific format of CAN data.

[0043] Specifically, the USB_HOST module drives the USB storage device to copy data, which specifically includes the following contents:

[0044] Determine whether the USB storage device is inserted into the USB_HOST interface;

[0045] Identify USB storage devices and initialize USB storage devices;

[0046] Determine whether the files in the USB storage device have a FAT32 file system through the data recording module, and create a FAT32 file system in the USB storage device according to the determination result;

[0047] The data recording module traverses the folders created in the SD storage device in chronological order, and copies the contents of the folders in the SD storage device one by one to the FAT32 file system created in the USB storage device; that is, the folders in the SD storage device are sorted according to the folder creation time, and the folders in the SD storage device are opened from new to old to determine whether they have been copied. If not, the data in the SD storage device is read and the USB storage device is written; after a folder is copied, the next folder of the SD storage device is opened to continue copying until all the folders in the SD storage device are copied.

[0048] The beneficial effects of the CAN data recording method and system for explosion-proof vehicles of the present invention are:

[0049] The present invention integrates the modules of receiving, storing, parsing, sending and recording CAN data to construct a main control system based on CAN bus. By setting up a dual storage system, a FAT32 file management system is created in the SD storage device and the USB storage device. The recorded CAN message data and time information are first saved to the SD storage device to ensure the storage space and storage stability of the CAN message data. Then, the USB storage device is connected to the main control system signal to back up and copy the data stored in the SD storage device. The data is stored in the FAT32 file management system created in the USB storage device or is wirelessly transmitted to the mobile phone APP through the built-in AP hotspot signal. This solves the problem of frequent plugging and unplugging of SD storage devices in the prior art, which may cause damage or loss to the data and affect the data integrity. It also solves the problem of unsafe and inconvenient operation of operators directly plugging and unplugging SD cards on the explosion-proof electric control box in the underground coal mine.

[0050] Several data buffer areas are set in the main control system of the present invention to avoid the problem of new data overwriting old data. That is, when a data buffer area is full, the received new data is placed in the next buffer area before writing to the SD storage device, thereby ensuring data integrity. In addition, TXT files of fixed capacity are created in the SD storage device and the USB storage device to avoid the problem of excessive file size and long data processing cycle. That is, the data in the data buffer area, the SD storage device and the USB storage device are all stored as several smaller files, thereby making the processing speed faster and optimizing the processing speed to a great extent.

[0051] The present invention sets the CAN protocol through the CAN communication module to filter CAN messages, and displays the data in real time and displays the analysis results through the STEMWIN display module, thereby ensuring that the CAN data recording system for explosion-proof vehicles can have high customization and specialization. At the same time, the data in the SD storage device is wirelessly transmitted to the mobile phone APP via WIFI, ensuring the stability and integrity of the data while providing users with greater flexibility and convenience, and enabling timely retrieval, analysis and remote management of historical data. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0053] Figure 1 This is a flowchart of the steps of the CAN data recording method for explosion-proof vehicles in Example 1 of the present invention.

[0054] Figure 2 Schematic diagram of the structure of the CAN data recording system for explosion-proof vehicles in the second embodiment of the present invention.

[0055] Figure 3This is a CAN message format diagram in the second embodiment of the present invention.

[0056] Figure 4 This is a screenshot of the folder created in the SD storage device in the second embodiment of the present invention.

[0057] Figure 5 This is a screenshot of the TXT file created on the SD storage device in the second embodiment of the present invention.

[0058] Figure 6 This is a display diagram of the time data curve in the second embodiment of the present invention on a display device.

[0059] Figure 7 This is a practical workflow diagram of the CAN data recording system according to the second embodiment of the present invention.

[0060] In the figure: 1. Main control module, 11. Data receiving module, 12. Data parsing module, 13. Data sending module, 14. Data recording module, 2. CAN communication module, 3. CAN interface, 4. CAN bus, 6. SD storage module, 8. SD storage device, 9. USB_HOST module, 10. USB_HOST interface, 20. USB storage device, 30. STEMWIN display module, 40. Display interface, 50. Display, 60. WIFI communication module, 70. Timing module, 80. Mobile phone APP. DETAILED DESCRIPTION

[0061] The present invention will now be described in further detail with reference to the accompanying drawings, which are simplified schematic diagrams that illustrate the basic structure of the present invention in a schematic manner.

[0062] Example 1

[0063] As shown in the figure, a specific embodiment of a CAN data recording method for an explosion-proof vehicle of the present invention includes the following steps:

[0064] S10: Build a master control system based on the CAN bus to receive, store, parse, send and record CAN messages in the CAN bus.

[0065] Specifically, the data reception and storage of the CAN message in the CAN bus in step S10 includes the following:

[0066] Step 1: According to the characteristics of explosion-proof vehicle equipment data, set up several data buffer areas with priorities;

[0067] Step 2: Obtain the CAN message in the CAN bus, and obtain the time information corresponding to the receipt of the CAN message through the timing module 70;

[0068] Step 3: Perform preliminary processing on the received CAN message data and time information, and save the data and time information formed after the preliminary processing in a specific format in the corresponding data buffer area; that is, the CAN message received by the main control system consists of a string of hexadecimal characters, including frame type, frame format, frame ID and data, etc., and is preliminarily processed according to the characteristics of the explosion-proof vehicle, only retaining the frame ID and data, and together with the time information provided by the timing module, it is saved in the corresponding data buffer area in a specific format of time, ID and data according to the priority of the data buffer area; the storage capacity of several data buffer areas is the same.

[0069] S20: Establishing a real-time display system for CAN message data; using the STEMWIN display module 30 to display the parsed CAN message data online or offline.

[0070] This embodiment integrates CAN message data reception, parsing, transmission, and data logging, and establishes a CAN message data display system that displays parsed CAN message data online or offline, enabling personnel to monitor and dispatch vehicles in real time. The parsed CAN message data includes explosion-proof vehicle motor temperature, torque, speed, vehicle speed, vehicle battery voltage, current, battery charge, and various fault information.

[0071] S30: Setting up a dual storage system; that is, establishing a one-to-one correspondence between the main control system and the SD storage device 8, the main control system and the USB storage device 20, and the SD storage device 8 and the USB storage device 20. By creating a FAT32 file management system in the SD storage device 8 and the USB storage device 20, the CAN message data and time information that have been initially processed and stored in a specific format in the main control system are first written to the SD storage device 8, and then the data in the SD storage device 8 is copied and stored in the USB storage device 20. The specific format in this embodiment is a combination of the ID of the CAN message data, the time provided by the timing module, and the data of the CAN message data. It should be understood that the specific format in this embodiment is not fixed and can be set according to the specific requirements of the explosion-proof vehicle. The specific formats of the specific formats are not listed here.

[0072] Among them, the main control system will receive a CAN message consisting of a string of hexadecimal characters, including frame type, frame format, frame ID and data, etc. During preliminary processing, the frame ID and data are retained according to the characteristics of the explosion-proof vehicle in this embodiment, and are combined with the time information provided by the timing module into a specific format file, and then saved to the data buffer area in the specific format. The CAN message data after parsing the data in the data buffer area is transmitted to the display system for data display. The parsed CAN message data includes the temperature, torque value, speed value, driving speed, vehicle battery voltage, current, power and various fault information of the motor in the explosion-proof vehicle.

[0073] Specifically, a one-to-one connection is established between the main control system and the SD storage device. CAN message data, which has been initially processed by the main control system and stored in a specific format, and time information obtained by the timing module 70 are transferred to the SD storage device for storage. A one-to-one correspondence is established between the main control system and the USB storage device 20, and between the SD storage device 8 and the USB storage device 20, via the USB_HOST interface 10. Data stored in the SD storage device 8 is backed up and copied to the USB storage device 20. The data recording module 14 creates a FAT32 file management system in both the SD storage device 8 and the USB storage device 20. In other words, the dual storage system in this embodiment includes the following storage sequence: CAN message data, which has been initially processed by the main control system and stored in a specific format, and time information obtained by the timing module are transferred to the SD storage device 8 for storage; and data stored in the SD storage device 8 is backed up and copied to the USB storage device. In this embodiment, the data recording module 14 creates files in the SD storage device and the USB storage device 20, including folders and TXT files.

[0074] S40: Setting the SD storage device 8 to self-update; that is, when the remaining capacity of the SD storage device 8 is insufficient, the data in the SD storage device 8 is deleted from the old to the new.

[0075] S50: A wireless data interaction relationship between the SD storage device 8 and the mobile phone APP 80 is established based on the WIFI communication module 60; that is, the data in the SD storage device 8 is wirelessly transmitted to the mobile phone APP 80 in a point-to-point AP mode, and the data is analyzed.

[0076] In the first embodiment of the present invention, a main control system based on the CAN bus 4 is constructed, which is used to receive, store, parse, send and record CAN messages in the CAN bus, and a dual storage system is set up. The received CAN message data and time information are recorded based on the FATFS module. The recorded data is first transmitted and saved to the SD storage device 8 to ensure the storage space and storage stability for storing the CAN message data and time information records. Then, the USB storage device 20 is connected to the main control system signal through the USB_HOST interface 10, and the data stored in the SD storage device 8 is backed up and copied. The CAN message data is stored in the USB storage device 20 or directly wirelessly transmitted to the mobile phone APP, which solves the problem of frequent plugging and unplugging of SD cards in the prior art, causing damage or loss to the data and affecting the integrity of the data. At the same time, it also solves the problem of unsafe and inconvenient operation of operators directly plugging and unplugging SD cards on the explosion-proof electric control box in the underground coal mine in the explosion-proof environment.

[0077] In this first embodiment, when the main control system receives CAN message data in step S10, the timing module 70 timestamps it. Based on the characteristics of CAN data from explosion-proof vehicle equipment, the received CAN message data is classified into standard frames and extended frames, and stored in several data buffers in a time-sharing manner. Furthermore, in step S30, when the SD storage device 8 and the USB storage device 20 copy and store the data (i.e., when the SD storage device 8 and / or the USB storage device 20 are connected to the main control system), the data recording module 14 creates a folder and a TXT format file in the corresponding SD storage device 8 and / or the USB storage device 20. The folder and TXT format file created in the SD storage device 8 and the USB storage device 20 have the same name. During this process, the main control system receives CAN messages from the CAN bus 4, obtains the time information of the received CAN messages through the timing module 70, performs preliminary processing on the received CAN message data and time information, stores them in the corresponding data buffers within the main control system, and performs data parsing on the received CAN message data. When the main control system receives CAN message data and time information, it classifies the received CAN message data and places it in several data buffer areas in a time-sharing manner. When a data buffer area is full, the data in the data buffer area is written to the SD storage device. The new data received during the writing process is placed in the next buffer area to avoid new data overwriting old data. The data is transmitted in batches, which ensures both data integrity and the speed of data processing and transmission.

[0078] In this embodiment, the data recording module 14 creates folders and TXT files with the same name in the SD storage device 8 and the USB storage device 20. Users can flexibly filter data based on the CAN protocol and categorize and save data in different TXT files, eliminating the need for host computer operation. This greatly enhances the tool's adaptability and application scope, meeting various scenarios and needs, and facilitating in-depth analysis and processing of different data on a computer as needed.

[0079] In step S20 of this embodiment, a graphical display page was developed based on the STEMWIN display system. This page features offline, real-time display of parsed CAN data and curve plotting. This allows for offline, real-time display of data and curve generation. This differs from existing CAN data logging tools that simply store CAN messages. To meet users' demands for efficient and real-time data processing, our CAN data logging tool automatically parses CAN messages upon receiving a CAN signal, displays the parsed CAN data on the display, and plots a curve. This functionality provides users with an intuitive, visual data analysis and processing interface, enabling them to quickly understand and grasp the dynamic changes in CAN data. By displaying the parsed CAN data offline and generating curves, users no longer need to rely on external software to complete data analysis and processing, making it easier to perform operations such as fault diagnosis, performance evaluation, and data analysis. This not only improves the speed and accuracy of data processing, but also greatly enhances user work efficiency and convenience.

[0080] In step S40, the SD storage device 8 is configured to self-update, including the following:

[0081] S401: Setting a self-update threshold for the remaining capacity of the SD storage device 8;

[0082] S402: When the SD storage device 8 is connected to the main control system, the remaining capacity of the SD storage device 8 is detected; if the remaining capacity of the SD storage device 8 is greater than the set self-update threshold, the received data is stored; if the remaining capacity of the SD storage device 8 is less than or equal to the set self-update threshold, the folders are sorted according to the folder creation time, and the old folders in the SD storage device 8 are deleted in order from the oldest to the newest until the remaining capacity is greater than the self-update threshold, and then the data is stored;

[0083] S403: Set the maximum capacity value of any TXT format file in the SD storage device 8; if the data written into any TXT format file in the SD storage device 8 is equal to the maximum capacity value, create the next folder and TXT format file in the SD storage device 8.

[0084] In this embodiment, a single TXT file in the FAT32 file system is too large, and file operations and data processing and analysis also take a long time. In order to avoid the TXT file being too large and facilitate data analysis, when the TXT file is larger than the set maximum capacity value of the TXT format file (specifically 200M in this embodiment), a new TXT file will be created and saved in the folder to continue receiving CAN data.

[0085] As a preferred implementation, the main control system in this embodiment parses the received CAN message data including the following steps:

[0086] A1: Identify the frame ID of CAN message data;

[0087] A2: Parse the CAN message data according to the corresponding frame ID in the CAN protocol and use the data format conversion function to convert the hexadecimal data into decimal data;

[0088] A3: Extracting display data in decimal data format, recording the display data and transmitting it to the STEMWIN display module 30 .

[0089] The data format conversion function is used to convert the hexadecimal into decimal, and the CAN data is converted into data such as the temperature, torque value, speed value of the motor in the explosion-proof vehicle, the speed of the explosion-proof vehicle, the vehicle battery voltage, current, power and various fault information, and the parsed data is transmitted to the STEMWIN display module 30 for data display.

[0090] In practical applications, vehicles require long-term, continuous recording of large amounts of data to ensure proper operation and troubleshooting. SD storage devices 8, due to their excellent stability and large storage capacity, are ideal for data storage. However, plugging and unplugging SD storage devices 8 within explosion-proof electrical control boxes in underground coal mines requires opening the explosion-proof enclosure, which is inconvenient and poses a safety hazard. Frequent plugging and unplugging of SD storage devices 8 can also damage or lose data, compromising data integrity. Therefore, in step 20, the CAN data recording method of the present invention combines data storage modes with both SD storage devices 8 and USB storage devices 20. The data recording module 14 within the main control system, based on the FATFS module, establishes file systems in the SD storage device 8 and USB storage device 20, automatically creating folders and TXT files. Data in program settings is first securely stored in the SD storage device 8, ensuring data stability and reliability. Simultaneously, data in the SD storage device 8 is backed up and replicated via the USB storage device 20, providing users with greater flexibility and convenience.

[0091] Example 2

[0092] A CAN data recording system for explosion-proof vehicles based on the aforementioned CAN data recording method for explosion-proof vehicles includes: a main control module 1, a CAN communication module 2, a timing module 70, an SD storage module 6, a USB_HOST module 9, a STEMWIN display module 30, and a WIFI communication module 60. The main control module 1 is configured to receive, parse, send, and record CAN message data, cache CAN message data and time information, output the parsed CAN message data, and write the buffered data to an SD storage device 8 and a USB storage device 20. The CAN communication module 2 is signal-connected to a CAN bus 4 via a CAN interface 3, filters CAN messages based on the explosion-proof vehicle CAN communication protocol, and receives CAN messages from the explosion-proof vehicle via a CAN interrupt function. The SD storage module 6 is signal-connected to the SD storage device 8, initializes the SD storage device 8, and saves data written to the SD storage device 8 by the data recording module 14. The USB_HOST module 9 is signal-connected to the USB storage device 20 via a USB_HOST interface 10, and drives the USB storage device 20 to copy data from the SD storage device 8. The STEMWIN display module 30 is connected to the display screen 50 via the display screen interface 40 and to the main control module 1 via TTL serial signals. It is used to obtain the parsed CAN message data and display it on the display screen 50. The WIFI communication module 60 is connected to the main control module 1 via SPI serial signals to realize wireless data exchange between the SD storage device 8 and the mobile phone app 80.

[0093] The main control module 1 in this second embodiment includes a data receiving module 11, a data parsing module 12, a data sending module 13, and a data recording module 14. The data receiving module 11 is configured to receive CAN messages transmitted by the CAN communication module 2 and the timestamp information applied to the CAN message data by the timing module 70. After preliminary processing, the data is stored in a data buffer according to the time, ID, and data format. The data parsing module 12 is configured to parse and classify the CAN message data received by the data receiving module 11 after preliminary processing. The data sending module 13 transmits the parsed data to the STEMWIN display module 30. The data recording module 14, based on the FATFS module, establishes a FAT32 file system on the SD storage device 8 and the USB storage device 20, manages data files on the SD storage device 8 and the USB storage device 20, and performs read and write operations on the data files on the SD storage device 8 and the USB storage device 20, namely, writing CAN message data and time information to the SD storage device 8 and the USB storage device 20.

[0094] It should be further explained that the timing module 70 in this embodiment timestamps the CAN messages received by the main control module 1. The timestamp information includes hours, minutes, seconds, and milliseconds. When receiving data, the data receiving module 11 performs preliminary processing on the CAN message and saves the data into the data buffer of the data receiving module 11 according to the time, ID, and specific format of the CAN data.

[0095] In this embodiment, the USB_HOST module 9 drives the USB storage device 20 to copy data, specifically including the following contents:

[0096] Step 1: Determine whether the USB storage device 20 is inserted into the USB_HOST interface 10; if it is determined that the USB storage device 20 is inserted into the USB_HOST interface 10, proceed to step 2. If it is determined that the USB storage device 20 is not inserted into the USB_HOST interface 10, continue to determine whether the WIFI device is connected to the CAN data recording tool. If not, continue to receive CAN data and write it to the SD storage device 8 until it is detected that the USB storage device 20 is inserted into the USB_HOST interface 10, and then proceed to step 2.

[0097] Step 2: Identify the USB storage device 20 and initialize the USB storage device 20.

[0098] Step 3: The data recording module 14 determines whether the USB storage device 20 has a FAT32 file system. Based on the determination result, a FAT32 file system is created in the USB storage device 20. First, a FAT32 file system is detected in the USB storage device 20. If not, a FAT32 file system is created. If so, step 4 is performed.

[0099] Step 4: Sort the folders in the SD storage device 8 according to the folder creation time, traverse the folders created by the data recording module 14 in the SD storage device 8 in chronological order, and copy the contents of the folders in the SD storage device 8 one by one to the FAT32 file system created in the USB storage device 20; that is, open the folders in the SD storage device 8 from the newest to the oldest, and determine whether they have been copied. If not, read the data in the SD storage device 8 and write to the USB storage device 20; after one folder is copied, open the next folder in the SD storage device 8 and continue copying until all the folders in the SD storage device 8 are copied.

[0100] It should be further explained that in order to prevent the SD storage device 8 from having insufficient capacity and being unable to save new data, the system needs to be initialized before data transmission. After initialization, the remaining capacity of the SD storage device 8 is first detected. If the capacity is sufficient, data is transmitted in the next data cache area. If the capacity is insufficient, the data in the SD storage device 8 is self-updated, and the folders in the SD storage device 8 are sorted according to the folder creation time. The old folders in the SD storage device 8 are deleted in order from old to new until the remaining capacity is greater than the self-update threshold, and then the data is stored.

[0101] As a preferred embodiment, in order to adapt to the complex usage environment requirements of explosion-proof vehicles, the SD storage device 8 in this embodiment is a surface-mount SD storage chip, and the traditional SD card is abandoned. The surface-mount SD storage chip is welded and fixed on the device, which not only has the storage function of the SD card, but also can effectively avoid the poor contact or damage caused by the plugging and unplugging of the security SD card when opening the explosion-proof box, and avoid the loosening caused by the vibration of the explosion-proof vehicle during transportation underground in the coal mine, reducing the interference of the complex coal mine roads on the SD storage device 8.

[0102] As one of the specific implementation processes, the specific process is as follows: the SD storage device 8 in this embodiment is a surface mount SD storage chip, and the USB storage device is a USB flash drive. The CAN interface 3 is connected to the vehicle's CAN bus 4, the main module is connected to the power supply, the program is started, and the program is initialized. The CAN protocol configured in the CAN communication module 2 is effective, and the CAN message is received through the CAN interrupt function. The CAN message received by the main control system consists of a string of hexadecimal characters, including frame type, frame format, frame ID and data, such as Figure 3As shown. The data receiving module 11 performs preliminary processing based on the characteristics of explosion-proof vehicles, retaining only the frame ID and data. It also obtains a timestamp through the timing module 70 and saves the data to the data buffer within the data receiving module 11 according to the specific format of time, ID, and CAN data. Data is preferentially placed in the first data buffer. If the first data buffer is full, the data in the first data buffer is immediately written to the SD storage device 8. New data received during the writing process is placed in the second data buffer to prevent the data in the first data buffer from being overwritten by new data before it is written to the SD storage device 8. If the second data buffer is full, the data in the second data buffer is immediately written to the SD storage device 8. After the data in the first data buffer is completely written to the SD storage device 8, new data received during the writing process is placed in the first data buffer. The first and second data buffers alternately receive and write new data to prevent data from being overwritten before it is written to the SD storage device 8. It should be understood that this embodiment uses only two data buffers as an example. Three, four, or other data buffers can also be provided, with multiple data buffers alternately receiving and writing data. Those skilled in the art will be able to expand upon the description of this embodiment, and a detailed description is not provided here.

[0103] Initialize the SD storage device 8 and check whether the SD storage device 8 already has a FAT32 file system. If not, create a FAT32 file system based on the FATFS module and automatically create folders and TXT files; if there is already a file system, create new folders and TXT files. Then sort the folders according to the folder creation time, check the remaining capacity of the SD storage device 8, if it is less than 1000M, delete the old folders in order from old to new until the remaining capacity is greater than 1000M. If the remaining capacity of the SD storage device 8 is sufficient, wait in a loop until the data buffer is full and then write the data to the TXT file. Data is always written to the TXT file. After the TXT file is larger than 200M, a new folder and TXT file will be created to facilitate data analysis, and the data will be written to the new TXT file. The folder is named in the format of the current time, i.e. year, month, day, hour, minute, and second. The time is provided by the timing module 70. In order to facilitate data analysis, the data is classified and saved in different TXT files according to the CAN protocol, such as Figure 4 and Figure 5 shown.

[0104] While putting the CAN message data into the data buffer area, the data analysis module 12 analyzes the CAN message data to form the temperature, torque value, speed value of the motor in the explosion-proof vehicle, the speed of the explosion-proof vehicle, the vehicle battery voltage, current, power and various fault information. For example, the CAN message data frame ID is 1812F456, and the data is af028a8101521700. According to the CAN protocol, the first and second bytes af02 represent the speed. The data is encoded in Intel format, so af02 is converted to 02af, and then converted to decimal 687 for parsing to obtain the speed value 687. The remaining data is then parsed. The third byte 8b represents the torque. Similarly, the hexadecimal to decimal conversion is used to obtain the torque value 138. The fourth and fifth bytes 8101 represent the voltage. 8101 is converted to 0181, and the hexadecimal to decimal conversion is used to obtain the voltage value 385. The sixth byte 52 represents the current. The hexadecimal to decimal conversion is used to obtain the current value 82. The seventh byte 17 represents the motor temperature. The hexadecimal to decimal conversion is used to obtain the motor temperature 23. The eighth byte 00 represents the fault information, and 00 represents no fault.

[0105] The parsed data is then transmitted to the STEMWIN display module 30. The STEMWIN display module 30 is initialized and a graphic display page is drawn on the display touch screen. The torque value, speed value, voltage value, etc. are directly displayed on the display touch screen using the text display function and the numerical display function. The touch function can also be used to determine whether the speed is selected on the touch screen. The speed value is plotted into a curve with time as the X-axis and value as the Y-axis at 50ms intervals using the graphic drawing function. For details, see Figure 6 .

[0106] When the USB storage device 20 is needed to copy data from the SD storage device 8, the USB storage device 20 is inserted into the USB_HOST interface 10. The USB_HOST module determines whether the USB storage device 20 is inserted. Once the USB storage device 20 is recognized, the USB_HOST module drives the USB storage device 20 to copy data. During the copying process, the data recording module 14 first determines whether a FAT32 file system exists within the USB storage device 20. If not, a FAT32 file system is created. The data recording module 14 then traverses all folders within the SD storage device 8, sorting them by creation time. The data is opened from the newest to the oldest folder within the SD storage device 8 to determine whether a copy is needed. If a copy is not needed, the data on the SD storage device 8 is read, and then a write operation is performed on the USB storage device 20. After the copy is complete, the next folder on the SD storage device 8 is opened and the copy is continued, until all folders in the SD storage device 8 are copied.

[0107] When the data in the SD storage device 8 needs to be transmitted via WIFI, open the mobile phone APP 80 and connect to the WIFI hotspot of the CAN data recording system. After the connection is successful, the data recording module 14 traverses all folders of the SD storage device 8, and then the WIFI communication module 60 sends the CAN data stored in the SD storage device 8 to the remote control device.

[0108] The present invention sets the CAN protocol through the CAN communication module 2 to filter CAN message data, and displays the data in real time and displays the analysis results through the STEMWIN display module 30, thereby ensuring that the CAN data recording system for explosion-proof vehicles can have high customization and specificity. At the same time, the data in the SD storage device 8 is wirelessly transmitted to the mobile phone APP 80 via WIFI, ensuring the stability and integrity of the data while providing users with greater flexibility and convenience, and enabling timely retrieval, analysis and remote management of historical data.

[0109] It should be understood that the specific embodiments described above are only used to explain the present invention and are not intended to limit the present invention. Obvious changes or modifications derived from the spirit of the present invention are still within the scope of protection of the present invention.

Claims

1. A CAN data recording method for explosion-proof vehicles, characterized in that: The following steps are involved: Build a master control system based on CAN bus to receive, store, parse, send and record CAN messages in the CAN bus; Establish a real-time display system for CAN message data; use the STEMWIN display module to display the parsed CAN message data online or offline; Setting up a dual storage system; that is, establishing a one-to-one correspondence between the main control system and the SD storage device, the main control system and the USB storage device, and the SD storage device and the USB storage device, by creating a FAT32 file management system in the SD storage device and the USB storage device, the CAN message data and time information in the main control system that have been preliminarily processed and saved in a specific format are first written to the SD storage device, and then the data in the SD storage device is copied and saved to the USB storage device; Set the SD storage device to self-update; that is, when the remaining capacity of the SD storage device is insufficient, the data in the SD storage device will be deleted from the oldest to the newest; Establish a wireless data interaction relationship between the SD storage device and the mobile phone APP; that is, wirelessly transmit the data in the SD storage device to the mobile phone APP in point-to-point AP mode, and perform data analysis in real time.

2. The CAN data recording method for explosion-proof vehicles according to claim 1, characterized in that: The receiving and storing of CAN messages in the CAN bus includes the following: According to the characteristics of explosion-proof vehicle equipment data, several data buffer areas with priorities are set in the main control system; Get the CAN message in the CAN bus, and obtain the time information corresponding to the received CAN message through the timing module; The received CAN message and time information are preliminarily processed, and the data and time information formed after the preliminarily processing are stored in a specific format in the corresponding data buffer area; that is, the CAN message received by the main control system consists of a string of hexadecimal characters, including frame type, frame format, frame ID and data. Preliminary processing is performed according to the characteristics of the explosion-proof vehicle, and only the frame ID and data are retained. Together with the time information provided by the timing module, they are stored in the corresponding data buffer area in a specific format of time, ID and data according to the priority of the data buffer area; The storage capacities of the data buffer areas are the same.

3. The CAN data recording method for explosion-proof vehicles according to claim 1, characterized in that: The parsed CAN message data includes the temperature, torque value, speed value of the motor in the explosion-proof vehicle, the speed of the explosion-proof vehicle, the vehicle battery voltage, current, power and various fault information.

4. A CAN data recording method for explosion-proof vehicles according to claim 2, characterized in that: When the main control system receives the CAN message data and time information, it classifies the received CAN message data into standard frames and extended frames according to the characteristics of the CAN data of the explosion-proof vehicle equipment, and places them in several data buffer areas in a time-sharing manner; When one of the data buffer areas is full, the data in the data buffer area is written into the SD storage device.

5. The CAN data recording method for explosion-proof vehicles according to claim 1, characterized in that: When the SD storage device or / and USB storage device is connected to the main control system, folders and TXT format files are created in the corresponding SD storage device or / and USB storage device based on the FATFS module, and the names of the folders and TXT format files created in the SD storage device and USB storage device are consistent.

6. A CAN data recording method for explosion-proof vehicles according to claim 5, characterized in that: The self-update setting of the SD storage device includes the following contents: Set a self-update threshold for the remaining capacity of the SD storage device; When the SD storage device is connected to the main control system, the remaining capacity of the SD storage device is detected; if the remaining capacity in the SD storage device is greater than the set self-update threshold, the received data is stored; if the remaining capacity in the SD storage device is less than or equal to the set self-update threshold, the folders are sorted according to the folder creation time, and the folders in the SD storage device are deleted in order from the oldest to the newest until the remaining capacity is greater than the self-update threshold, and then the data is stored; Set the maximum capacity value of any TXT format file in the SD storage device; if the data written into any TXT format file in the SD storage device is equal to the maximum capacity value, create a new folder and TXT format file in the SD storage device.

7. The CAN data recording method for explosion-proof vehicles according to claim 1, characterized in that: The main control system analyzes the received CAN message data and includes the following steps: Identify the frame ID of CAN message data; Parse CAN message data according to the corresponding frame ID in the CAN protocol, and use the data format conversion function to convert hexadecimal to decimal; The display data in decimal data format is extracted, recorded, and transmitted to the STEMWIN display module.

8. A CAN data recording system for explosion-proof vehicles, characterized by: A CAN data recording method for an explosion-proof vehicle according to any one of claims 1 to 7 is used, comprising: Main control module, used to receive, store, parse, send and record CAN message data; The CAN communication module is connected to the CAN bus signal through the CAN interface, filters the CAN message data based on the explosion-proof vehicle CAN communication protocol, and receives the CAN message data in the explosion-proof vehicle through the CAN interrupt function; A timing module, which adds time stamp information to the CAN message data received by the main control module; The SD storage module is connected to the SD storage device signal, initializes the SD storage device, and stores the data in the main control module in the SD storage device; The USB_HOST module is connected to the USB storage device signal through the USB_HOST interface to initialize the USB storage device. The USB_HOST module drives the USB storage device to copy and save the data in the SD storage device; The STEMWIN display module is connected to the display screen through a display screen interface and is connected to the main control module through a TTL serial port signal, and is used to obtain the data after the CAN message is parsed in the main control module and display it on the display screen; The WIFI communication module is connected to the main control module via SPI serial port signals to realize wireless data interaction between the SD storage device and the mobile phone APP.

9. The CAN data recording system for explosion-proof vehicles according to claim 8, characterized in that: The main control module includes: The data receiving module is used to receive the CAN message transmitted by the CAN communication module and the timestamp information of the CAN message data by the timing module, and save it in the data buffer area according to the format of time, ID and data after preliminary processing; A data analysis module is used to analyze and classify the CAN message data that has been preliminarily processed by the data receiving module; The data sending module transmits the parsed data to the STEMWIN display module; As well as the data recording module, it is created based on the FATFS module, establishes a FAT32 file system in the SD storage device and the USB storage device, manages the data files in the SD storage device and the USB storage device, and writes the CAN message data and time information in the data buffer area of the data receiving module to the SD storage device and the USB storage device.

10. The CAN data recording system for explosion-proof vehicles according to claim 8, characterized in that: The timestamp information includes hours, minutes, seconds, and milliseconds; When receiving data, the data receiving module performs preliminary processing on the received CAN message, and then saves the data into the data buffer area according to the time, ID, and specific format of CAN data.

11. The CAN data recording system for explosion-proof vehicles according to claim 8, characterized in that: The USB_HOST module drives the USB storage device to copy data, specifically including the following: Determine whether the USB storage device is inserted into the USB_HOST interface; Identify USB storage devices and initialize USB storage devices; Determine whether the USB storage device has a FAT32 file system through the data recording module, and create a FAT32 file system in the USB storage device according to the determination result; Traverse the folders created by the data recording module in the SD storage device in chronological order, and copy the contents of the folders in the SD storage device one by one to the FAT32 file system created in the USB storage device; That is, the folders in the SD storage device are sorted according to the folder creation time, and the folders in the SD storage device are opened from the newest to the oldest to determine whether they have been copied. If not, the data in the SD storage device is read and the USB storage device is written. After a folder is copied, the next folder in the SD storage device is opened to continue copying until all the folders in the SD storage device are copied.