Laboratory power supplies with microprocessor control. Laboratory power supply with control on a microcontroller

I present for your attention a proven scheme of a good laboratory power supply published in the Radio magazine No. 3, with a maximum voltage of 40 V and current to 10 A. The power supply is equipped with a digital display unit, with microcontroller control. The BP scheme is shown in Figure:

Description of the device. Optopara supports the voltage drop on the linear stabilizer approximately 1.5 V. If the voltage drop on the chip is increasing (for example, due to an increase in the input voltage), the Optocristone LED and, respectively, the phototransistor opens. Shi-controller turns off, closing the switching transistor. The voltage at the input of the linear stabilizer will decrease.

To increase stability, the R3 resistor is placed as close as possible to the DA1 stabilizer chip. Chokes L1, L2 - segments of ferrite tubes, attached to the conclusions of the valves of field transistors VT1, VT3. The length of these tubes is approximately half the output length. The L3 throttle is winding at two folded together ring magnetic cores K36x25x7.5 from the Permalloe MP 140. Its winding contains 45 turns that are wound into two wires PEV-2 with a diameter of 1 mm, laid evenly around the perimeter of the magnetic pipeline. The IRF9540 transistor is permissible to replace on IRF4905, and the IRF1010N transistor is on BUZ11, IRF540.

If you need with an output current exceeding 7.5 A, you need to add another DA5 stabilizer parallel to DA1. Then the maximum load current will reach 15 A. In this case, the L3 choke is wound with a harness consisting of four PEV-2 wires with a diameter of 1 mm, and increase the capacity of C1-SZ capacitors by about twice. Resistors R18, R19 are selected at the same heating of DA1 chip, DA5. Shi-controller should be replaced by another, allowing work at a higher frequency, for example, KR1156EU2.

Module digital measurement Voltage and current of laboratory BP

The basis of the device is a microcontroller Pici6F873. On the DA2 chip, the voltage stabilizer is assembled, which is also used as exemplary for the built-in ADC microcontroller DDI. RA5 and RA4 port lines are programmed as ADC inputs for voltage and current measurement, respectively, A RA3 - to control field Transistor. The current sensor is the R2 resistor, and the voltage sensor is the resistive divider R7 R8. The current sensor signal enhances the DAI OU. 1. And the DA1.2 is used as a buffer amplifier.

Specifications:

  • Voltage measurement, in - 0..50.
  • Measuring current, a - 0.05..9.99.
  • Protection thresholds:
  • - by current. A - from 0.05 to 9.99.
  • - by voltage. V - from 0.1 to 50.
  • Power supply, in - 9 ... 40.
  • Maximum current consumed, ma - 50.
Rating 1 Rating 2 Rating 3 Rating 4 Rating 5

A good, reliable and easy-to-use power supply is the most important and frequently used device in each radio laboratory.

Industrial stabilized power supply is a fairly expensive device. Using a microcontroller, when designing a power supply, you can build a device that has many additional features, easy to manufacture and is very accessible.

This digital power supply direct current It was a very successful product, and now its third version is available. It is still based on the same idea as the first option, but comes with a number of good improvements.

Introduction

This power supply is the least complex in manufacturing than most of the other schemes, but has much more functions:

The display displays the current measured voltage and current values.
- The display shows the predefined voltage and current limits.
- Only standard components (without special chips) are used.
- A single polarity supply voltage is required (there is no separate negative supply voltage for operating amplifiers or control logic)
- You can control the power supply from the computer. You can count current and voltage, and you can install them with simple commands. It is very useful for automated testing.
- A small keyboard for direct input of the desired voltage and maximum current.
- It's really small, but a powerful power source.

Is it possible to delete some components or add additional features? The trick is to move the functionality of analog components, such as operating amplifiers in a microcontroller. In other words, the complexity of software, algorithms increases and the hardware complexity decreases. This reduces the overall difficulty for you, since software Maybe just loaded.

Basic Electrical Project Ideas

Let's start with the simplest stabilized power supply. It consists of 2 main parts: transistor and stabilion, which creates a reference voltage.

The output voltage of this scheme will be uref minus 0.7 volts, which fall between B and e on the transistor. Stabilitron and the resistor create a reference voltage that is stable, even if there are voltage jumps at the input. The transistor is necessary for switching large currents that Stabilitron and the resistor cannot provide. In such a role, the transistor only enhances the current. To calculate the current on the resistor and the stabilone, the output current should be divided into an HFE transistor (HFE the number that can be found in the table with the characteristics of the transistor).

What are the problems in this scheme?

The transistor burns when there is a short closure at the output.
- It provides only a fixed output voltage.

These are pretty hard restrictions that make this scheme unsuitable for our project, but it is the basis for the design of the power supply with electronic control.

To overcome these problems, it is necessary to use "Intellect", which will adjust the current at the output and change support voltage. That's all (... and it makes the scheme much more difficult).

In the past few decades, people use operational amplifiers to ensure this algorithm. Operating amplifiers in principle can be used as analog calculators for addition, subtraction, multiplication, or to implement the operation of logical "or" voltages and currents.

Currently, all these operations can be quickly performed using a microcontroller. The whole charm is that you get as a free addition of a voltmeter and an ammeter. In any case, the microcontroller needs to know the output parameters of the current and voltage. You just need to display them. What we need from a microcontroller:

ADC (Analog-Digital Converter) to measure voltage and current.
- DAC (digital-analog converter) to control the transistor (control voltage adjustment).

The problem is, the DAC should be very fast. If a short closure at the output is detected, then we must immediately reduce the voltage based on the transistor otherwise it burns. The speed of the reaction should be within milliseconds (as fast as an operational amplifier).

Atmega8 has a ADC, which is fast enough, and at first glance he has no DAC. You can use latitude and pulse modulation (PWM) and an analog low-pass filter to get the DAC, but the PWM itself is too slow in the software for the implementation of short-circuit protection. How to build a quick DAC?

There are many ways to create digital-analog converters, but it should be quick and simple, which will easily interact with our microcontroller. There is a converter scheme known as "R-2R matrix". It consists only of resistors and switches. Two types of resistor ratings are used. One with the value R and one with a double value of R.

The above shows the scheme 3 of the bit R2R - DAC. Using the logical control, switching between GND and VCC. The logical unit connects the switch with the VCC, and the logical zero with GND. What does this scheme do? It adjusts the voltage in the VCC / 8 pitch. The total output voltage is:

