Method for performing CAN communication with side door radar based on ESP32-S3
CAN communication with the side door radar is carried out through the ESP32-S3 development board and wireless transmission is realized using the WIFI module, which solves the problem that existing CAN bus analyzers need data lines when interacting with CAN data on mobile terminals, realizes wireless real-time transmission of CAN data and real-time interaction between web pages, reduces usage costs and supports real-time data sharing of multiple mobile terminals.
Patent Information
- Application Number
- CN202411646708.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-04
AI Technical Summary
The existing CAN bus analyzer requires data lines when interacting with CAN data on mobile terminals, and the cost of use is high, making it difficult to obtain data in real time for multiple mobile terminals.
The ESP32-S3 development board is used to communicate with the side door radar for CAN communication, and the ESP32-S3 WIFI module is used to realize wireless transmission of CAN data, and a server is built on the web page to perform data interaction and alarm information display.
It realizes wireless real-time transmission of CAN data and real-time interaction between web pages, reduces usage costs, and supports multiple mobile terminals to connect simultaneously, real-time data sharing.
Smart Images

Figure CN119556236A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of side door radars, and in particular to a method for performing CAN communication with a side door radar based on ESP32-S3. Background Art
[0002] With the popularity of millimeter-wave radar in the automotive field, CAN communication is increasingly used in automotive control. CAN communication has the characteristics of high reliability, high real-time and strong anti-interference ability, and can meet the data transmission requirements between nodes in complex systems. The use of a CAN analyzer can read the data on the CAN bus in real time.
[0003] CAN bus analyzers can detect, capture and analyze data on the CAN bus in order to better obtain the data communication status on the CAN bus. However, the use of CAN bus analyzers requires data lines to interact with CAN data on mobile terminals, and the use of these CAN bus analyzers requires specific software to interact with CAN data. For users, the cost of using CAN bus analyzers is high, and it is difficult to achieve real-time data acquisition by multiple mobile terminals.
[0004] Therefore, there is an urgent need to develop a technology that can wirelessly transmit data on the CAN bus and enable CAN data to interact in real time on web pages. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a method for CAN communication with a side door radar based on ESP32-S3.
[0006] A method for CAN communication between ESP32-S3 and side door radar, the specific steps are as follows:
[0007] S1. Establish WIFI connection of ESP32-S3;
[0008] S2, realize CAN communication between ESP32-S3 and side door radar;
[0009] S3, parsing the acquired CAN data and packaging it into WIFI data;
[0010] S4. Build a web server;
[0011] S5. Create a web page to display alarm data and alarm status bar;
[0012] S6. Send CAN message to radar on the web page.
[0013] In the step S1, a WIFI connection of ESP32-S3 is established, the WIFI mode is set to AP, i.e. Soft-AP mode, the base station is connected to ESP32-S3, and the user name, password and web address are set.
[0014] In step S1, multiple mobile terminals can simultaneously connect to the hotspot of ESP32-S3.
[0015] In step S2, ESP32-S3 is connected to the side door radar through the CAN transceiver module, the same baud rate is set, and the pins to be used by ESP32-S3 are set to achieve bidirectional transmission of CAN data.
[0016] In the step 3, the obtained message is parsed to extract the alarm data, including the alarm level, namely warning_level, and the distance of the original target, namely range, the horizontal angle, namely azimuth, and the pitch angle, namely elevation, which are packaged into WIFI data.
[0017] In the step S5, based on the step S4, the data packaged in the step S3 is displayed in real time on the web page, and a dynamic alarm status bar is made according to the acquired alarm level information. The alarm conditions are divided into 6 types through the information acquired by the side door radar.
[0018] The six situations include: 0 means no alarm, and the alarm level increases gradually from 5 to 1. The dynamic alarm status bar will change with the change of the alarm level. Specifically, the higher the alarm level, the longer the alarm status bar and the darker the color.
[0019] In the step S6, based on the step S5, a sending data frame is prepared, the data in the frame is obtained and sent to ESP32, and then transmitted to the radar, so as to realize CAN communication between the web page and the side door radar.
[0020] The beneficial effects of the present invention are:
[0021] The present invention utilizes the TWAI module of ESP32-S3 to perform CAN communication with the side door radar, establishes a web server, and transmits CAN data in real time through the wireless WIFI module of ESP32-S3, performs CAN data interaction and displays alarm information on the web server, and can perform real-time interaction on the web page. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0023] Figure 1 Build a block diagram for the physical object of the present invention;
[0024] Figure 2Build a flow chart for the software of the present invention;
[0025] Figure 3 The present invention is a flowchart of the use of the present invention. DETAILED DESCRIPTION
[0026] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further described below.
[0027] like Figures 1 to 3 As shown in the figure, a method for CAN communication between ESP32-S3 and side door radar is shown in the figure. The specific steps are as follows:
[0028] S1. Establish WIFI connection of ESP32-S3;
[0029] S2, realize CAN communication between ESP32-S3 and side door radar;
[0030] S3, parsing the acquired CAN data and packaging it into WIFI data;
[0031] S4. Build a web server;
[0032] S5. Create a web page to display alarm data and alarm status bar;
[0033] S6. Send CAN message to radar on the web page.
[0034] In the step S1, a WIFI connection of ESP32-S3 is established, and the WIFI mode is set to AP, i.e., Soft-AP mode, so that the base station is connected to ESP32-S3, and the user name, password and web address are set, and AP mode is selected. Compared with STA mode, AP mode does not require an external router and is easier to use. At the same time, it can better realize that multiple people and multiple devices can observe the real-time data of the side door radar on the web page anywhere.
[0035] The present invention utilizes the TWAI module of ESP32-S3 to perform CAN communication with the side door radar, establishes a web server, and transmits CAN data in real time through the wireless WIFI module of ESP32-S3, performs CAN data interaction and displays alarm information on the web server, and can perform real-time interaction on the web page.
[0036] In step S1, multiple mobile terminals can simultaneously connect to the hotspot of ESP32-S3.
[0037] In the step S2, ESP32-S3 is connected to the side door radar through the CAN transceiver module, the same baud rate is set, and the pins to be used by ESP32-S3 are set to realize bidirectional transmission of CAN data. Since the real-time data of the side door radar needs to be uploaded to the web page by wireless transmission, the ESP32-S3 development board is selected, which contains a WIFI wireless transmission module and a TWAI interface. The CAN communication between ESP32-S3 and the side door radar is completed through an external CAN transceiver, which is convenient for ESP32-S3 to read the message sent by the side door radar and the side door radar to receive the message sent by ESP32-S3.
[0038] The steps S1 and S2 abandon the traditional CAN tool which needs to use a data line to perform CAN data interaction on the mobile terminal. The interaction between CAN communication and WIFI transmission data is realized through the ESP32-S3 development board, so that the sensor network can be constructed more flexibly. There is no need to use a data line between the mobile terminal, and the data interaction between the side door radar and the mobile terminal at a long distance can be completed.
[0039] The CAN communication and web page warning based on the side door radar and ESP32-S3 will be described from three aspects, namely the selection and construction of the hardware, the implementation process of the software and the use process of the system, and the hardware construction block diagram of the CAN communication and web page warning based on the side door radar and ESP32-S3. Figure 1 As shown in the figure, the hardware components for realizing CAN communication and web page warning based on side door radar and ESP32-S3 are: power supply, voltage conversion module, side door radar, external CAN transceiver module, here using TJA1042 high-speed CAN transceiver, ESP32-S3 and LED light.
[0040] Specifically, in realizing the web page warning of the side door radar, the user can directly open the corresponding web page through the same WIFI to observe the alarm status of the current side door radar. The reason for choosing ESP32-S3 is that it supports WIFI communication and can provide a two-wire automotive interface, namely TWAI. Only an external CAN transceiver is needed to realize CAN communication.
[0041] Since the side door radar requires 12V power supply, while ESP32-S3 requires 3.3V power supply, and the external CAN transceiver requires 5V power supply, a voltage conversion module is needed. An LED light is added to indicate the current hardware connection status, where the red light represents the power supply status, and the green light represents the CAN communication status. The power supply of the LED light is provided by ESP32-S3.
[0042] The present invention realizes the software block diagram of CAN communication and web page warning based on side door radar and ESP32-S3, which is mainly divided into four modules, namely, building WIFI, realizing CAN communication function, building and designing network end server, and realizing data interaction. Since it is necessary to realize that multiple people and multiple devices can observe the real-time data displayed on the web page anywhere, the WIFI mode is set to Soft-AP mode, as shown in the following figure. Figure 2 shown.
[0043] In step S3, the obtained message is parsed to extract alarm data, including the alarm level, i.e., warning_level, and the distance of the original target, i.e., range, the horizontal angle, i.e., azimuth, and the pitch angle, i.e., elevation, which are packaged into WIFI data to facilitate the subsequent real-time display of the status between the side door radar and the obstacle on the web page.
[0044] Figure 2 The specific process of software design is mainly divided into five modules, namely, building WIFI communication function, realizing CAN communication function, building and designing network server, realizing data interaction, and controlling LED lights. The four modules are further decomposed into ten modules in total.
[0045] Since it is necessary to realize that multiple people and multiple devices can observe the real-time data displayed on the web page anywhere, the WIFI mode is set to Soft-AP mode, which can directly connect to the ESP32-S3WIFI account. Compared with the STA mode of WIFI, the Soft-AP mode does not require an external router, which is more portable and easier to operate. The WIFI password is set to allow only specific groups of people, namely developers, testers and customer users, to connect and see the target data collected by the radar through the web page.
[0046] The baud rate of CAN needs to be consistent with the baud rate of the side door radar.
[0047] The construction and design of the network server are mainly divided into the alarm module, the original data module, and the message sending module.
[0048] The alarm module displays the current alarm level, which is divided into 5 levels according to the alarm distance, and the alarm status bar is adapted to the alarm level. The color of the status bar changes with the alarm level, from yellow to red. That is, the closer the door is to the obstacle, the lower the alarm level and the darker the color of the status bar. The raw data module is used to display the distance and horizontal angle between the obstacle and the side door detected by the side door radar.
[0049] The message sending module can send messages to the radar.
[0050] The LED light control module is used for users to intuitively observe the status of the CAN communication between the side door radar and ESP32-S3 in real time.
[0051] In the step S5, based on the step S4, the data packaged in the step S3 is displayed in real time on the web page, and a dynamic alarm status bar is made according to the acquired alarm level information. The alarm conditions are divided into 6 types through the information acquired by the side door radar.
[0052] The six situations include: 0 means no alarm, and the alarm level increases gradually from 5 to 1, and the dynamic alarm status bar will change with the change of the alarm level. Specifically, the higher the alarm level, the longer the alarm status bar and the darker the color. The implementation of this step truly completes the data interaction between the web page and the side door radar.
[0053] In the step S6, based on the step S5, a sending data frame is prepared, the data in the frame is obtained and sent to ESP32, and then transmitted to the radar, so as to realize CAN communication between the web page and the side door radar.
[0054] like Figure 3 As shown, the hardware connection is completed. After completion, observe the on and off status of the LED lights. Only when the red light is always on and the green light flashes quickly, you can disconnect the side door radar, observe the slow flashing of the green light, and then connect the side door radar to prove that the hardware connection is correct. Next, turn on the WIFI of the mobile terminal, connect to the hotspot opened in ESP32, and then open the client website set in ESP32 to observe the real-time data of the side door radar detecting obstacles. If necessary, you can send the required message ID and message data in the send data box of the web page.
[0055] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A method for CAN communication between ESP32-S3 and side door radar, characterized in that: The specific steps are as follows: S1. Establish WIFI connection of ESP32-S3; S2, realize CAN communication between ESP32-S3 and side door radar; S3, parsing the acquired CAN data and packaging it into WIFI data; S4. Build a web server; S5. Create a web page to display alarm data and alarm status bar; S6. Send CAN message to radar on the web page.
2. A method for CAN communication with a side door radar based on ESP32-S3 according to claim 1, characterized in that: In the step S1, a WIFI connection of ESP32-S3 is established, the WIFI mode is set to AP, i.e., Soft-AP mode, the base station is connected to ESP32-S3, and the user name, password and web address are set.
3. A method for CAN communication with a side door radar based on ESP32-S3 according to claim 2, characterized in that: In step S1, multiple mobile terminals can simultaneously connect to the hotspot of ESP32-S3.
4. A method for CAN communication with a side door radar based on ESP32-S3 according to claim 1, characterized in that: In step S2, ESP32-S3 is connected to the side door radar through the CAN transceiver module, the same baud rate is set, and the pins to be used by ESP32-S3 are set to achieve bidirectional transmission of CAN data.
5. A method for CAN communication with a side door radar based on ESP32-S3 according to claim 1, characterized in that: In the step S3, the obtained message needs to be parsed to extract alarm data, including the alarm level, namely warning_level, and the distance of the original target, namely range, the horizontal angle, namely azimuth, and the pitch angle, namely elevation, which are packaged into WIFI data.
6. A method for CAN communication with a side door radar based on ESP32-S3 according to claim 1, characterized in that: In the step S5, based on the step S4, the data packaged in the step S3 is displayed in real time on the web page, and a dynamic alarm status bar is made according to the acquired alarm level information. The alarm conditions are divided into 6 types through the information acquired by the side door radar.
7. A method for CAN communication with a side door radar based on ESP32-S3 according to claim 6, characterized in that: The six situations include: 0 means no alarm, and the alarm level increases gradually from 5 to 1. The dynamic alarm status bar will change with the change of the alarm level. Specifically, the higher the alarm level, the longer the alarm status bar and the darker the color.
8. The method for performing CAN communication with a side door radar based on ESP32-S3 according to claim 1, characterized in that: In the step S6, based on the step S5, a sending data frame is prepared, the data in the frame is obtained and sent to ESP32, and then transmitted to the radar, so as to realize CAN communication between the web page and the side door radar.