
Development of a low-power backup power supply with a sine output. Part 3. Work on bugs
Foreword
The series of articles “ Development of a low-power backup power supply with a sine output ” describes the process of designing and creating a RIP for a circulation pump of a heating system. In the second part of the story, the author proposed to the
Lyrical digression
After the publication of the second part of the story, the author posted a link to a series of articles on the easyelectronics.ru community . This is done so that experienced radio enthusiasts would appreciate the author's circuitry, point out critical errors and suggest options for improving and simplifying the circuit.
We will begin to understand the initial schemes. In the process of analysis, as well as taking into account user comments, we will bring the circuit to the
Next, the individual nodes of the circuit that have undergone changes will be presented, and at the end a generalized electrical circuit designed in CAD Dip Trace.
Power scheme
The power supply based on 1% LDO stabilizers has not changed. Although many spoke out, for replacing LDO at 5 volts with the usual LM7805, arguing that the LMK case can dissipate a lot of power. After all, the consumption on the 5 volt bus will be about 250 - 300 mA, which in terms of dissipation power: P = (Uin-Uout) * I = (12-5) * 0.3 = 2.1 W. What for the case SOT - 223, is simply sky-high.
The main current consumption on the 5-volt power bus will be selected by the LCD display. The LCD backlight will not be constant, basically it will be turned off, so that the current consumption on this bus will be half as much. That is, we need to dissipate 1W. To do this, select a decent polygon on the printed circuit board, as prompted in the comments , so there should not be a problem with this.
On the 3.3 volt bus, the LDO with the polygon on the board should work without any problems or overheating.
In the commentary , an opinion was expressed regarding the output capacitance for these types of LDO NCP1117STxx, that they can be critical for the stable operation of the stabilizer. Let's see the datasheet:
As far as I understand from this diagram, almost any capacitor with a capacity of 47 microfarads and above will drive the LDO into a stable mode of operation and it is not very important which EMP it has. Correct if I'm wrong. We finished meals, went on.
Schottky diode
Recall the original scheme.

The diode disconnects the battery from the bridge power bus. As correctly noted in this comment , on it in battery mode, more power will be allocated. 10 A Schottky diode has a direct drop on the 0.8 volt diode. At a current of 5 A, 4 W will be dissipated on it. Too much. In addition, I do not want to lose 0.8 Volts. So follow the advice, and put the P-channel mosfet. The IRF9310 has an open channel resistance of 0.0046 ohms. So the power dissipation is P = I * I * R = 5 * 5 * 0.0046 = 0.115 W. One and a half orders less. The voltage drop across the transistor will be U = I * R = 5 * 0.0046 = 23 mV. Generally not noticeable. Total we get such a scheme.

MK will manage this mosfet. When working from the battery, open, when charging the battery from the network, close. Everything is logical. In addition, it is comparable in value to the Schottky diode, so that the cost of the device in this component is not expected.
Transformer
A critical error has crept into this node. Consider the original option.

When working from the battery, when the bridge runs on a transformer, when the current flows from the beginning of the winding to its outlet, at the end of the winding there is an EMF of negative polarity relative to the circuit ground. Further, this EMF flows through the diode to the device ground, thereby creating a short circuit. With an EMF voltage of 3-4 volts, the short-circuit current will be on the order of several tens of amperes, which is bad for the diode, winding, and the entire device as a whole. That is, with a short circuit at the tap in the low-voltage winding, it will not be possible to obtain the necessary amplitude for the pump to work. In this case, current protection will also be useless. In a word, the device will not work, it will also burn the floor of the circuit. This situation was clearly seen in several comments. For example, hereand here . There are several ways out.
- Winding a full independent winding to charge the battery,
- Leave this winding lead dangling in the air while running on battery,
- Maybe something else you can think of.
I settled on the second option. During operation from the battery, the relay will break off this output of the winding from the diode rectifier charging bridge, and during the charge - connect, thereby providing an increased charging voltage.
Now for the measurement circuit for feedback. She, too, will not work in such an inclusion. Since the voltage from the diode bridge undergoes smoothing on high-capacity capacitors, during operation from the battery at the output of the resistive divider, a constant voltage will be set that practically does not react to changes in the voltage across the winding. So PID regulation of the output voltage by this signal does not provide. To solve, I propose to wind up an additional independent measuring winding. With an output of volts 5-6. Straighten with a diode bridge, smooth with a small capacity with a time constant of 5-7 ms, and drive this signal to the ADC MK for feedback. Fortunately, the power taken from such a winding will be scanty. So the overall efficiency of the transformer will not practically suffer, and the consumption with the battery will not grow much, at 10-15 mA. A wire for such a winding will need a thin one, and speed will provide 1-1.5 periods for control.
The final scheme of this node turned out as such.

