A multifunctional power supply design based on AVR Butterfly

Publisher:fnfeecjknqucLatest update time:2020-01-22 Source: eefocusKeywords:AVR  Butterfly Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction
With the development of embedded system design technology, system engineers have higher and higher requirements for power supply in design and simulation. When embedded system design used 8031 ​​microcontrollers and 74 series integrated circuits, all circuit boards using 74 series integrated circuits were powered by a single 5 V power supply. At that time, the power supply part was not a unit that required too much attention. Basically, a 5 V power supply could meet the needs of all digital integrated circuit designs. In recent years, with the development of technology, the transistors in integrated circuits have become smaller and smaller and the working voltage has become lower and lower, which has shifted the focus of embedded system development from system speed to low power design. Therefore, in the same embedded system, there are multiple power supplies with different voltages, ranging from less than 1 V to more than 5 V. In addition, when testing the stability and reliability of the system, it is also necessary to simulate different power failure conditions, such as power failure, etc. The stability and reliability of the embedded system also need to be simulated with different power supplies.


1 Power supply system structure
In this paper, a power supply design based on AVR Butterfly is proposed, which can well meet the power supply and system test requirements of embedded systems. The structure of the power supply system is shown in Figure 1.



2 Hardware design
The system is powered by two power supply voltages. The main power supply voltage is 12 V, which provides sufficient current for the target system and Butterfly (through a 3.3 V linear regulator). The other power supply voltage -5 V is used to provide negative voltage for the power amplifier. The main module is a linear regulated power supply. A 10 b DAC controls the voltage. The output of the module is connected to the current detection module and then output from the output terminal.

As shown in Figure 2, the main part of the power supply is the LM723 regulated power supply. Its reference voltage is less affected by external interference, and its output voltage is 0 when short-circuit protection is in place. The output voltage range of LM723 is between 2 and 37 V. If the LM723 output voltage is greater than 2 V, the V- pin can be directly grounded, but in order to make the output voltage reach 0 V, the V- pin should be connected to a negative voltage of at least -0.4 V. There are many ways to achieve this requirement. One is to use an inverter to convert the positive voltage into a negative voltage, but this will introduce noise interference. From the technical manual of the LM273 and its internal structure, it can be seen that the reference voltage of the LM237 is directly related to the voltage of the V- pin. The voltage of this pin must be stable and there must be no interference. Therefore, another method is used here to get the appropriate voltage. As shown in Figure 2, in the circuit, VREF = 1.28 V is obtained from the reference voltage of the LM723 by U2A, R19, R5 and R6, and it is inverted by the power amplifier U2B, R1, R2, at the node VM256 = -2.56 V, which completes a negative feedback to VREF, partially compensating for the influence of temperature on voltage, making the reference voltage stable. Here R19 is an adjustable resistor, which can control the voltage of VM256 point to a suitable value, so that the reference voltage of LM723 output can be fine-tuned.

TC1321DAC is connected to the IN pin of LM732 to set the output voltage. TCl321 has 10-bit resolution, 2.7~5.5 V output voltage, integral differential linearity and output voltage offset less than 8 mV. The DAC is controlled by the CPU inside Butterfly through the I2C bus. Its reference voltage VREF = 1.28 V. The output voltage of the DAC passes through a simple low-pass filter (composed of R7 and Cs) to smooth the output voltage and remove burrs.

Since many electronic devices cannot work under reverse voltage, there is a voltage offset correction circuit in the power supply design, as shown in Figure 3. The voltage feedback circuit is composed of R20, R9, R10, R18 and U2D. When the power supply is just started (the output of the DAC is 0 at this time), this part of the circuit can eliminate the negative voltage output. Here, the circuit is used to complete it, and the method of adding a constant to the DAC in the software is not used. This is because the offset may be a positive value. In the software, the DAC constant should be a negative value to correct it, and this method does not work because the DAC only works under unsigned numbers.