Uout \u003d z * (VCC / (ZMAX +1)where Z is the dispersion of the DAC (0-7), in this case, 3-bit.

The internal resistance of the chain, as can be seen, will be equal to R.

Instead of using a separate switch, you can connect the R-2R matrix to the lines of the port of the microcontroller.

Creating a DC signal of different levels using PWM (latitude-pulse modulation)

The latitude-pulse modulation is the method when the pulses generate and pass through the lower frequency filter with the slice frequency are significantly lower than the pulse frequency. As a result, the DC signal and voltage depends on the width of these pulses.

ATMEGA8 has a 16-bit PWM hardware. That is, theoretically, you can have a 16-bit DAC using a small amount of components. To get a real DC signal from the PWM signal, it is necessary to filter it, it may be a problem when high permissions. The more accuracy, the lower the PWM signal frequency should be. This means that you need condensers large tankAnd the response time is very slow. The first and second versions of the digital DC power supply were built on a 10-bit R2R matrix. That is, the maximum output voltage can be installed in 1024 steps. If you use ATMEGA8 with a clock generator with a frequency of 8 MHz and 10 bit PWM, then the PWM signal pulses will have a frequency of 8MHz / 1024 \u003d 7.8KHz. To get the most good signal DC should be filtered by its second order filter from 700 Hz or less.

You can imagine what happens if you use a 16-bit PWM. 8MHz / 65536 \u003d 122Hz. Below 12Hz, what you need.

Combining R2R matrix and PWM

You can share the PWM and R2R matrix. In this project, we will use a 7-bit R2R matrix in combination with a 5-bit PWM signal. FROM clock frequency 8 MHz controller and 5-bit resolution we obtain a 250 kHz signal. The frequency of 250 kHz can be converted to a DC signal with a small number of capacitors.

In the original version of the digital DC power supply, a 10-bit DAC based on R2R-matrix was used. In the new design, we use R2R matrix and PWM with general resolution 12 bits.

Peroracretization

Due to some processing time, you can increase the resolution of the analog-to-digital converter (ADC). This is called oversampling. The quadruple recreation gives the result in double resolution. That is: 4 consecutive samples can be used to get two times more steps on the ADC. The theory underlying oversampling is explained in PDF Documentwhich you can find at the end of this article. We use oversampling for the voltage control circuit. On the current control circuit, we use the initial ADC permission as fast response time here more important than permission.

Detailed project description

Several technical details are still missing:

DAC (digital-analog converter) can not control the power transistor
- The microcontroller works from 5V, which means that the maximum yield of the DAC is 5V, and the maximum output voltage on the power transistor will be 5 - 0.7 \u003d 4.3V.

To fix it, we must add current and voltage amplifiers.

Adding an amplifying cascade on the DAC

When adding an amplifier, we must keep in mind that it should work with large signals. Most of the structures of amplifiers (for example, for audio) are made under the assumption that the signals will be small compared to the supply voltage. So forget all the classic books on the calculation of the amplifier for the power transistor.

We could use operational amplifiers, but they will require an additional positive and negative supply voltage that we want to avoid.

There is also an additional requirement that the amplifier must increase the stress from zero in a stable state without oscillations. Simply put there should be no voltage fluctuations when power is turned on.

Below is the scheme of an amplifying cascade that is suitable for this purpose.

Let's start with the power transistor. We use BD245 (Q1). In accordance with the characteristics, the transistor has HFE \u003d 20 on 3A. Therefore, it will consume about 150 mA on the basis. To strengthen the control current, we use a ligament known as "Darlington transistor". To do this, use the medium power transistor. As a rule, the HFE value must be 50-100. This will reduce the required current up to 3 mA (150 mA / 50). The 3MA current is a signal coming from low-power transistors, such as BC547 / BC557. Transistors with such output current are very well suited for building a voltage amplifier.

To get at the exit of 30V, we have to strengthen the 5V running with the DAC with the coefficient 6. For this, we combine PNP and NPN transistors as shown above. The voltage of the gain of this scheme is calculated:

VAMPL \u003d (R6 + R7) / R7

The power supply can be available in 2 versions: with a maximum output voltage of 30 and 22V. A combination of 1K and 6.8K gives a coefficient of 7.8, which is good for version 30B, but maybe there will be some losses at higher currents (our formula is linear, but there is no reality). For the 22V version we use 1K and 4.7K.

The internal resistance of the chain, as shown on the basis of BC547 will be:

Rin \u003d HFE1 * S1 * R7 * R5 \u003d 100 * 50 * 1K * 47k \u003d 235 MΩ

HFE from about 100 to 200 for BC547 transistor
- s is the inclination of the transistor gain curve and about 50 [unit \u003d 1 / OHM]

This is more than high enough to connect to our DAC, which has internal resistance 5k.

Interior equivalent exit resistance:

ROut \u003d (R6 + R7) / (S1 + S2 * R5 * R7) \u003d about 2

Low enough to use the transistor Q2.

R5 binds the BC557 base with the emitter, which means "off" for the transistor to the DAC and BC547 invent. R7 and R6 bind the basis Q2 first to the ground, which turns off the output stage of Darlington down.

In other words, each component in this amplifying stage is initially turned off. This means that we do not get any input and output oscillations from transistors when you turn on or off. This is a very important point. I saw expensive industrial power sources in which voltage jumps when turned off. Such sources will certainly be avoided because they can easily kill sensitive devices.

Limits

From previous experience, I know that some radio amateurs would like to "configure" the device for themselves. Here is a list of hardware restrictions and ways to overcome them:

BD245B: 10A 80W. 80W at a temperature of 25 "c. In other words, there is a power supply at the rate of 60-70W: (MAX INPUT Voltage * Max Current)< 65Вт.

You can add a second BD245B and increase power up to 120W. To make sure that the current is distributed equally to add a 0.22 resistor to the emitter of the line of each BD245B. The same scheme and board can be used. Set the transistors on the proper aluminum cooler and connect them with short wires to the board. The amplifier can control the second power transistor (this is maximum), but you may need to adjust the gain.

Shunt for measuring the current: we use a 0.75 power resistor 6W. Power enough enough at a current 2,5A (IOUT ^ 2 * 0.75<= 6Вт). Для больших токов используйте резисторы соответствующей мощности.

Power sources

You can use a transformer, rectifier and capacitors of a large capacity or you can use a 32/24B laptop adapter. I went on the second option, because Adapters are sometimes sold very cheap (by stock), and some of them provide 70W at 24V or even 32V constant voltage.

Most radio amateurs are likely to use conventional transformers, because they are easy to get.

For version 22B 2.5A you need: 3A 18B Transformer, rectifier and 2200mkf or 3300mkf capacitor. (18 * 1,4 \u003d 25V)
For version 30B 2a, you need: 2.5A 24V transformer, rectifier and 2200mkf or 3300mkf capacitor. (24 * 1,4 \u003d 33.6V)

It does not hurt if you use a more powerful current transformer. The rectifier bridge of 4 diodes with a low voltage drop (for example, BYV29-500) gives much better characteristics.

Check your device in case of poor insulation. Make sure that it will not be possible to touch any part of the device, where there may be a voltage 110/230 B. Connect all metal parts of the housing to the ground (not GND schema).

Transformers and power adapters for laptops

If you want to use two or more power sources in your device to get a positive and negative voltage, then it is important that the transformers are insulated. Be careful with power adapters for laptops. Low power adapters can still approach, but some of them can be connected by minus contact at the output with the contact of the Earth in the entrance. It may cause a short circuit through the ground wire when using two power sources in the block.


Other voltage and current

There are two options 22V 2.5A and 30B 2A. If you want to change the output voltage or current limits (only reduce), then simply change the hardware_settings.h file.

Example: To build 18V 2.5A version, you simply change in the Hardware_Settings.h file, the maximum output voltage 18B. You can use 20B 2.5A power supply.

Example: To build 18V 1.5A version, you simply change the maximum output voltage to 18V and Max in the Hardware_Settings.h file. Current 1.5a. You can use 20V 1.5A power supply.

Testing

The last element set to the fee must be a microcontroller. Before installing it, I would recommend to make some basic equipment tests:

Test1: Connect a small voltage (10V) to the input terminals of the board and make sure that the voltage regulator displays exactly 5V constant voltage.

Test2: Measure output voltage. It must be 0B (or close to zero, for example, 0.15, and it will strive for zero if you connect resistors on 2 hours or 5k.) instead of load)

Test3: Install the microcontroller on the board and download the LCD test software by running commands in the unpacked TAR.GZ DIGITALDCPOWER packet directory.

make test_lcd.hex
make Load_Test_LCd.

You should see the inscription on the display: "LCD Works".

Now you can download work software.

Some Warning Words for Further Testing with Work Software: Be careful with short circuits until you have experienced the restriction function. In a safe way to check the current limit is the use of resistors with low resistance (OM unit), for example, car light bulbs.

Set the low current limit, for example, 30mA at 10V. You must see that the voltage will decrease immediately almost to zero, as soon as you connect the light bulb. There is a malfunction in the chain if the voltage does not decrease. With the help of a car lamp, you can protect the power circuit, even if there is a malfunction, since it does not make a short circuit.

Software

This section will give you an understanding of how the program works, and how you can use the knowledge to make some changes in it. However, it should be remembered that short-circuit protection is made by programmatically. If you have done a mistake somewhere, the defense may not work. If you have a short closure at the output, your device will be in the smoke cloud. To avoid this, you must use the 12V automotive lamp (see above) to check for short-circuit protection.

