To meet the requirement of safe and stable field intelligent control, the design of direct digital controller based on STM32 is studied. Using modular design and on-line programming technology, the hardware architecture of the controller and the design of each software function module are introduced in detail, and the software and hardware functions are tested. The results show that the controller has the advantages of intuitive and accurate display, convenient operation, stable and reliable operation, and is suitable for various monitoring and control systems. With the continuous development of intelligent, efficient and energy-saving automatic control systems, direct digital controllers using small and medium-sized integrated circuits in the early stage have been eliminated by the market. As a field controller, direct digital controller (DDC) has an independent control program, which can independently complete all the elements of process control, and has certain irreplaceability. Therefore, based on the needs of the development of science and technology and the practical application of industry, the design of a direct digital controller based on embedded development has full theoretical and practical application value.
This controller chooses ST (Italy Semiconductor) company’s 32-bit ARM Cortex-M4 architecture STM32F407 series single chip as the main processing chip. In the design of hardware circuit, each part is powered by independent power supply; the isolation circuit uses a combination of optocoupler isolation and the latest magnetic isolation technology; ADC and DAC use 16-bit resolution, combined with independent reference voltage source and input and output conditioning circuit to ensure the reliability of analog data; SHT 21 temperature and humidity transmission is used in the design. Sensor monitors the environmental factors of the controller in real time, and realizes real-time data display and human-computer interaction with the help of mature TFT touch screen technology. The direct digital controller consists of five parts: main controller, power supply, input port, output port and display screen. The direct digital controller collects the electric signals uploaded by sensors or industrial transmitters through analog and digital input ports, and then transmits them to the main controller unit after filtering and conversion. The main controller unit analyses and processes the transmitted signals, and outputs the digital signals according to the program design.
Word output port conversion level, or after the analog-to-digital converter into analog output, to control the actuator. The system block diagram is shown in Figure 1. In the design of power supply circuit, all parts are powered by independent power supply. In the input stage, 220V/50Hz commercial power is converted into 24V DC power by finished switching power supply, then DC/DC constant voltage and non-voltage regulator module is combined with linear LDO to supply power. External precise voltage source is used to provide reference voltage for ADC and DAC.
AD7606 has its own op-amp conditioning circuit, so the peripheral circuit of the input channel is relatively simple. Transient Suppression (TVS) diode is used as anti-static protection device. The analog input channel can receive ( 10V) signal and has anti-static, current limiting and over-voltage protection capabilities. The analog output circuit is composed of 16-digit analog-to-analog converter DAC8563 and OPA4177 op-amp produced by TI Company and their peripheral circuits. 16Bits and dual-channel analog-to-digital converter chip are used for analog output, which uses a single 5V power supply and REF192 as a precise voltage source to provide reference voltage. The output stage is amplified and followed by OPA4177 operational amplifier.
In the digital input circuit, the digital photocoupler TLP521 is chosen as the isolator between relay, digital photocoupler and digital isolator. The switch optocoupler TLP521 acts as a level converter, converts 24V signal to 3.3V signal, and uses LED lamp as on-off indication.
Digital output circuit also uses optocoupler as isolation device of digital output channel, but triode amplifier is used to expand the current, its maximum output current is 1A, and the switching frequency can reach 20kHz.
The software part of the direct digital controller mainly includes three parts: scanning program, input program, output program and data processing program. The scanner mainly scans the keys and touch screen of the instrument, realizes the function of input data or setting from keys, completes the task of displaying the processed data; the input program mainly completes the task of data acquisition, data storage and data communication; the output program mainly completes the task of precise output of the set digital and analog quantities; Data processing program data filtering, operation and analysis tasks.
The software block diagram is shown in Figure 2. The analog output channel 1 is used as the output test, and the output precision test of analog is shown in Table 1.
The test results show that under normal operation, the output precision of DDC can reach 0.3% and achieve the expected goal. This controller adopts many advanced embedded technologies, and has the advantages of simple use, mature technology, relatively easy development and short development cycle.
The controller has a man-machine interface and is easy to find and troubleshoot faults in time. At the same time, the controller has many channels and can be used as the core controller of industrial production sites with more sensors or building automation. The system has high measurement accuracy, fast operation speed, good control effect, stable operation, thermostatic element meets the design expectations, meets the functional requirements and operating environment requirements, and has certain engineering application value.