care
Jotrin Electronics
Cart
arrow
Description Quantity Total (USD) Operation
loading
Shopping cart products
Shopping cart products : 0
Home > Programmable logic > The design of software and hardware to realize the intelligent sensor

The design of software and hardware to realize the intelligent sensor system is based on single chip microcomputer and AD7705BN

Published time: 2020-05-13 16:45:41

In recent years, with the rapid development of sensor technology and information processing technology, engineering applications have put forward higher requirements on the measurement accuracy, data transmission distance and information processing capabilities of sensors. In order to overcome the shortcomings of common force-sensitive and light-sensitive sensors, such as poor anti-interference ability, short transmission distance, difficulty in zero adjustment, and the inability of the measurement node to communicate directly with the host computer, this paper has designed a smart sensor system composed of Freescale MC9S08SH4 microcontroller and AD7705BN as the core , Add software zero adjustment, floating point data processing, automatic compensation, two-way communication with the host computer, standardized digital output and other functions on the ordinary sensor, which can easily realize the real-time collection and processing of data by the host computer, and has measurement accuracy High, compact structure, strong anti-interference ability and so on.

1. System composition

The intelligent sensor system is composed of signal conditioning circuit, A / D conversion circuit, main control circuit, zero adjustment circuit, RS-485 communication circuit and power supply circuit. The signal conditioning module is responsible for conditioning and amplifying the mV level differential signal output by the sensor; the A / D conversion module converts the analog signal output by the signal conditioning module into a digital signal for MCU processing; the zero adjustment module can convert the current input at any time The value is set to the reference zero point; the RS-485 communication module implements communication between the main control circuit and the host computer; the power supply module provides power for the main control circuit, sensor, signal conditioning module, and RS-485 communication module. The system structure is shown in Figure 1.

Figure 1 System structure block diagram

2. Functional module design

2.1 Signal conditioning and A / D conversion module

The output signal of the sensor is generally a differential signal of mV level. The traditional signal conditioning circuit is to add one or more high-precision amplifier circuits before A / D conversion. This not only increases the cost, but also the circuit is more complicated. The AD7705BN has a complete analog front end, built-in gain programmable amplifier (PGA) and programmable digital filter, which can directly condition, filter, amplify and A / D convert the mV level signal output by the sensor, and then output it serially without the need Using an external instrumentation amplifier greatly simplifies the circuit design.

The AD7705BN's A / D conversion function is also very strong, and its Σ-Δ conversion technology can achieve up to 16 bit error-free transmission. In this design, the two fully differential analog input channels of the AD7705BN can meet the input of two sensor output signals at the same time, and the signal gain, polarity, input channel, data output update rate, and digital filter can be easily programmed by software Make settings. The AD7705BN circuit module is shown in Figure 2. Among them, the sensor output signal is directly connected to the differential analog input channel AIN1 of the AD7705BN.

Figure 2 Signal conditioning circuit and A / D conversion module

2.2 Main control module

The main control MCU of the intelligent sensor system is MC9S08SH4, which belongs to the S08 series 8-bit single-chip microcomputer of Freescale company. It has the characteristics of small size, fast speed, abundant on-chip resources, and strong data processing capabilities. Its maximum clock frequency is 20 MHz, on-chip resources include 4 KB Flash, 512 B RAM, 8-way keyboard interrupt, SCI interface, SPI interface, IIC bus and other modules. It is packaged in TSSOP16 and has a small size, which is very suitable for this system. In order to minimize the board area, the programming interface of MC9S08SH4 in this design does not use the standard 6-core BDM interface, but uses a custom 4-core interface. The minimum system is shown in Figure 3.

Figure 3 MC9S08SH4 minimum system

2.3 Zero adjustment module

The zero adjustment module has two functions, one is to reset the sensor to zero before each measurement, and the other is to set the reference zero point immediately during the measurement process.

The traditional mechanical zero adjustment method is to add a potentiometer in the circuit, and use the method of changing the voltage division value to perform zero adjustment. This method has a very slow adjustment speed and poor accuracy. In this design, the software zero adjustment method is used. First, the keyboard interrupt is used to collect the A / D conversion result of the sensor zero input as the reference zero point, and it is stored in a global variable; the value of each A / D conversion will be the same as the global value. The reference zero point in the variable is compared to obtain the corrected result. The software zero adjustment method has high accuracy and very fast adjustment speed, and is especially suitable for setting the reference zero point in the measurement process.

2.4 RS-485 communication module

The communication between the system and the host computer adopts RS-485 communication protocol. In practical applications, a host computer needs to tow multiple sensors, and has high requirements on the transmission distance. The RS-485 serial bus interface uses balanced transmission and differential reception for data communication, which improves the ability to resist common mode interference and transmission distance compared to RS-232; and the RS-485 bus can be used for multiple RS-485 interfaces Equipment interconnection to achieve high-speed and long-distance data transmission. The RS-485 communication chip used in this system is MAX1487, and the input port DI and output port RO are connected to the serial data transmitter TXD and serial data receiver RXD of MC9S08SH4, respectively. The read and write enable terminals are connected together and are controlled by the PTA1 pin of MC9S08SH4. When PTA1 outputs high level, the sensor system sends data to the host computer; when PTA1 outputs low level, the sensor system receives data from the host computer, as shown in Figure 4.

Figure 4 RS-485 communication module schematic

2.5 Power module

The power module uses 24 V DC input. In addition to the 24 V and 12 V power supply interfaces reserved for the sensor, it also provides a 5 V operating voltage for the AD7705BN, MAX1487, and MC9S08SH4. In order to make the system structure compact and small, the voltage regulator chip used in the power module is a piece of 78L12, 78L05 and LM1117 (SOT-223 package) of small current. After on-site testing, it was found that because the system power is very small, the heat generated by the power module is not large, which can ensure long-term stable operation.

3. Software design

The software design part mainly includes MC9S08SH4 initialization, median filtering and average filtering of A / D conversion results, setting the reference zero point for data correction, floating-point processing of data, proofreading data frame format, through SCI module and RS-485 communication module The data frame is sent to the host computer. 

The host computer software is written in LabVIEW and SQL, and the running status of the smart sensor system is monitored through the serial port and RS485 communication protocol. If necessary, the host computer software can reset the communication address of the digital sensor, the number of A / D conversion bits, the data frame format and Serial port baud rate and other parameters, and store the collected operating data in the database for future analysis and sorting.

The intelligent sensor system based on Freescale MC9S08SH4 and AD7705BN implemented in this design makes full use of MC9S08SH4's small size, high speed, rich on-chip resources, and strong data processing capabilities. It combines the signal processing circuit and high-precision? Resident A / D conversion of AD7705BN The sensor adds software zero adjustment, floating point data processing, multi-point measurement, RS-485 two-way communication, standardized digital output and other functions to the ordinary sensor, which overcomes the data transmission distance of ordinary force-sensitive and light-sensitive sensors, the difficulty of zero adjustment, The measurement node cannot directly communicate with the host computer, and has poor anti-interference ability. After on-site testing, the system has the advantages of small size, high measurement accuracy, stable and reliable operation and so on.

Tag: AD7705BN
 

Cart

Account Center

jotrin03

Live Chat

sales@jotrin.com