The network detection scheme remained unchanged. The only thing to add is the software anti-bounce of the readings from the detector.
Shunt overcurrent protection
The scheme itself has not changed. The signal from the shunt is amplified on the operational amplifier, then it is turned on to the comparator. The output of the comparator when triggered becomes latch through the diode. The signal itself enters the MK, and is also designed to disconnect ALL bridge transistors. Everything would be fine, but the reset circuit of the comparator worked does not implement current protection at the moment of pressing the RESET button, as was correctly noted in this comment .
I see a solution to this problem as such. The RESET button is placed on the MK. Algorithm in MK record the pressing and pressing of the button. Then, through the transistor, reset the protection. And only upon the arrival of a signal to the MK that the protection is not active, start generating PWM to the bridge. Thus, if the cause of the overload has not been eliminated, then the current protection will work again, and it does not matter if the user presses the button or not. By the way, at the touch of a button, while the device is in operation, we will turn on the LCD backlight for a few seconds. Total circuit turned out like this.

Relay control
The circuit uses 3 relays at 12 volts. Two of them have a high-resistance coil and fairly weak contacts, 1 A per group. For high-voltage switching, 220 volts is enough with a margin, because the load power is 60 W pump, and 20-60 W during battery charge. That is, we fit into the floor of the ampere. But the relay at number 3 already commutes 5 amperes of charging current, for a decent time. So the relay having contacts for such a current, the coil resistance has already 400 Ohms.
We will control the relay through NPN transistors with MK. The relays will be energized only during the operation of the RIP on the battery load. So the operating time of the relay will be calculated several hours a week, or even less. But even this fact tends to reduce the consumption of this current to a minimum while the relay coils are under current.
This article has written well how this can be achieved without resorting to too complicated schemes.
The picture shows a separate relay coil control unit.

