Design of the hottest intelligent sensor with low

  • Detail

Design of low-power intelligent sensor

in the process of industrial control, some parameters often need to be measured, and the output signal of general sensors is weak, which is not suitable for long-distance transmission. In order to reduce interference, twisted pair transmitter with 4 ~ 20mA current output is usually used. Due to the limitation of the complexity of the circuit, the nonlinear compensation effect of the transmitter for signal analog processing is not ideal, and it is difficult to realize temperature compensation in the full temperature range, so it cannot meet the high accuracy requirements. With the increasing popularity of low-power and high-precision MCU, - ADC and - DAC, it provides a technical way for the design of high-precision intelligent transmitter

the single-chip sensor signal interface design introduced in this paper adopts a multifunctional microcontroller msp430f2013 recently launched by Texas Instruments, which integrates a 16 bit - ADC. 2KB program space and 128B data storage space can complete the intelligent collection of data, and use the differential transmission mode to transmit data. Data is transmitted by frame, and CRC test is used for error control in the transmission process

structural features of msp430f2013

msp430f2013 is a microcontroller of MSP430 series of TI company. It has the following structural features: 16 bit RISC CPU, 16 bit register and constant generator, which can obtain high code efficiency; Five low power consumption modes can prolong the service life of the battery in portable measurement applications; The numerical control oscillator (DCO) makes it less than 1 s to switch from low-power mode to normal mode; A 16 bit timer; 10 i/o ports; Have synchronous communication protocol (SPI or I2C); A 16 bit - ADC

The typical application of msp430f2013 is that the sensing system captures analog signals, converts analog signals into digital signals, and then uses the digital signals for screen display or transmits the digital signals to a host system for other processing

common analog-to-digital conversion circuits need to amplify analog signals, and generally need to design an interface circuit with single-chip microcomputer. This system has a high degree of integration. A single chip can complete signal amplification, analog-to-digital conversion and software filtering. At the same time, a single line protocol is realized, which can directly communicate with high-end computers without designing an interface circuit with single-chip microcomputer

msp430f2013 is a low-power device. When running under the clock condition of 1MHz, the working current of the system is 220 A, while the working current of standby mode is only 0.5 A, and the working current of maintaining the power-saving mode of ram is only 0.1 A. such low-power consumption can be powered by the battery, which is suitable for portable measurement

this system is exported to Japan, and msp430f2013 is used for intelligent data acquisition. The data collected from the front-end sensor is amplified by the program-controlled gain amplifier, and then enters the analog-to-digital converter for proper digital conversion of the length of the analog-to-digital line. After conversion, it is output in the form of asynchronous serial. Figure 1 is the schematic diagram of the whole system

Figure 1 system schematic diagram

in order to simplify the system and avoid the impact of external crystal oscillator on the system, the system uses internal DCO as the clock, and the system uses differential transmission of data, without data isolation. In this application, the configured transmission rate is 9600b/s, and the serial port can be used to set the matching baud rate for reception

no matter whether the system adopts internal reference voltage or external reference voltage, the input voltage has a corresponding range, so the input of front-end analog quantity should be limited by voltage stabilizer

the system can adjust the conversion accuracy according to the size of the external signal. Just pull up p2.6 and adjust the analog quantity of the external input to the maximum value measured. At this time, the system will automatically adjust PGA (program-controlled gain amplifier)

due to the half duplex differential transmission, the system is easy to expand. The system can use multiple sensors to form a sensor network, and control the sensors to collect data through the bus

1. System software

the software flow chart of the system is shown in Figure 2

Figure 2 system software flow chart

2. Initialization

the initialization part mainly completes the following functions

be responsible for the initialization of the system clock, so that the system working frequency is the standard 8MHz clock specified by DCO

configuring the ports of the system is particularly important because of the reuse of chip pin functions. By setting sd16ae and sd16inctl0, the working states of P1.0 and P1.1 are a0+ and a0-, respectively. Set p2.6 and p2.7 as general IO ports, where p2.6 is used as the control signal for adjusting PGA, and p2.7 is used as the channel for data transmission

