STM32|4-20mA output circuit

Publisher:郑大大Latest update time:2017-02-06 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  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.


Keywords:STM32 Reference address:STM32|4-20mA output circuit

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

STM32 study notes-SysTick
1 Introduction The SysTick timer is bundled in the NVIC and is used to generate the SysTick exception (exception number: 15). In the past, the operating system and all systems that used a time base had to have a hardware timer to generate the required "tick" interrupt as the time base for the entire system. The tick
[Microcontroller]
STM32 study notes-SysTick
Solution to STM32 PB4 not being able to do normal IO
PB4 is a JTAG pin by default and is set in pull-up mode, so it cannot be directly used as a normal IO port to pull low. It can be reused as a SWD download method, so PB4 can be "saved" 1 (RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO, ENABLE); turn on the clock. Multiplex the clock         .When per
[Microcontroller]
STM32 learning experience
   I have been learning STM32 for a while, and people around me are also learning this microcontroller. It feels like it is becoming more and more popular. There is no way, it is powerful and cheap, who would not want to use it? I don't understand AVR, which is almost squeezed like Nokia now, but it still insists on th
[Microcontroller]
Design of Embedded Digital Oscilloscope Based on STM32
  Embedded digital oscilloscope is an intelligent measurement terminal device developed in recent years that integrates multiple functions such as display, measurement, calculation, analysis, and recording. With its powerful performance advantages, it has gradually replaced the traditional analog oscilloscope. At pres
[Test Measurement]
Design of Embedded Digital Oscilloscope Based on STM32
Summary of stm32 KEY control LED
The learning of stm32 is to understand how to configure the software, first understand the hardware connection, and then combine them; #include "stm32f4xx.h" #include "led.h" #define KEY0 GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4) // Read the IO status here and use the IO port of stm32 as input #define KEY1 GPIO_Re
[Microcontroller]
STM32 printf usage
#include //Add the following code to support the printf function without selecting use MicroLIB    #if 1 #pragma import(__use_no_semihosting)              //Support functions required by the standard library                  struct __FILE  {  int handle;  };  FILE __stdout;        // define _sys_exit() to avoid
[Microcontroller]
STM32 uses a structure to define the address of FSMC
LCD Address Setting     The figure only shows the data line and the address line. I didn't draw the other lines. Please think about it. If you really can't help, please look at the LCD schematic diagram provided by Atom. The LCD has a pin called the D/C pin, which is used to distinguish whether the data written t
[Microcontroller]
STM32 uses a structure to define the address of FSMC
STM32 startup code analysis
For the startup code of Keil (for STM32F042), add comments and your own understanding ;********************** (C) COPYRIGHT 2014 STMicroelectronics ******************** ;* File Name : startup_stm32f042.s ;* Author : MCD Application Team,modified by Sky, ;* Version : V1.5.0;* Date : 05-December-2014,modified on,01-Nov
[Microcontroller]
Latest Microcontroller Articles
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号