Now a little about the structure of the program. When you first look at the basic program (file Main.c, download at the end of this article), you will see that there are only a few rows of the initialization code that is performed when the power is turned on, and then the program enters the infinite cycle.

Indeed, in this program there are two endless cycles. One of them is the main cycle ("While (1) (...)" in the Main.c file), and the other is a periodic interruption from an analog digital converter (ISR (ADC_VECT) function (...) "in the file Analog.c). After initialization, the interrupt is performed every 104 mx. All other functions and code are performed in the context of one of these cycles.

Interrupt can stop performing the task of the main cycle at any time. It will then be processed without being distracted by other tasks, and then the task will continue to continue in the main cycle on the spot where it was interrupted. From this follows two outputs:

1. The interrupt code should not be too long, as it should be completed before the next interrupt. Because here is the number of instructions in the machine code. A mathematical formula that can be recorded in the form of one row of the CI code can use up to hundreds of machine code rows.

2. Variables that are used in interrupt functions and in the code of the main cycle can suddenly change in the middle of the execution.

All this means that such complex things, like updating the display, check the buttons, current conversion and voltage must be made in the body of the main cycle. In interrupts, we perform critical tasks in time: measurement of current and voltage, overload protection and adjusting the DAC. To avoid complicated mathematical calculations in interrupts, they are performed in the DAC units. That is, in the same units as ADC (integers from 0 ... 1023 for current and 0 .. 2047 for voltage).

This is the basic idea of \u200b\u200bthe program. I will also briefly explain about the files that you will find in the archive (provided you are familiar with the CA).

main.c - This file contains the basic program. All initialization are manufactured here. The main cycle is also implemented here.
analog.c is an analog-to-digital converter, all that works in the context of the problem interrupt can be found here.
dac.c - digital-analog converter. Initialized from DDCP.C, but used only with Analog.C
kBD.C - data processing program from keyboard
lCD.C - LCD Driver. This is a special version, which will not need RW contact display.

To download software in a microcontroller, you need a programmer, such as AVRUSB500. You can download zip archives of software at the end of the article.

Edit the Hardware_Settings.h file and adjust it according to your equipment. Here you can also make a voltmeter and ammeter calibration. The file is well commented.

Connect the cable to the programmer and to your device. Then set the configuration bits to work the microcontroller from the internal generator with a frequency of 8 MHz. The program is designed for this frequency.

Buttons

The power supply has 4 buttons for local voltage control and max. Current, the 5th button is used to save the settings in the EEPROM memory so that the next time the block is turned on, the same voltage and current settings were.

U + increases voltage and U - reduces. When you hold the button, after some time the readings will "run" faster to easily change the voltage in large limits. Buttons I + and I - work the same way.

Display

Display indication is as follows:

The right arrow indicates that voltage restriction is currently working. If there is a short circuit on the outlet or the connected device consumes more than the set current, the arrow will be displayed at the bottom line of the display, which means turning on the current limit.

Some photos of the device

Here are some photos of the power source that I collected.

It is very small, but with more opportunities and more powerful than many other power supplies:

Old aluminum radiators from Pentium processors are well suited for cooling power elements:

Placement and adapter inside the hull:

Appearance of the device:

A variant of a two-channel power supply. Submitted boogyman:

PART 1
Sooner or later, the problem of the manufacture of a universal power supply (BP) arises before the radio amateur, which would have a sufficient reliability, adjustable output voltage, control from excessive current consumption and, of course, protection.
Everyone solves this problem in its own way. Options for building power sources not to read. The readers offer another one - with the control on the microcontroller. It is characterized by high-quality indication available to the elementary base, the lack of specialized chips of the strapping, reliable protection against abnormal situations and at the same time easy in repetition and easy to operate.
The proposed BP readers are quite accessible to the manufacture of radio amateurs that have minimal knowledge in microprocessor equipment, i.e. Owned algorithms of "flashing" ready-made programs in a microcontroller (MK) or may contact your friends who can help them. Otherwise - adhere to the principles of working with chips and, of course, do not forget about safety rules.
Despite the simplicity of the design, this BP has the following technical characteristics:

Such an idea arose after the desire to build a new BP, taking into account the realities and development of a modern elementary base.
When designing a radio amateur power supply for the home laboratory, the following tasks were delivered:
the presence of a digital display with which the output voltage and current values \u200b\u200bare lighter;
cover the most used range of output voltage from the zero itself;
abandon the variable resistor as an output voltage regulator;
the presence of protection, both from short circuit and the proceedable mode of the output transistor;
Display not installed, but real voltage and current data;
Taking into account the "digital filling" emit a minimum noise level;
availability of element base;
ease in setting up and repetition;
cost price.
The analysis of the previously published schemes showed that the authors use modern highly specialized chips, which are far from always available, especially in small cities. Attempts to replace them with others come out on the need to change in the program. Also, to facilitate herbs, the authors go on a lighter path, using liquid crystal indicators, but they have limitations on the corner of the review and not under all conditions readable. This lowers the user's response to changes in readings, dull attention and sometimes leads to the full loss of the connected device.
The power supply consists of three parts: the main - digital control module with an indication (A1), analog part (A2) and a separate power module of the entire block (A3).
Description of the fundamental electrical power supply and logic
The electrical circuit diagram of the device is shown in Fig. 1.

The basis of the digital part of the device is a microcircuit U1 of the company AVR ATMEGA16 (4). It has 10-bit analog-digital transducers (ADC). The source of the support voltage 5 V for ADC is powered by a microcontroller (MK), filed by 30 leg through the L1C4 filter.
The MK is assigned the digitization of the output voltage and current through the internal 10-bit ADC, and the output of the result is six seven segment indicators, the keyboard processing, the control of the output voltage regulator, the protection of the stabilizer.
For the best user response, the indication is organized dynamically on two seven segment LED red indicators (voltage) and green (current) colors that combine three discharges. Such a choice of color is explained by the fact that uncontrolled growth of voltage values \u200b\u200bis always more dangerous for the load than changing the ammeter readings, for the latter in automatic mode is tracked.
The presence of six indicators controlled by the MK ports led to the fact that the buffer chain T1-T6 from 6 transistors P-N-p conduction, reducing the current to an acceptable value of the current through the ports of the microcontroller.
To the register of the port of RV through eight current-limiting resistors R1-R8 includes connected to the parallel segments of six indicators. The PDO-PD5 ports are connected to transistors that activate a specific indicator discharge. Thus, the processor alternately "illuminates" each digit of the indicator and simultaneously through the port of the PBC7 generates the image of the desired number.
The voltage from the output of the power supply is received for digitizing on the ACP0 via the R49R50R51C9 resistor divider, whose division coefficient is 5. MK produces a sample and then determines the average value. As a current sensor that consumes the load, a powerful non-messenger resistor of low resistance R44 is used. The value of the voltage drop on it is amplified by the DA2.2 operating amplifier and is supplied to the ACP1 MK.
Based on the processing rate of the MK program, the port survey, including the keyboard, occurs cyclically, without the use of internal interrupts, which improves the stability of the work as a whole. In the case of not controlled disappearance of the supply voltage, the loss of controllability was not observed and the voltage increases at the outlet of the regulator was not fixed.
Buttons are connected to the port of the RA2, times, R4. Their three: S1 - "+", depending on the step of step, increases the value of the output voltage, S2 - "-" respectively reduces. The S3 button - "smooth / rough" determines the value of the setting step. When turned on, the step is 0.1 V, when the button is pressed, it increases to 1.5 V. The re-pressing returns the initial value that is indicated by the green LED2 LED. This mode is entered in order to quickly enter values \u200b\u200bwithout tedious clicks of the "+" button. A pitch of 1.5 V is selected from the consideration of approximation to a row of low-voltage equipment.
Thus, you can set the output voltage with an accuracy of 0.1 V.. Please note that BP not only measures the actual output voltage, but also sets it.
This method of operation of the power supply is very convenient in operation. You exhibit the desired voltage, it is immediately displayed on the terminals and is measured. When the load is connected, the current indicator in real time indicates the consumption current. With an abnormal or unstable load, the output voltage will "see" or "jump", which will immediately affect the indicators, and therefore will attract the wizard to the device connected to it.
The next, no matter is an important node, is a digital-to-analog converter (DAC), which through the port of PC0-RS7 controls the analog part of the device and forms the output voltage. From the considerations of the availability, ease of manufacture and reduce the level of emitted noise, the so-called R-2R DAC on R21-R37 is used. DSA circuit, taken from open sources (1), repeatedly verified and showed acceptable characteristics.
Analog part of the scheme is shown in Fig.2


and consists of a dual DA1 operational amplifier, which generates the output transistor control voltage and enhances the voltage from the current sensor.
DA1.1 in bond with transistors T7, T9, T10 is carried out by the required current and voltage gain. T7 and T9 is included according to a circuit with a common emitter, and T10 with a common collector. The inclusion of the last transistor has indisputable advantages: a large inlet and small output resistance, which is very important in the power source. The scheme with such an inclusion is also called the "emitter repeater". In general, the scheme works as follows: OU output current is amplified by the T7 transistor, its collector current is fed to the T9 base, and then the inverted and enhanced signal controls the powerful T10 transistor. In essence, T10 is an amplifier of the T9 collector current, which increases it in H21E times T10. Based on what is in place T9 you can use medium power transistors.
The operation of the operating amplifier is carried out by unipolar positive voltage. Thanks to the use of transistors of different conductivity, it was possible to achieve a minimum difference in input and output voltage and a clear controllability of the system as a whole. The presence of a R42 resistor in the Emitter T7 circuit limits its basic and, most importantly, the collector current is about 30 mA. The gain coefficient for the voltage of DA1.1 and T7 transistors T7, T9, T10 is 1 + R40 / R39.
On DA1.2, the voltage amplifier is assembled by the load current sensor current - R44 resistor. The voltage gain DA1.2 is 25. The R48 and D2 resistor is the simplest stabilizer, the task of which consists of protecting the port of RA1 from possible overvoltage, limiting the input voltage at the level of 5.1 V. Similarly used D1 and R49 for port .
On the elements R51, R54, R53, T8, an electronic fuse is assembled. It is introduced, based on the fact that the reaction time of the MK may be insufficient to block the bipolar transistor with a speed-torque system. The trigger current defines R54 and in small limits adjusts R53. The maximum trigger current is 2 A, which will not be able to fail the T10 transistor.
If the voltage drop on R54, which depends on the consumption current will exceed the value equal to approximately 0.6 V, the T8 transistor will open and prevents further increase in the base current of the T9 transistor, and after it is T10. The load current will be limited to a level safe. Used protection does not have a trigger mode of operation, and therefore immediately after removing the short circuit, returns to its original state. Thus, the voltage regulator withstands the outrage of the output current and in cases of short circuit on terminals, including a pulse character.
Regardless of the above electronic fuse on the analog elements that protects the power supply from the load, the protection of the load itself is assigned to the MK, which in real time monitors the output current values. If this indicator exceeds the specified maximum value, it will take protective measures, namely: immediately turn off the DAC by resetting the PC port register, and also informs the user by flashing LED1 LED. The lack of potential on the resistors of the DAC, and therefore, at the input DA1.1, the transistors of the regulator closes. The voltage on the output terminals will be removed - the load is disabled. In this state, BP may be unlimited time. To resume voltage supply, just pressing the S1 button to set the necessary output voltage. When the specified modes are exceeded, the protection will automatically work again. Thus, two independent protection loops are used in this power source: high-speed - analog on the T8 transistor and "controlling" - digital on U1.


The power of the circuit is shown in Fig. 3 and consists of two microcircuits VR1, VR2 and straightening chains, as well as filtration. The standard inclusion scheme does not require, except R58 with a capacity of 1 W, the presence of which is not necessarily, but it is significantly the best thermal mode of operation of the VR2 stabilizer by 5 V.
Details and design
U1 -MkAvr atmaga16a-16rpu or atmaga16l.
If you can't leave the microcontroller, then the rest of the parts are practically "consumer industry", which is always in prosperity. Block parts are not critical to replacement.
When building a DAC, definitely, the best option would be R-2R DAC in a hybrid body on one crystal. In its absence, use resistors in SMD execution or regular, but necessarily take each of the nominal numbers from one batch (box). Thus, the linearity of the conversion will be maximally. Practice of operation showed its stability and ease of implementation.
Indicators applied imported GNT-3631BG, GNS-3611BD, but can also be used similar domestic, as well as single alc321b or ALS324B, but necessarily with a common anode.
Buffer transistors SV478 are replaced by any small power transistors, which are available, with compliance with the location of the conclusions and conductivity, including KT209, KT502 with any letter index.
T7, T8 transistors - imported low power, but can be installed KT203, KT208, KT315 and KT361, respectively. In this case, pay attention to the maximum allowable voltage collector-emitter in comparison with the supply voltage after a diode bridge, if it exceeds 26 V. T9 - KT361, KT801B, KT807B. T10 - CT803A average power, KT814, KT805, CT808A or any powerful collector with a valid current collector at least 2 A and allowable voltage collector-emitter greater supply voltage. Tested the use as a weekend transistor according to the Darlington Tip110 scheme. The T10 transistor is desirable to choose with a large static database transmission coefficient. T10 is installed on a 400 cm2 radiator. If your radiator is small, then install the fan from the computer.
Resistors - C5-16B current sensors, with a capacity of 5 ... 10 W. The power of the current resistors from the consideration of reliability is consciously increased.
Capacitors on the A1 board are ceramic, preferably in SMD execution. Electrolytes in the stabilizer - K50-12.
Operating amplifier can be tried to replace TLC2272, TLC2262 or similar. Strip resistors from the SP5 series, SPZ-19B.
Power stabilizers at 5 and 18 V are operating without a radiator, if there are R58. Diode assembly at 2 A or any rectifier diodes with a permissible direct current in 2 A and reverse voltage of at least voltage on the secondary winding of the transformer. If you use a transformer to 24 V alternating voltage, then or germanium with a small direct voltage drop and reverse at least 30 V or modern spacing. LEDs can be applied any type.
The overall power of the transformer must not be 60 W, the output alternating voltage from 25 to 35 V, 2 A. With a larger voltage, stabilizers VR1, VR2 will not work.
Structurally manufactured on 3 or 2 boards. In the latter case, the A2 and A3 blocks are reduced to one. This design will give the opportunity to quickly upgrade the block in the future by replacing the outdated part, and will also facilitate the adjustment.
Assembly and commissioning
Properly assembled BP begins to work immediately, but you need to take into account the following.
In the digital part, swinging the board without MK, instead of which to install a 40-pin panel. You can install a 6-pin
connector for intrahemnal ISP programming (JMP1-JMP3). The L1 coil and C4 capacitor position as close as possible to the MK. The wiring of the board is so that the power supply of the circuit and MK with the "asterisk" from one point so that there is no "through" current through the conclusions of the microcontroller.
"Sewage" program in a microcontroller. Carefully rectify to the payment of FUUZs, otherwise Introduce it to the "knockout". If this stage is for the first time, first read the appropriate literature. The "stitched" controller will light zeros in the indicator, and will respond to the touch of fingers to the ADC ports, highlighting different numbers. Applying through resistors in a hundred ohm on the RA0, RA1 5 in from its own power, get the corresponding readings on the indicators.
Analog part can be collected all right away and starting to set separately, without digital card. Take all resistors, capacitors and diodes. Fit the chain of transistors after DA1.1 alternately with a mandatory measurement of the current collector T7. Control so that it does not reach the value of more than 30 mA. Otherwise, change the next transistor on another, similar or less power (H21E is important). If this condition does not comply, then the R2 resistor will have to be reduced to dozen ohm, and it will turn into a "stove". After that, we put in the LM358 panel. After making sure the voltage amplifier work, proceed to the electronic fuse on T8. With a load of 2 and should "respond" and block output power at a safe level.
The initial configuration of the voltmeter and ammeter readings is performed according to the testimony of the tester. On 2 leg DA1 5V from the power stabilizer and the 5 V at an output voltage in 25 V at an output voltage of the R50
The R47 resistor engine exhibit at the output 7 DA1 1.5V with a load of 1.5 A.
When the entire voltage circuit is operational, set the upper boundary of the voltage, depending on the input voltage from the transformer, using R40. Keep in mind that if the indications of the indicators are "jerked" with the static load, it means that the system is excited. This can be as a consequence of errors or incorrect layout of analog circuits on the board and the insufficient power of the transformer winding.
Now you can connect all parts together and make the final setting - the coordination of the previously stitched resistors.
Questions on the construction of the power supply can be asked to the author to the email address.[Email Protected].
RA №3, 2011
Literature
1. Voltage stabilizer 0 ... 25.5 V with adjustable current protection. // Radio. - №8. - 2007.
2. Grebnev V.V. ATMEL AVR Family Microcontrollers
3. Golubtsov M.S. AVR microcontrollers from simple to complex
4. Datasheet ATMEGA16A-16PU - ATMEL Datasheet 1C, 8-bit 16K Flash Microcontroller

PART 2


(Continued. Beginning See in 3/2011)
Published in the power supply unit scheme with microcontroller control pursued the goal to interest radio amateurs and help them understand the potential capabilities and prospects for the use of microcontrollers (MK) in the power supply blocks, as well as master the MK practically. The second part of this article is to continue the survey of the author in this direction and analyzing issues and proposals made by the author readers of the magazine.
The article reviews showed the presence of radio amateurs in the environment as a theoretical and practical interest in this topic, and also revealed the difficulties that readers faced.
The author's attention attracted a fair remark of one of the radio amateurs from the city of Kursk, who wished to repeat the block. It has only seven-segment indicators with a common cathode, and buying similar to the general anode used in BP from the article did not cause special enthusiasm. As expected, it did not cost without "religious wars" from the proportions of the products of competing manufacturers of microcontrollers AVR and PIC.
This BP also showed interest radio amateurs who have no experience with MK. Many readers are interested in the ability to increase the output power of BP with the preservation of previously stated characteristics and capabilities.
Considering the above wishes, the author has developed a number of additions that can be conditionally
split into three directions:
1. Modernization of the existing digital part of BP (A1) and the separation of its circuit into two nodes
(parts).
2. Transferring the result on another microcontroller platform.
3. Enhance the output power of BP and output current to 2 A.
It should be noted that at the same time the modernization was touched as a schematic diagram and the MK program.
In addition, the protection program is now controlled by the upper limit of consumption current in 2.05 A.
The rest declared in the characteristics of the power supply did not change.
Description of changes in the power circuit diagram of the power supply and logic of its operation
The structure of the power supply, as before, consists of three parts. Change, as described above, has been subjected to a digital control module with an indication (A1). The analog part (A2) and the power module (A3) of the BP itself remained unchanged.
The digital control module is divided into two parts, since the practice has shown that with the desire to make BP as compact as possible, arrange the microcontroller on the same board with the strapping, indicators and controls are almost impossible. In addition, the problem of the universality of using various types of LED indicators is solved.
Thus, the control and indication board (A4) is now added to the microcontroller control board (A4).
The fundamental electrical circuit of the upgraded module A1 is shown in Fig. 1.

The operation of the digital part of the device on the AVR AVR ATMEGA16 microcircuit is generally not changed (see).
On the MK, as before, the digitization functions of the output voltage and current through the internal ADC and the output of the result by six seven-segment indicators, the keyboard processing, the control of the output voltage regulator and the protection of the voltage stabilizer. For the convenience of working with a power supply to the program, an algorithm for incorporating the sound emitter (biper) is added when the system is switched to the "accident" mode and an encoder processing algorithm (Valko-Dera). At the same time, the mode of operation is left with the buttons. Thus, the user is given the ability to select a control option. For example, you can use only one S3 button "Step" and encoder. This option is especially useful to those who have a mechanical encoder with a built-in button.
Total, in the scheme to the original embodiment of Uz-la (A1), an encoder survey assembly is added from the circuit diagram: two resistors (R46, R47) and the encoder itself connected to previously free conclusions of RA5, RA6. Also added sound radiator control R49, T11, EP. In this design, you need to use bipper with internal generation. This is done so as not to "distract" a microcontroller to generate a signal. Those who will not be able to get such a radiator, recommend replacing it with a regular generator on transistors or logical elements with a piezo-emitter, powered by which you want to remove from the collector T11. This node is built in such a way that, at will, you can simultaneously use it for a complete shutdown of the power supply to the output of the power supply using a relay or field transistor with an emergency situation.
In the current version, a lot of things are submitted to the indication and control node (A4), which can be performed in two versions: for indicators with a common anode (Fig.2)

And for the indicators with a shared cathode (Fig. 3).

It is suitable for all microcontrollers specified in the article.
Thus, A4 contains 6 transistor key indications T1-T6 (N-P-N or P-N-P conduction, depending on the type of indicator), which are reduced to an acceptable value of the current through the ports of the microcontroller. The composition A4 includes the control circuit of the self-generating bipper on the T11 transistor and the encoder. Resistors R46, R47 included in the encoder survey node are located on A1.
At the request of radio amateurs who have faced the problem of acquiring MK AVR
ATMEGA16, a program for MK AVR ATMEGA8535 has been developed and tested, which coincides with the conclusions from ATMEGA16. It is also possible to apply AVR ATMEGA32 MK, the author has an appropriate version of the program.
In addition, a variant of the scheme of the block A1 was developed on the PIC16F877A MK, the schematic diagram of which is shown in Fig.4.

In general, there is a different architecture of ports. Nevertheless, it was possible to choose the optimal version of its connection with minimal differences. The main of which is the preconception of the CR1 quartz resonator, the lack of a strapping of the RESET circuit, the power supply of the analog part of the ADC and, of course, another intraframe programming connector. In this case, it is 10-pin-bone. The PIC16F877A software part works in the same way. Any option of control board and indication (A4) is physically suitable for the board.
The schematic diagram of the analog part (A2) has not changed. It can be viewed in Fig. 2 in.
The power of the block itself is made according to the Figure 3 scheme from and explained in the same place.
Details and design
U1 - AVR ATMEGA16-16PU, ATMEGA16L or ATMEGA16A, as well as the above ATMEGA8535, ATMEGA32, similarly - PIC16F877 and PIC16F877A.
I remind you that in the case of the use of these microcontrollers, AVR does not remake the diagrams and fees.
MK PIC among themselves are also interchangeable. At the same time, the author uses a quartz resonator for 10 MHz. Indicators, as indicated above, with a shared cathode or anode of any type and size. The value of the current in their chain depends on the selection of the indicator and their size. Therefore, it is possible that the selection of resistors in the chain between the indicator and the port of the RV MK in the range of 100 ... 300 ohms, but these resistors must necessarily have the same denominations.
The T1-T6 buffer transistors on the indicators board (A4), you can use any of the available transistors of low power, taking into account the conductivity and the collector current of about 100 mA.
Ed 12, res 16 or similar.
The power transformer power must be 70 ... 100 W, output voltage from 25 to 35 V, current for.
The radiator of the output transistor should have a useful cooling area of \u200b\u200bat least 500 cm2.
Otherwise, you need to put a fan for the compulsory blowing.
Assembly and commissioning
Properly assembled BP begins to work immediately. The assembly is done in the order specified in the previous article.
To a quartz resonator in the scheme on PIC16F877A, it may not be necessary to connect according to the standard diagram of two identical capacitors by 10 ... 30 PF (C2 and SZ).
You can program a microcontroller both in a separately assembled programmer and inside-circuit through the corresponding connector on the board.
I focus on checking when programming the correctness of the installed fioms, as the programmers do not have a single standard in this matter. First you need to read how the installed fub is indicated, and only then activate.
The option of installing FUUZS for the PONYPROG2000 program is shown in Fig.5.


For AVR ATMEGA8535, these fuses are exhibited similarly, and for MK PIC16F877 you need to use the word configuration: OX3F3A.

Files for firmware microcontrollers are laid out in the archive on the website of the Publishing House "Radioimator".
This archive contains 8 files:
file anD-2_05a_pic877.hex firmware MK PIC16F877 for indicators with OA;
file anD-2_05a_pic877a.hex firmware MK PIC16F877A for indicators with OA;
file CATOD-2_05A_PIC877.HEX Firmware MK PIC16F877 for indicators with OK;
File CATOD-2_05A_PIC877A.HEX \u200b\u200bFirmware MC PIC16F877A for indicators with OK;
file anod_2a_16.hex firmware MK ATMEGA16 for indicators with OA;
file catod_2a_16.hex ATMEGA16 MK firmware for indicators with OK;
file anod_2a_8535.hex firmware MK ATMEGA8535 for indicators with OA;
file catod_2a_8535.Hex ATMEGA8535 MK firmware for indicators with approx.
At this time, the author is carried out by a number of experiments to study the behavior of the block, especially the stability of its characteristics at an output current from 3 to 5 A.
Literature:
1. Kitty V.D. Laboratory block Food with microcontroller control 0 .. .25.5 V with double protection // Radioimator. - 2011 - №3. - p.26-30.
2. http://www.ra7.com.ua/ - Publishing House RadioMator.
Source of 3 "2011

ARCHIVE:
Kitty V.D.

Rating 1 Rating 2 Rating 3 Rating 4 Rating 5

A good, reliable and easy-to-use power supply is the most important and frequently used device in each radio laboratory.

Industrial stabilized power supply is a fairly expensive device. Using a microcontroller, when designing a power supply, you can build a device that has many additional features, easy to manufacture and is very accessible.

This digital DC power supply was a very successful product, and its third version is now available. It is still based on the same idea as the first option, but comes with a number of good improvements.

Introduction

This power supply is the least complex in manufacturing than most of the other schemes, but has much more functions:

The display displays the current measured voltage and current values.
- The display shows the predefined voltage and current limits.
- Only standard components (without special chips) are used.
- A single polarity supply voltage is required (there is no separate negative supply voltage for operating amplifiers or control logic)
- You can control the power supply from the computer. You can count current and voltage, and you can install them with simple commands. It is very useful for automated testing.
- A small keyboard for direct input of the desired voltage and maximum current.
- It's really small, but a powerful power source.

Is it possible to delete some components or add additional features? The trick is to move the functionality of analog components, such as operating amplifiers in a microcontroller. In other words, the complexity of software, algorithms increases and the hardware complexity decreases. This reduces the overall complexity for you, as the software can simply be loaded.

Basic Electrical Project Ideas

Let's start with the simplest stabilized power supply. It consists of 2 main parts: transistor and stabilion, which creates a reference voltage.

The output voltage of this scheme will be uref minus 0.7 volts, which fall between B and e on the transistor. Stabilitron and the resistor create a reference voltage that is stable, even if there are voltage jumps at the input. The transistor is necessary for switching large currents that Stabilitron and the resistor cannot provide. In such a role, the transistor only enhances the current. To calculate the current on the resistor and the stabilone, the output current should be divided into an HFE transistor (HFE the number that can be found in the table with the characteristics of the transistor).

What are the problems in this scheme?

The transistor burns when there is a short closure at the output.
- It provides only a fixed output voltage.

These are pretty hard restrictions that make this scheme unsuitable for our project, but it is the basis for the design of the power supply with electronic control.

To overcome these problems, it is necessary to use "Intellect", which will adjust the current at the output and change the reference voltage. That's all (... and it makes the scheme much more difficult).

In the past few decades, people use operational amplifiers to ensure this algorithm. Operating amplifiers in principle can be used as analog calculators for addition, subtraction, multiplication, or to implement the operation of logical "or" voltages and currents.

Currently, all these operations can be quickly performed using a microcontroller. The whole charm is that you get as a free addition of a voltmeter and an ammeter. In any case, the microcontroller needs to know the output parameters of the current and voltage. You just need to display them. What we need from a microcontroller:

ADC (Analog-Digital Converter) to measure voltage and current.
- DAC (digital-analog converter) to control the transistor (control voltage adjustment).

The problem is, the DAC should be very fast. If a short closure at the output is detected, then we must immediately reduce the voltage based on the transistor otherwise it burns. The speed of the reaction should be within milliseconds (as fast as an operational amplifier).

Atmega8 has a ADC, which is fast enough, and at first glance he has no DAC. You can use latitude and pulse modulation (PWM) and an analog low-pass filter to get the DAC, but the PWM itself is too slow in the software for the implementation of short-circuit protection. How to build a quick DAC?

There are many ways to create digital-analog converters, but it should be quick and simple, which will easily interact with our microcontroller. There is a converter scheme known as "R-2R matrix". It consists only of resistors and switches. Two types of resistor ratings are used. One with the value R and one with a double value of R.

The above shows the scheme 3 of the bit R2R - DAC. Using the logical control, switching between GND and VCC. The logical unit connects the switch with the VCC, and the logical zero with GND. What does this scheme do? It adjusts the voltage in the VCC / 8 pitch. The total output voltage is:

Uout \u003d z * (VCC / (ZMAX +1)where Z is the dispersion of the DAC (0-7), in this case, 3-bit.

The internal resistance of the chain, as can be seen, will be equal to R.

Instead of using a separate switch, you can connect the R-2R matrix to the lines of the port of the microcontroller.

Creating a DC signal of different levels using PWM (latitude-pulse modulation)

The latitude-pulse modulation is the method when the pulses generate and pass through the lower frequency filter with the slice frequency are significantly lower than the pulse frequency. As a result, the DC signal and voltage depends on the width of these pulses.

ATMEGA8 has a 16-bit PWM hardware. That is, theoretically, you can have a 16-bit DAC using a small amount of components. To get a real DC signal from the PWM signal, it is necessary to filter it, it may be a problem at high permissions. The more accuracy, the lower the PWM signal frequency should be. This means that the capacitors of a large capacity are needed, and the response time is obtained very slow. The first and second versions of the digital DC power supply were built on a 10-bit R2R matrix. That is, the maximum output voltage can be installed in 1024 steps. If you use ATMEGA8 with a clock generator with a frequency of 8 MHz and 10 bit PWM, then the PWM signal pulses will have a frequency of 8MHz / 1024 \u003d 7.8KHz. To obtain the most good DC signal, it is necessary to filter it to the second order filter from 700 Hz or less.

You can imagine what happens if you use a 16-bit PWM. 8MHz / 65536 \u003d 122Hz. Below 12Hz, what you need.

Combining R2R matrix and PWM

You can share the PWM and R2R matrix. In this project, we will use a 7-bit R2R matrix in combination with a 5-bit PWM signal. With the clock frequency of the 8 MHz controller and a 5-bit resolution we obtain a signal of 250 kHz. The frequency of 250 kHz can be converted to a DC signal with a small number of capacitors.

In the original version of the digital DC power supply, a 10-bit DAC based on R2R-matrix was used. In the new design, we use the R2R matrix and PWM with a total resolution of 12 bits.

Peroracretization

Due to some processing time, you can increase the resolution of the analog-to-digital converter (ADC). This is called oversampling. The quadruple recreation gives the result in double resolution. That is: 4 consecutive samples can be used to get two times more steps on the ADC. The theory, lying over-freeization is explained in the PDF document that you can find at the end of this article. We use oversampling for the voltage control circuit. On the current control circuit, we use the initial ADC permission as fast response time here more important than permission.

Detailed project description

Several technical details are still missing:

DAC (digital-analog converter) can not control the power transistor
- The microcontroller works from 5V, which means that the maximum yield of the DAC is 5V, and the maximum output voltage on the power transistor will be 5 - 0.7 \u003d 4.3V.

To fix it, we must add current and voltage amplifiers.

Adding an amplifying cascade on the DAC

When adding an amplifier, we must keep in mind that it should work with large signals. Most of the structures of amplifiers (for example, for audio) are made under the assumption that the signals will be small compared to the supply voltage. So forget all the classic books on the calculation of the amplifier for the power transistor.

We could use operational amplifiers, but they will require an additional positive and negative supply voltage that we want to avoid.

There is also an additional requirement that the amplifier must increase the stress from zero in a stable state without oscillations. Simply put there should be no voltage fluctuations when power is turned on.

Below is the scheme of an amplifying cascade that is suitable for this purpose.

Let's start with the power transistor. We use BD245 (Q1). In accordance with the characteristics, the transistor has HFE \u003d 20 on 3A. Therefore, it will consume about 150 mA on the basis. To strengthen the control current, we use a ligament known as "Darlington transistor". To do this, use the medium power transistor. As a rule, the HFE value must be 50-100. This will reduce the required current up to 3 mA (150 mA / 50). The 3MA current is a signal coming from low-power transistors, such as BC547 / BC557. Transistors with such output current are very well suited for building a voltage amplifier.

To get at the exit of 30V, we have to strengthen the 5V running with the DAC with the coefficient 6. For this, we combine PNP and NPN transistors as shown above. The voltage of the gain of this scheme is calculated:

VAMPL \u003d (R6 + R7) / R7

The power supply can be available in 2 versions: with a maximum output voltage of 30 and 22V. A combination of 1K and 6.8K gives a coefficient of 7.8, which is good for version 30B, but maybe there will be some losses at higher currents (our formula is linear, but there is no reality). For the 22V version we use 1K and 4.7K.

The internal resistance of the chain, as shown on the basis of BC547 will be:

Rin \u003d HFE1 * S1 * R7 * R5 \u003d 100 * 50 * 1K * 47k \u003d 235 MΩ

HFE from about 100 to 200 for BC547 transistor
- s is the inclination of the transistor gain curve and about 50 [unit \u003d 1 / OHM]

This is more than high enough to connect to our DAC, which has internal resistance 5k.

Interior equivalent exit resistance:

ROut \u003d (R6 + R7) / (S1 + S2 * R5 * R7) \u003d about 2

Low enough to use the transistor Q2.

R5 binds the BC557 base with the emitter, which means "off" for the transistor to the DAC and BC547 invent. R7 and R6 bind the basis Q2 first to the ground, which turns off the output stage of Darlington down.

In other words, each component in this amplifying stage is initially turned off. This means that we do not get any input and output oscillations from transistors when you turn on or off. This is a very important point. I saw expensive industrial power sources in which voltage jumps when turned off. Such sources will certainly be avoided because they can easily kill sensitive devices.

Limits

From previous experience, I know that some radio amateurs would like to "configure" the device for themselves. Here is a list of hardware restrictions and ways to overcome them:

BD245B: 10A 80W. 80W at a temperature of 25 "c. In other words, there is a power supply at the rate of 60-70W: (MAX INPUT Voltage * Max Current)< 65Вт.

You can add a second BD245B and increase power up to 120W. To make sure that the current is distributed equally to add a 0.22 resistor to the emitter of the line of each BD245B. The same scheme and board can be used. Set the transistors on the proper aluminum cooler and connect them with short wires to the board. The amplifier can control the second power transistor (this is maximum), but you may need to adjust the gain.

Shunt for measuring the current: we use a 0.75 power resistor 6W. Power enough enough at a current 2,5A (IOUT ^ 2 * 0.75<= 6Вт). Для больших токов используйте резисторы соответствующей мощности.

Power sources

You can use a transformer, rectifier and capacitors of a large capacity or you can use a 32/24B laptop adapter. I went on the second option, because Adapters are sometimes sold very cheap (by stock), and some of them provide 70W at 24V or even 32V constant voltage.

Most radio amateurs are likely to use conventional transformers, because they are easy to get.

For version 22B 2.5A you need: 3A 18B Transformer, rectifier and 2200mkf or 3300mkf capacitor. (18 * 1,4 \u003d 25V)
For version 30B 2a, you need: 2.5A 24V transformer, rectifier and 2200mkf or 3300mkf capacitor. (24 * 1,4 \u003d 33.6V)

It does not hurt if you use a more powerful current transformer. The rectifier bridge of 4 diodes with a low voltage drop (for example, BYV29-500) gives much better characteristics.

Check your device in case of poor insulation. Make sure that it will not be possible to touch any part of the device, where there may be a voltage 110/230 B. Connect all metal parts of the housing to the ground (not GND schema).

Transformers and power adapters for laptops

If you want to use two or more power sources in your device to get a positive and negative voltage, then it is important that the transformers are insulated. Be careful with power adapters for laptops. Low power adapters can still approach, but some of them can be connected by minus contact at the output with the contact of the Earth in the entrance. It may cause a short circuit through the ground wire when using two power sources in the block.


Other voltage and current

There are two options 22V 2.5A and 30B 2A. If you want to change the output voltage or current limits (only reduce), then simply change the hardware_settings.h file.

Example: To build 18V 2.5A version, you simply change in the Hardware_Settings.h file, the maximum output voltage 18B. You can use 20B 2.5A power supply.

Example: To build 18V 1.5A version, you simply change the maximum output voltage to 18V and Max in the Hardware_Settings.h file. Current 1.5a. You can use 20V 1.5A power supply.

Testing

The last element set to the fee must be a microcontroller. Before installing it, I would recommend to make some basic equipment tests:

Test1: Connect a small voltage (10V) to the input terminals of the board and make sure that the voltage regulator displays exactly 5V constant voltage.

Test2: Measure output voltage. It must be 0B (or close to zero, for example, 0.15, and it will strive for zero if you connect resistors on 2 hours or 5k.) instead of load)

Test3: Install the microcontroller on the board and download the LCD test software by running commands in the unpacked TAR.GZ DIGITALDCPOWER packet directory.

make test_lcd.hex
make Load_Test_LCd.

You should see the inscription on the display: "LCD Works".

Now you can download work software.

Some Warning Words for Further Testing with Work Software: Be careful with short circuits until you have experienced the restriction function. In a safe way to check the current limit is the use of resistors with low resistance (OM unit), for example, car light bulbs.

Set the low current limit, for example, 30mA at 10V. You must see that the voltage will decrease immediately almost to zero, as soon as you connect the light bulb. There is a malfunction in the chain if the voltage does not decrease. With the help of a car lamp, you can protect the power circuit, even if there is a malfunction, since it does not make a short circuit.

Software

This section will give you an understanding of how the program works, and how you can use the knowledge to make some changes in it. However, it should be remembered that short-circuit protection is made by programmatically. If you have done a mistake somewhere, the defense may not work. If you have a short closure at the output, your device will be in the smoke cloud. To avoid this, you must use the 12V automotive lamp (see above) to check for short-circuit protection.

Now a little about the structure of the program. When you first look at the basic program (file Main.c, download at the end of this article), you will see that there are only a few rows of the initialization code that is performed when the power is turned on, and then the program enters the infinite cycle.

Indeed, in this program there are two endless cycles. One of them is the main cycle ("While (1) (...)" in the Main.c file), and the other is a periodic interruption from an analog digital converter (ISR (ADC_VECT) function (...) "in the file Analog.c). After initialization, the interrupt is performed every 104 mx. All other functions and code are performed in the context of one of these cycles.

Interrupt can stop performing the task of the main cycle at any time. It will then be processed without being distracted by other tasks, and then the task will continue to continue in the main cycle on the spot where it was interrupted. From this follows two outputs:

1. The interrupt code should not be too long, as it should be completed before the next interrupt. Because here is the number of instructions in the machine code. A mathematical formula that can be recorded in the form of one row of the CI code can use up to hundreds of machine code rows.

2. Variables that are used in interrupt functions and in the code of the main cycle can suddenly change in the middle of the execution.

All this means that such complex things, like updating the display, check the buttons, current conversion and voltage must be made in the body of the main cycle. In interrupts, we perform critical tasks in time: measurement of current and voltage, overload protection and adjusting the DAC. To avoid complicated mathematical calculations in interrupts, they are performed in the DAC units. That is, in the same units as ADC (integers from 0 ... 1023 for current and 0 .. 2047 for voltage).

This is the basic idea of \u200b\u200bthe program. I will also briefly explain about the files that you will find in the archive (provided you are familiar with the CA).

main.c - This file contains the basic program. All initialization are manufactured here. The main cycle is also implemented here.
analog.c is an analog-to-digital converter, all that works in the context of the problem interrupt can be found here.
dac.c - digital-analog converter. Initialized from DDCP.C, but used only with Analog.C
kBD.C - data processing program from keyboard
lCD.C - LCD Driver. This is a special version, which will not need RW contact display.

To download software in a microcontroller, you need a programmer, such as AVRUSB500. You can download zip archives of software at the end of the article.

Edit the Hardware_Settings.h file and adjust it according to your equipment. Here you can also make a voltmeter and ammeter calibration. The file is well commented.

Connect the cable to the programmer and to your device. Then set the configuration bits to work the microcontroller from the internal generator with a frequency of 8 MHz. The program is designed for this frequency.

Buttons

The power supply has 4 buttons for local voltage control and max. Current, the 5th button is used to save the settings in the EEPROM memory so that the next time the block is turned on, the same voltage and current settings were.

U + increases voltage and U - reduces. When you hold the button, after some time the readings will "run" faster to easily change the voltage in large limits. Buttons I + and I - work the same way.

Display

Display indication is as follows:

The right arrow indicates that voltage restriction is currently working. If there is a short circuit on the outlet or the connected device consumes more than the set current, the arrow will be displayed at the bottom line of the display, which means turning on the current limit.

Some photos of the device

Here are some photos of the power source that I collected.

It is very small, but with more opportunities and more powerful than many other power supplies:

Old aluminum radiators from Pentium processors are well suited for cooling power elements:

Placement and adapter inside the hull:

Appearance of the device:

A variant of a two-channel power supply. Submitted boogyman:

11

Fig. 2. Power supply scheme.

Main changes in the scheme relative to the original:
1) Under the R-2R DAC highlighted the port with a microcontroller entirely, it's easier to work,
2) Resistors themselves in the village of other denominations, such as they were, by the way, these resistors would need to pick up with high accuracy, otherwise during the operation of the DAC will be steps.
3) Darlington diagram in the output cascade is replaced by one CT8106A.;
4) the current-measuring shunt is made more powerful and with a smaller resistance (0.55 ohms);
5) Fixed alignment of the encoder and the LCD screen signal lines.
6) The termination of the thermal sensor and the PWM control fan control scheme is provided.