We calculate the resistors and capacitors for such a relay. Relay type: HJR4102-L-12VDC-SZ and SRD-12VDC-SL-C.
We calculate the current consumption of the relay in normal operation. I = Upit / Rcat = 12/720 = 0.0167 A = 16.7 mA. This current will be consumed by the coil. To keep the armature in an attracted state, the current value can be reduced by a third. That is, I = 16.7 * (2/3) = 11 mA. Round this value to 10 mA. Now the total resistance should be. R = U / I = 12/10 * 10-3 = 1200 Ohms. Of these, 720 Ohms is the resistance of the coil, and the additional resistance Rr = 1200-720 = 480 Ohms comes out. Choose from the standard row to the lower side. 470 Ohms, we will take the standard size of the SMD resistor 1206. The dissipated power of this standard size is 0.25 W. Now we calculate the power that will really stand out on such a resistor. P = I * I * R = 10 * 10-3 * 10 * 10-3 * 470 = 47000 * 10-6 = 0.047 W. So the resistor will not even heat up. By analogy, the resistor value for a 400 ohm coil will turn out to be 200 Ohms. Let's take a little less from the standard series - 180 Ohms. The holding current will be at 20 mA. The dissipated power of this resistor is obtained P = 0,072 watts. Also does not exceed declared for this standard size of 0.25 watts.
We calculate the capacitance of the capacitors to ensure the current "stall" of the armature. Let us set the time of “failure” of the armature and the inclusion of the relay 20 ms. The current flowing through the coil at this moment should be 30 mA for the “reinforced” coil. Hence, C = t * I / U = 20 * 10-3 * 30 * 10-3 / 12 = 50 * 10-6 F = 50 μF. We double the capacity, for greater certainty, i.e. get 100 uF. For weaker coils, half of this capacity is enough.
Pulse generation for H - bridge
In the second part of the story, I decided that I would use one PWM output with MK, and two outputs switching the shoulders of the bridge. Collect all this on the logic, and send the resulting signals to the key drivers.
Link to the scheme of this approach here .
In the comments, here and here , clearly showed the failure of this approach, because the selected MK allows you to generate PWM, as needed, for each personal key, without any special software troubles.
Lyrical digression
I am not a guru in MK programming, especially in STM32. I started to study 32 bit MK on the core of Cortex-M3, M4 just a month ago 4. So, probably, such “pens” with logic are excusable to me. By the way, as I study, I share my impressions and knowledge in the video tutorial cycle. These lessons are available at this link . There are not many of them yet, but as they are studied, they will be replenished.
In total, the pulse formation circuit was simplified. No logic chip. All four PWM channels directly from the MK go to the drivers. The input from the comparator of current protection, enters the MK, on the leg, which hardware turns off the PWM at all outputs.
The final algorithm will be something like this. A sinusoidal PWM is generated in the MC at the output of CH1 and CH1N. That is, for the shoulder of the bridge, we get PWM on both keys, through the dead time. This is the first half-wave, at this moment it is zero at CH2, and one at CH2N, that is, the lower key of the second shoulder is open. The next half-wave will be exactly the opposite. CH2 and CH2N through dead time, generate a sinusoidal PWM, and one arrives at CH1N. And so on in the cycle, more precisely in DMA to “infinity”. I will publish all software solutions in the next article, with source codes and explanations.
To summarize
After all the changes in the circuitry, the
The schematics as well as the component specifications are presented below. Specification under the spoiler. Sheet number 1. The picture is clickable Sheet No. 2. Clickable image


Specification
Leaf first

Leaf second

Leaf third (until the last)

Leaf first

Leaf second

Leaf third (until the last)
Conclusion
After all the upgrades, the changes settled on such a scheme. Now, according to the specification, I will make an order for radio components that I do not have available. And as it turns out, I have nothing except for penny resistors, capacitors, NPN - transistors and terminal blocks. So the task arose to purchase radio components. Fortunately, for the manufacture of printed circuit boards by the LUT method, there are all the necessary consumables.
The main order will be made in the online store http://chip-nn.ru/ . But the transformer, film capacitors of large capacity will have to be purchased at http://chipdip.ru Something all in one place, could not be found.
This is what the procurement statement looks like at the moment.
The amount is already decent. To this should be added small things, 100 rubles. Fee - 100. LCD display, which I have been lying around. At today's rate, it costs about 500 rubles. Further the case, any for all this good. So at the cost of a radio amateur we’ll come closer to the amount of 3,500 rubles.
Since weekends and holidays are close, I will place the order immediately after the holiday of real men.
Epilogue
I want to thank everyone who participated in the discussion and the “brainstorming” when considering the circuitry of this device. A special human THANKS to those who discovered critical comments in the scheme, and also proposed more correct and simple solutions to some nodes.
PS
Links to all parts of the cycle:
- Development of a low-power backup power supply with a sine output. Part 1. Statement of the problem
- Development of a low-power backup power supply with a sine output. Part 2. Development of an electrical circuit diagram
- Development of a low-power backup power supply with a sine output. Part 3. Work on bugs