Diode D1 provides protection for the power supply circuit so that the output voltage will not be lower than -0.7 V. At the output end of the power supply, there is a 1μF capacitor to prevent the circuit from self-oscillating. The capacitance value cannot be too large. If it is too large, the output response of the power supply will slow down, and the speed of the CPU controlling the power supply will be reduced. Transistor Q1 is used to amplify the current output of LM723. The excess power dissipated by Q1 is P = (VIN-VOUT) × IOUT.

Resistor R14 sets the current threshold of LM723. When the voltage on R14 reaches 0.65 V, the output voltage is clamped by differential amplifier U2C. At this time, the voltage on R14 is amplified by the differential amplifier, and the ratio of voltage to output current is 1 V/1 A. The voltage is amplified to 5.6 V/A to meet the measurement requirements of Butterfly's VIN measurement circuit. The control part of the power supply is Butterfly, and the structure is shown in Figure 3. It has a good user interface, a five-channel joystick and a six-character LCD. Many peripheral devices are connected to the microcontroller, such as speakers, data flash memory, an NTC thermistor, a light sensor and an RS 232 communication port. All peripheral interfaces can be used to expand the functions of the system. Now, LCD, joystick, JTAG, ADC, USI (using I2C to drive DAC) and a current protection indicator LED are used in this power supply design.



DAC (U3) and Butterfly module are powered by HT7533-1 linear step-down regulated power supply, which does not have high voltage output. To avoid the influence of noise on the accuracy of power supply, all the "grounds" in the circuit are connected to one point on the circuit board, and the signal "ground" is also connected to the same point.

3 Software Design
The structure diagram of the software is shown in Figure 4, which is a GCC interface design based on Martin Thomas' Butterfly demo code. The CPU operating frequency is set to 8 MHz, because floating-point operations are used in the program, but not in the power supply design, so the power saving mode is not used. The ADC of AT-mega169 will issue an interrupt request at each conversion. The current protection has a higher priority than other processes. The ADC samples are averaged from 8 inputs to eliminate glitches and avoid triggering erroneous overcurrent protection. Some matching constant values ​​of the ADC are set in the software after measuring the parameters of the circuit.

4 Calibration
Because it is used as a signal source for testing, the power supply must be calibrated before use. Calibration includes two parts, hardware calibration and software setting. In this process, the Butterfly program needs to be rewritten and recompiled.

Disconnect Butterfly from the power circuit. After correctly connecting the power circuit, power on the circuit and measure the voltages VPLUS (12 V), VMINUS (-5 V), VCC (3.3 V), VREF (1.28 V) and VM256 (-2.56 V). These values ​​should be close to the values ​​in the brackets, but do not have to be exactly the same. Then, adjust the trimmer resistor R19 to adjust the voltage VREF to 1.28 V. After adjustment, disconnect the Butterfly and connect the other parts of the circuit, and then power it on.

Because it needs to be set up together with the hardware, an initial value is set in the relevant files in the software to facilitate the subsequent calibration. In the file DAC.h:



After compiling the code and writing it to Butteterfly, the output voltage is set to zero through the menu, and the output voltage is adjusted to zero by adjusting the trimmer resistor R20. Zero calibration is complete.

To calculate the value of V2CODECONST (VOUT = 1 V), enter a VSET voltage, such as 4 V, on the Butterfly menu, then measure VOUT and calculate the actual constant: The



output circuit is set to open circuit (the current output should be 0 at this time), and the displayed value of the power supply is recorded as I0DISP. Use the following formula:



Calculate CURCODEOFFSET.

Next, reprogram Butterfly according to the new constant value. To calculate the value of CODE2CURCONST, set a preset voltage value VSET, such as 5 V, and connect a known accurate resistor RLOAD of about 47 Ω (current is about 100 mA). Note the current display value IDISP on the LCD at this time, and calculate it using the following formula:



Then modify this constant value in ADC. H and recompile the program. The calibration is complete.