The source code has been modified under this scheme. The legs of the microcontroller are reassigned. Files to work with the keyboard were replaced ( kbd.c and kbd.h.) on files to work with encoder. Work algorithm encodernext: Pressed an encoder - entered the voltage setting mode, pressed again - entered the current installation mode, pressed again - saved the settings. If you do not touch in the setup mode encoderfor more than 20 seconds, the unit automatically leaves the setup mode and does not save the changes. Encoderworks on external interrupts and uses Timer2 timer to implement protective pauses.

Changed the logic of working with the LED state. Now it shows emergency situations - the power supply overload, overheating and the state of overwriting the firmware by bootloader.

The display of the display entered the logging of the variable parameter.

Added a survey of the 3rd analog ADC entry for the thermal sensor. Implemented PWM-adjustment of the cooling fan revolutions depending on the sensor readings.

Changed the communication protocol with a computer. It is now used standardized commands that allow you to set the current / voltage settings and calibration settings. Now calibrations are also stored in the EEPROM microcontroller.
The use of a more capacious microcontroller allowed bootloider..

Assembly

The OPS body is very well suited for alteration. Durable, plastic, internal amplifying ribs. Yes, and the size is suitable. Instead of the rear panel with power connectors, I cut out the color and shape of a piece of smooth plastic from the jet printer's tray. She screwed a radiator from the old atlon. To the radiator through insulating thermopod attached the output transistor, a diode bridge and a temperature sensor. Two words about how to identify windings in a transformer: the thick three wires are the secondary power winding. I have a power part from it. There is also a second low-waste secondary winding to power the internal OPS scheme. It is determined so - these are two thin wires of the same (I had orange) colors. I have a control scheme, a microcontroller, a screen illumination and a fan from it. The rest of the relatively thin wires are the primary winding with a large number of taps. With their help, you can choose the right output voltage of the power winding at an acceptable idle course.

