Temperature monitoring system based on STM32 and CAN bus

Publisher:dst2015Latest update time:2012-08-07 Source: 现代电子技术 Keywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.
a.JPG


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.
b.JPG

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]





c.JPG

d.JPG

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.
e.JPG

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.

f.JPG

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.
Keywords:STM32 Reference address:Temperature monitoring system based on STM32 and CAN bus

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

Conditional compilation usage
        Look at the stm32 serial port initialization program of Zhengdian Atom, the usart.h file is as follows:   view plain copy   #ifndef __USART_H   #define __USART_H   #include stm32f10x_lib.h    #include "stdio.h"                 extern u8 USART_RX_BUF ; //Receive buffer, maximum 63 bytes
[Microcontroller]
STM32 simulates IIC reading and writing AT24CXX
I have only used 51 to make AT24C02 before. Later, I came into contact with models with larger capacity and found many inconsistencies with the previous ones. I have summarized them as follows. In the previous blog, the basic driver code for STM32 to simulate IIC with IO port has been written. Now, combined with the d
[Microcontroller]
STM32 simulates IIC reading and writing AT24CXX
stm32 teaches you how to compile LIB files
This is a trick to generate LIB. Maybe you will find some programs on the Internet that use this method to include STM32 Library files: Instead of a bunch of C like DX32 routines: Well, this tip is to teach you how to generate the .LIB file. First open the program, and you will see only the library file in
[Microcontroller]
stm32 teaches you how to compile LIB files
STM32 CAN application attempt
Recently, I want to systematically learn the application of CAN bus, but I can't find a suitable board to do the experiment. I just saw that the STM32 microcontroller has a built-in CAN controller, so I want to use STM32 as a carrier to learn about CAN bus.   In addition to the CAN controller, a CAN transceiver can
[Microcontroller]
STM32 encoder interface mode
1. Encoder   Figure 1 is a schematic diagram of the encoder  . In the middle is a code disk with a grating. When light passes through the grating, the receiving tube receives a high level. If light does not pass through, it receives a low level. When the motor rotates one circle, the number of gratings on the code di
[Microcontroller]
stm32.cube (ten) - the structure of a single HAL module
1. Interface Function For Linux drivers, the basic operation functions are Open, Close, Read, Write, and Ioctrl, which are a set of standardized interfaces for operating peripherals at the OS driver layer. For the lower-level hardware abstraction layer, the upper-level Open and Close mean initialization and deinitiali
[Microcontroller]
The influence of signal source characteristics on conversion results in STM32 ADC applications
All chips in the STM32 family have built-in successive approximation register ADC modules. The internal framework is as follows:   Each ADC conversion is first sampled and held, and then compared and output in multiple steps. The number of steps is equal to the number of ADC bits, and each ADC clock generates one d
[Microcontroller]
The influence of signal source characteristics on conversion results in STM32 ADC applications
STM32 GPIO Application Notes
1                      The input and output pins of STM32 have the following 8 possible configurations: (4 inputs + 2 outputs + 2 multiplexed outputs) ①Floating  input_IN_FLOATING ②With  pull-up input_IPU    ③With  pull-down input_IPD                      ④Analog  input_AIN ⑤Open  drain output_OUT_OD         
[Microcontroller]
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号