initialize the AD converter of the system and use the internal reference voltage of the system. Since the input frequency can only be 1.1mhz at most, the main frequency of the system is divided into 8 frequencies. ADC has no input cache in msp430f2013, and cache is turned off in cache mode selection. The system is used to measure continuously changing physical quantities and set the system to continuous conversion mode

3. Measurement

open the interrupt during measurement. When a measurement result is generated, an interrupt is generated, and the interrupt flag position bit. The measurement result is stored in the conversion result register. When the measurement result is read out from the conversion result register, the interrupt flag bit is automatically reset. Therefore, when reading the conversion result, you only need to query the interrupt flag bit

the median value average filtering method is used for filtering the measurement results. Each measurement value is sampled 10 times, and the maximum and minimum values are removed. The upper display shows the displacement, and the other 8 values are taken as the arithmetic mean

this algorithm can effectively overcome the fluctuation interference caused by accidental factors, especially for physical quantities such as temperature and liquid level that change slowly

the internal reference voltage is used for measurement, and the voltage input range of the measurement signal is 0 ~ 500mv. When the input signal is input in full scale, and the highest bit of the analog-to-digital conversion output is not 1, the signal can be amplified, and the maximum amplification factor can reach 32. When the amplification factor of the input signal is n, the range of the input signal will be correspondingly reduced to the original 1/n. For example, when the magnification of PGA is 2 times, the voltage input range of the measurement signal is 0 ~ 250Mv

the whole measurement process is represented by pseudo code as follows

int measure (void)

{int I; if (set==1) {adjust gain;} For (i=0; I I i++) {wait for the conversion result; read and save the conversion result;} Accumulate the conversion results; Find the maximum and minimum values; Median average filtering; Return the measurement result;}

4. Data transmission

data transmission is sent by frame, and the frame structure is shown in Figure 3

Figure 3. The coherent work such as communication is realized by the internal hardware module. The data frame structure diagram

each frame includes synchronization code, AD conversion result and check code. The frame synchronization can adopt specific synchronization code or gap synchronization, and the second method is adopted here. When sending data frames, first pull up the data transmission line. The time of pulling up is the time of sending 16 data bits, and the gap of the high level of the frame header is used as the synchronization of data frames

parity check code is simple as an error detection code, but the missed detection rate is too high. The most widely used error detection code in computer network and data communication is a kind of cyclic redundancy code CRC, which has a much lower missed detection rate and is easy to realize. The higher the order of CRC generated polynomial, the smaller the probability of misjudgment. In this paper, CCITT-16 is used, and its generating polynomial is g (x) =x16+x15+x5+1. There are generally two ways to realize CRC: direct calculation and table lookup. Since the table lookup method requires at least 1KB of space to store table values, the direct calculation method is adopted here

during data transmission, single line serial output is used, and the port line is used to simulate serial transmission. When sending bytes, the data shown in Figure 4 is sent successively on the port line (when the data is 0, the port line level is lowered, and when the data is 1, the port line level is raised). The bit duration is calculated according to the baud rate. In this application, the baud rate is set to 9600b/s. When there is no data transmission, the output port line maintains a high level

Figure 4 Schematic diagram of the sequence of sending bytes

data transmission is finally isolated through the optocoupler, so that the output of the field and data is isolated. At the same time, the circuit can be simply changed according to the needs of the input of the subsequent system

after practical application, the single-chip msp430f2013 can realize the output level measurement of small signal sensor, and the conversion time is less than 1ms. Low power consumption measurement can be realized, and the power consumption of the whole machine is not more than 6MW. The system is especially suitable for realizing an intelligent sensor. When the full radiance of the input signal is greater than 40mv, the 16 bit a/d conversion resolution can be guaranteed. Due to the differential transmission of half duplex, the group of sensors can be easily realized

Copyright © 2011 JIN SHI