As a result of the removal of power connectors, a place was released between the rear wall and the transformer, in which the filter capacitors were placed. The front panel stated and cut the holes for the screen and output connectors. The control board, encoder, power switch and the RS232 interface board are placed in the housing lid. In front of the case, a free space is left for further enhancement block (you can put a second transformer).

As an MK computer intefion, I still use the finished handkerchief of the USB-TTL RS232 converter on the CP2102 microcircuit. Through it, flashing MK and computer communication with the scheme. In the future, I plan to make an optoisolated RS232 interface.

Fig.3. Front Panel.


Fig. 4. Installing the radiator.


Fig. 5. Block's insides.

Firmware

I did everything in the environment AVR Studio 4.18 with WinAvr-20100110. The finished firmware files for the bootloader and the main program lie in the archive.
You can flash the microcontroller and just the main program or bundle " bootloader + basic program". The first case is suitable for those who are not going to change in the basic program. Or it is not going to do a block-computer interface. In the case of the use of the bootloader, you can reprogram the fully assembled device and in the first step it was very convenient, for example, to customize calibration parameters. However, For bootloader, the block needs RS232.

Regardless of the programming method, you first need to connect the collected fee to the ISP programmer. Then flash the corresponding hex file and set fuses. In case of using the program without bootloeraHigh \u003d 0xdb Low \u003d 0xde, in the second high \u003d 0xda Low \u003d 0xde. The rest should not be changed.

