Equipment developed for industrial occasions usually has a 4-20mA output interface. In the past, single-chip systems without DAC modules required an external main chip DAC to realize analog quantity control, or used PWM to simulate DA, but it also brought temperature drift and long-term stability problems. In STM32-centered devices, the built-in DAC can be used to easily realize the 4-20mA output interface, which has the characteristics of high accuracy, good stability, small drift and easy programming.
In the STM32 MCU system, there is no external VREF pin below pin 100, but this makes the reference end of the DAC and VCC shared, resulting in a large bit error. To solve this problem, you can use the cheap TL431 to solve the power supply problem. The typical temperature drift of TL431 is 30ppm, so it is sufficient in general applications. Select two low-temperature drift resistors and adjust the output so that the output voltage of TL431 is between 3V-3.6V. Its parallel regulated current can reach 30mA, which just meets the power consumption requirements of the general STM32 core.
The power supply problem is solved by using TL431, and the remaining part is the 4-20mA conversion circuit, as shown below:
The figure above is a very accurate conversion circuit. OPA333 is a very excellent single-power rail-to-rail operational amplifier with an operating voltage of 2.7-5.5V and an offset voltage of only 10uV. The measured minimum output is 30uV and the maximum output can reach VCC-30uV. The circuit is composed of a voltage-controlled constant current source. The key lies in the excellent performance of the OPA333 chip, which enables the above circuit to achieve extremely high accuracy and stability. DACOUT comes from the DAC1 or DAC2 output of STM32. After digital noise filtering by C25, it enters the operation, performs 1:1 buffering, and then amplifies the current through Q2 to form a detection voltage on R7, and C17 performs de-jittering. The 4-20mA signal is output between AN_OUT+/AN_OUT-.
In the figure above, the current in the load forms a voltage drop on R7. After feedback from the op amp, Vdacout=Vr7=I*R7 is obtained, so: I=Vdacout/R7. When Vdacout changes between 400mV and 2000mV, a 4-20mA output can be obtained. Changing the size of R7 can change the required range of DACOUT. In the circuit, there will be a bias voltage of about 0.7V between the base and emitter of R2, so Vb[MAX]=2V+0.7V=2.7V, which is just within the output range of OPA333. In the circuit, R14 is used as the current limiting current at the output end, so that the maximum output current at the output end is Imax=Vcc/(R7+R14). If Vcc is 6V, then Imax=6V/200 O=30mA. If there is no R14, the maximum current may be 60mA. At this time, the power dissipation on R7 is 0.06*0.06*100=0.36W. If 0805 chip resistors are used, R7 will burn out, or the resistance value of R7 will change too much due to the temperature rise, causing a large deviation in the output. After adding R14, the maximum power dissipation on R7 is: 0.03*0.03*100=0.09W, which is within the normal range.
R14 and C17 in the circuit cannot be omitted. Possible slight interference or fluctuation of external load will cause the deep negative feedback circuit composed of OPA333 to oscillate and make the output current fluctuate. Adding C17 can suppress this fluctuation and make the output more stable. However, the value of C17 should not be too large.
When programming with STM32, please note that the internal DAC buffer should not be turned on, because the above circuit is already a buffer circuit with high input impedance. The output linearity will be lost due to the internal buffer circuit of STM32.
Previous article:IIC hardware programming of STM32 microcontroller --- query waiting mode
Next article:STM32 uses DMA and FSMC to drive ISSI 25616 external SRAM successfully
Recommended ReadingLatest update time:2024-11-22 22:11
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- [GD32F350--Smart Farm] First post
- What is output impedance? What is impedance matching?
- High-frequency transformer sandwich winding method: primary wrapped in secondary? Or secondary wrapped in primary?
- Detailed description of I2C bus protocol and timing, getting started is no longer difficult
- Send a WDS configuration software for SI4463
- AD637
- LM1875 Op Amp
- OpenBLT is an open source bootloader with comprehensive functional information, supporting USB, CAN, 232 and TCP/IP
- About the Minimum System
- Magic online translation