Like other advanced power supplies, this power supply has short-circuit protection and overload protection functions, and displays voltage, current and power consumption on the display. It can accurately simulate the main power supply and is used to test the performance of the target system under various power failures, such as voltage drop, voltage cycle drop, interference on the power line, etc.


5 Conclusion
As AVR Butterfly provides a wealth of external interfaces, the process of designing the control circuit is very simple. In this design, only a limited number of interfaces are used. Some interfaces can be used to expand the functions of the power supply. For example, the RS 232 serial interface can be used to connect the intelligent power supply to a PC, and the working status of the power supply can be reflected in real time on the PC.

[1] [1]
Keywords:AVR  Butterfly Reference address:A multifunctional power supply design based on AVR Butterfly

Previous article:How to use the AVR microcontroller's integrated ADC to take analog readings from the surrounding environment
Next article:Design of FSPLC Microprocessor SOC Based on AVR 8-bit Microprocessor

Recommended ReadingLatest update time:2024-11-16 11:45

AVR microcontroller (learning) - (II), ATMEGA16 interrupt system - 02
2. ATMEGA16 interrupt system 2. (02) Sleep mode interrupt wakeup of 4*4 row buttons Without further ado, the previous article has the registers used in this piece, so if you want to read this article, it is recommended to read the previous article . Of course, if you know how to do it~~~ Directly on the picture~~~
[Microcontroller]
AVR microcontroller (learning) - (II), ATMEGA16 interrupt system - 02
How to set the fuse of AVR microcontroller
Beginners often don't understand fuses. AVR chips use fuses to set the clock, boot time, enable some functions, BOOT area settings, and of course the most troublesome bit for beginners. If you don't set it well, it will be very troublesome to lock the chip. If you want to minimize the power consumption of the MCU, you
[Microcontroller]
How to set the fuse of AVR microcontroller
AVR MCU-Flowing Light 2
  Using a single-chip microcomputer, you can create various flowing light effects. I once saw someone use a STC89C52 single-chip microcomputer to connect 32 LEDs to make a heart shape, and then gave it to his girlfriend. Hehe~~   The array function of C language can be used to realize the design of pattern water light
[Microcontroller]
AVR MCU-Flowing Light 2
AVR Development Arduino Method (Part 2) Interrupt Subsystem
Before understanding the interrupt subsystem, we must first understand the concept of interrupts. You are reading a book and the phone rings. What will you do? I believe most people will do this: mark the position you are reading first, and then continue reading after answering the phone. This is an example of an inte
[Microcontroller]
Design of intelligent temperature control system based on AVR microcontroller and temperature sensor
introduction In industrial and agricultural production and daily life, the measurement and control of temperature are becoming more and more important. Traditional temperature control systems use thermistors or thermocouples to measure temperature. However, since the analog temperature sensor outputs an analog signal,
[Microcontroller]
Design of intelligent temperature control system based on AVR microcontroller and temperature sensor
AVR IO port setting method detailed explanation
Seeing that many novices do not understand how to use AVR microcontroller bit variables, here is an I/O port bit operation method for everyone to learn: Here is the macro definition I use: #define LED_SET PORTD |= (1 PD5) //Position high #define LED_CLR PORTD &= ~(1 PD5) //position low #define LED_COM PORTD ^= (1 P
[Microcontroller]
Analysis of the advantages and disadvantages of AVR microcontrollers
Introduction: AVR microcontroller is an enhanced RISC (Reduced Instruction Set CPU) high-speed 8-bit microcontroller with built-in Flash developed by ATMEL in 1997. AVR microcontrollers can be widely used in various fields such as computer peripherals, industrial real-time control, instrumentation, communication equip
[Microcontroller]
AVR MCU ATMEGA16 1602 LCD driver and experience
I developed my own AVR microcontroller chip development board, and the 1602 LCD screen experiment was successful! I was very pleased. I wrote the program for a whole day, and repeated the experiment, and finally succeeded at 0:00 am.      During this process, the biggest problem was the so-called matching 1602 LCD scr
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号