As soon as bootloider.shoot, further manipulations on reprogramming are carried out very simply: connect the block to the RS232 computer with the interface, control (in case USB-The emulation of the port) that the connection happened to COM1, 2, 3, or 4, turn on the power of the unit and immediately run in the Tools-\u003e AVR Prog studio. In it, select a file from the archive with the firmware \\ avrgcc1 \\ debug \\ PowerUnit.hex and sew.
Because I. bootloider.and the whole procedure is made by the article, the subtlety of the process can be drawn there.

Calibration

The wonderful property of this scheme is universality. Basically, You can make a power supply for any voltage, any current, and any design. It is clear that these characteristics depend primarily from the primary power converters: a transformer, a diode bridge, filter, an output cascade transistor, or a pulse converter characteristics.

But for the microcontroller part it is not important. The main thing is that the output voltage divider gave it a voltage from 0 to 2.56V, the current shunt in the short circuit mode gave about 2V, and the output voltage setting system took the voltage from 0 to 5V.
You can configure calibration using the interface.

Interface and Computer Working

The interface operation has also changed compared to the GVIDO program: Speed \u200b\u200b38400 Kbps, 8N1. At the end of the line requires a carriage translation symbol.
Set of teams:


Using these commands, you can control the block from any terminal program. I prefer to use Serial Monitor in Arduino, but this is a matter of taste.
I wrote a small program for Windows that can output data into a schedule and set values, including on the protocol. See File Section.


Fig.6. Control program interface. Tab with graphs.

Did you like the article? To share with friends: