0 Introduction
In the field of modern industrial control, many signals are usually measured and converted into binary signals that can be recognized by computers, and various measured signals are monitored and recorded by computers. This process involves signal acquisition and processing. CAN bus is a serial multi-master bus. Its excellent characteristics, high reliability and unique design are particularly suitable for the
interconnection of industrial process monitoring equipment. Therefore, it has been increasingly valued by the industry and has been recognized as one of the most promising field buses. This paper introduces the design of a temperature monitoring system based on STM32 and CAN bus. Through the communication between the host computer and the slave computer, the temperature data is monitored, and the design requirements are met after preliminary experiments. 1 Overview of the overall
system solution
The overall block diagram of the system is shown in Figure 1. This system adopts the structure of master station + slave station. The CAN master station mainly realizes the storage of temperature data and the bridge between the CAN bus protocol and the serial port protocol. The CAN slave station mainly realizes the temperature acquisition. The temperature collected by the CAN slave station is transmitted to the CAN master station through the CAN bus, and the master station transmits the temperature value of each slave station to the system host computer. The host computer displays and stores the data of each point in real time. The host computer can set the alarm value. When the node temperature exceeds the set value, the host computer will sound an alarm. In the absence of a host computer, the master station stores the data in the form of a text document in the SD card of the master station.
2 System Hardware Design
2.1 CAN Master Station Hardware Design
The master station circuit is shown in Figure 2, which mainly includes a power module, an STM32 module, a CAN transceiver module, an RS232 serial port module and an SD card module.
The STM32 module consists of an STM32F103RBT6 and peripheral clocks, resets, and debuggers. The power module is supplied by an external +5V voltage, which is linearly reduced to AMS1117-3.3V for use by STM32. The CAN transceiver module uses NXP's high-speed transceiver TJA1040, which is a substitute for PCA82C250. It fully complies with the ISO 11898 standard and has the advantages of high speed, low power consumption, and low electromagnetic radiation. The RS232 level conversion chip uses MAX3232, which has the characteristics of low power consumption, high data rate and enhanced ESD protection. It adopts a proprietary low voltage difference transmission output stage, and uses an internal dual charge pump to ensure RS-232 performance when powered by +3.0 V to +5.5 V. When working, the charge pump only needs four small capacitors of 100 nF. The SD card module uses a four-wire SPI bus to connect to the SD card.
2.2 CAN slave hardware design
The slave circuit is shown in Figure 3, which mainly includes a power module, an STM32 module, a CAN transceiver module, a PT100 module and a slave address selection module.
The power module, the STM32 module and the CAN transceiver module are the same as the CAN master station. The PT100 module uses a sensor to measure the bridge. In order to ensure the stability of the bridge output voltage signal, the input voltage of the bridge is stabilized to 2.5V through
TL431
. The differential signal obtained from the bridge is amplified by a two-stage op amp and input to the AD input port of the STM32. The slave address selection module consists of an 8-bit dip switch and is connected to PC6-PC13 of the STM32 I/O.
3 System software design
This system software consists of CAN master software, slave software and Delphi host software. The CAN master and slave programs are written in C language, and the host program is written in Obieet Pascal.
3.1 CAN master software design
The function of the CAN master is to send remote frames to query data from the slave, calculate the temperature value of the chip's internal temperature sensor through the AD conversion result, receive the data frame sent by the slave, send temperature data to the host computer or store data to the SD card. The CAN master program is shown in Figure 4.
[page]
The flowchart of the SD card writing part is shown in Figure 5. The SD card part mainly uses the application interface (Application Interface) for accessing FAT volumes provided by the transplanted FATFS file system. The following functions are mainly used:
·f_mount-register/cancel a work area
·f_open-open/create a file
·f_close-close a file
·f_lseek-move/write pointer, expand file size
·f_puts-write string
·f_printf-write a formatted string
3.2 CAN slave station software design
The main function of the CAN slave station is to detect the differential output voltage of the PT100 bridge through the AD converter, then calculate the temperature value of this node, and finally transmit it to the CAN master station through the CAN bus. Among them, only when the CAN slave station receives a remote frame sent by the master station with the same node number as its own, the slave station CAN controller will send a data frame. The flowchart of the CAN slave station program is shown in Figure 6.
3.3 Design of Delphi host computer software
This host computer software mainly realizes five functions: real-time curve displays the current temperature of each slave node; prints the real-time curve; saves the real-time curve as a picture; saves the data of the real-time curve as a TXT document and alarms when the real-time temperature exceeds the alarm value.
The host computer serial communication control of this system adopts SPCOMM, which has rich properties and events closely related to serial communication, supports multi-threading, and provides various operations on the serial port. The graphic control adopts TChart, which is a standard graphic display control in Delphi. It can be statically designed (At Design Time) or dynamically generated. The version used in this system design is TeeChart 7; the real-time curve partial flow chart is shown in Figure 7. After the host computer program is completed, the interface is shown in Figure 8.
4 Conclusion
This paper introduces the design of a temperature monitoring system based on STM32 and CAN bus. Preliminary experiments have proved that the above hardware and software designs have basically met the design requirements. This system is suitable for multi-node and long-distance occasions, and has the characteristics of good real-time performance and high reliability, and has certain application value.
Previous article:Micr0 SD card reading and writing based on STM32F103XX microprocessor
Next article:Battery bidirectional current detection with STM32F103 controller
Recommended ReadingLatest update time:2024-11-16 18:09
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [TI recommended course] #Boost and buck-boost DCDC converters help wireless charging design#
- The microcontroller has its own EEPROM. Is it necessary to add an external EEPROM? Small-volume and high-capacity EEPROMs are more expensive!
- I am facing a problem during the debian burning process of the Sipeed LicheeRV 86 development board?
- FIFO problem of vivado2018.1
- [RT-Thread reading notes] (1) Thread initialization and linked list
- Regarding the peripheral circuit design of the LCD segment code screen, please provide relevant development information. Thank you.
- How big a power line is needed for a 250KW submersible pump?
- STM32f030 development code
- [National Technology N32WB452 Review]_Unboxing and RT-Thread Example Running
- 【GD32L233C-START Review】4. Porting RT-Thread to GD32L233