Switch on switch off. Power Management Schemes

Sometimes there is a need to control a particular load with just one button. There are two types of buttons, with and without latching. If you use non-latching buttons, for example to turn on an LED, then when pressed the LED will light up and when released it will go out.

The above circuit is incredibly simple and consists of three transistors, two of which are of reverse conductivity. It works according to the following principle: when pressed for the first time, the LED will light up, and when pressed again, it will go out.

There are many areas of application for such a simple electronic button, from simple flashlights to powerful switching systems.

How it works

At the initial moment, when power is supplied to the circuit, all three transistors are closed, at the same time, through the chain of resistors R1 and R2, the electrolytic capacitor C1 is charged, the voltage on it is equal to the supply voltage. When you press the button, a positive signal from the capacitor is sent to the base of transistor VT3, unlocking it; through the open transition of this transistor, voltage is supplied to the base of transistor VT2, as a result of which it also opens. The load, in our case the LED, is also activated, even during the operation of the transistor VT3.

This part of the circuit is a trigger latch. Transistor VT3 opens VT2, and when it opens, it supplies voltage to the base of transistor VT3, keeping it open.

The circuit can remain in this state for an infinitely long time. Moreover, the button can simply be pressed and released, rather than held down.

The opening transistor VT2 also opens the transistor VT1. In this state, all three transistors are open. When VT1 is open, through its open junction and resistor R2, capacitor C1 will be discharged, hence we can conclude that when the transistors are open, the capacitor is discharged.

When the button is pressed again, the base of the transistor VT3 is connected to the negative plate of the capacitor C1, at the base of the key the voltage is around 0.7 volts, and as a result of the charge of the capacitor it drops and it is locked. With transistor VT3 turned off, the capacitor again begins to charge in normal mode, through the previously specified resistors.

The load is switched by transistor VT3, it can be taken more powerfully, for example bd139, in this case we will have the opportunity to connect more powerful loads to the circuit, or we can amplify the signal from the output of our button with an additional transistor.

The transistors used in the circuit are not critical; you can take any low and medium power of appropriate conductivity. The values ​​of other components of the circuit can be deviated in one direction or another by 30%.

The circuit is not power-hungry; from a 5-volt power source, the no-load current consumption is only 850 microAmps, so that you can safely use it as a switch in, say, a flashlight.

If you are faced with the task of turning on and off a device or several devices with one button, and you are looking for such an option, then you have clearly come to us at the right place. Here you will be offered several schemes for implementing similar projects on different microcircuits, and therefore with different operating principles, but with the same result. Well, let's talk about everything in order!

Control of one device (on/off) from one button (NE555)

We won’t bother too much about the first scheme, since the scheme is not our original idea, besides, this scheme has already been disassembled everywhere on the Internet. We saw that there is even a video about this. If you want, you can search.

Essentially, this circuit works on the NE555 timer chip. Yes, the microcircuit is already legendary and has achieved fame. Here, from this very timer, a multivibrator was created. So, if you create feedback on a timer, you get a multivibrator. And this very connection is created by pressing a button. As a result, the timer enters multivibrator mode and, with a certain frequency, begins to produce output pulses of either a one or a zero. As a result, it is this impulse that will control the power and indication circuit on a transistor with a relay and an LED.

What could be the downsides? Well, the main disadvantage is that the timer remains a timer, that is, it is not particularly interested in how many times you pressed the button, it is more interested in how to quickly charge or discharge a 1 μF capacitor. That is, it is possible that switching on and off may slip, not obvious and inaccurate operation. Some radio amateurs call this "contact rattling", but this has nothing to do with this term. This is the normal operation of the timer, nothing more. So, with this option everything is clear.

Control of several or one device (on/off) from one button (K155IE7)

Now the option is on the counter. This is the principle here. There is a binary counter on the K155ie7 chip, at its output the potential changes with the input signal. Again, it's either a one or a zero. There are four exits in total. The first output on leg 3 changes its potential with every 1 press, the second on leg 2 with every 2, etc. In the end, what happens? It turns out that with one click you can control not only one device, but 4 at once, that is, according to the number of outputs. Here the main thing is to convert the low current signal into a high current signal. It is for this purpose that on the output leg we need, it is enough to “hang” a power module assembled on a 4n25 optocoupler, a transistor and a relay.

Also, in addition to controlling one, two, three or four devices, it will be possible to use such a scheme as a code key, that is, a combination lock. Here you can install a second counter and, depending on the high potentials on certain legs, provide power to operate the control locking element of the lock. We will not develop this topic, since it is better to make our own thematic article on this matter. We can only summarize that this scheme is not much more complicated than the first one; at the same time, it works with one click clearly and without deviations, and besides, it can control the power of 4 devices at once. This is exactly what we needed to achieve!
And now, whoever was too lazy to read and understand all this, we suggest you watch the video, which describes exactly the same thing.

LED bulbs How much does a charger consume and is it possible to save money on it or why do you still need to disconnect charging from the outlet? Commands for enabling and disabling options for mobile operators (MTS, Beeline, Megafon) Resistor color coding (nominal resistance and power)
Electric cable heating systems (ECSO) are an excellent solution for a modern home
Schneider Electric: new products in the Odace series

In portable devices, as you know, an important component is battery life. Who would like to use a device that has to be charged very often? Therefore, it is useful to add another function to various ways to reduce energy consumption - automatic power off, which will help save battery power if the user forgot to turn off the device. And in order to implement this, the device must be turned on and off from the button without locking. I just needed to implement something similar, and after testing several schemes found on the Internet, I settled on the most interesting solution. Therefore, now I will show how you can turn on and off a device on a microcontroller with one button without locking and the implementation of such an algorithm in Bascom-AVR.

The circuit is built on a small number of discrete elements and uses one controller interrupt:

When you press the S1 button, the transistor Q1 opens and the voltage from the battery goes to the circuit. In order to prevent transistor Q1 from closing after releasing the button, it is necessary to open transistor Q2 by applying one to the gate. And as long as there is a high voltage level at the gate of Q2, the circuit will be powered. When you need to de-energize the circuit and turn off the device, simply remove the voltage from this pin, both transistors will close and completely de-energize the circuit. LED D3 for operation indication.

Transistors must be used with a Logic Level so that they are fully turned on by battery voltage. Although I assembled and tested the circuit on what came to hand: I used IRF5305 as Q1, and IRF530 as Q2. Both transistors from 5 volts open almost completely. I took them because they are in large cases and can be used in a breadboard. Instead of diodes D1 and D2, I plugged in a diode bridge :)

First example. Turning the power on and off is done by simply pressing a button.

$regfile = "m8def.dat"
$crystal = 1000000

Dim flag asByte"variable for executing the main program

Config PORTB. 0 = OUTPUT"LED output
Ledalias portb. 0

Config portd. 3 = OUTPUT"power management
pwralias portd. 3

Config INT0 = low level "on/off button
On Int0 Start:

Enable int0 "enable interrupts
Enable interrupts

"main loop
Do

If flag = 1 then
Led= 1
Endif

Loop

end


launch:

toggle pwr "on/off

flag= 1 "raise the flag

do
loop until pind. 2 = 1

waitms 100
Gifr= 64

return

And the second example. In order to prevent accidental switching on or off, a delay when pressing is more often used. This can also be easily implemented in this circuit; the code below has been slightly modified and now switching on and off occurs with a three-second delay:

$regfile = "m8def.dat"
$crystal = 1000000

dim flag asByte"variable for executing the main program
dim a asByte"to organize a delay
config PORTB. 0 = OUTPUT"LED output
ledalias portb. 0

config portd. 3 = OUTPUT"power management
pwralias portd. 3

config INT0 = low level "on/off button
On Int0 Start:

enable int0 "enable interrupts
enable interrupts

"main loop
do

if flag = 1 then"execution of the main program
"....
"....
endif

loop

end

"interrupt when a button is pressed
launch:

flag= 1 "raise the flag

do
incr a
wait 1

if a = 3 then"if 3 seconds have passed
toggle pwr "on/off
toggle led
goto ext "exit loop
endif

loopuntil pind. 2 = 1 "while the button is pressed, let's spin here
ext:
a= 0
waitms 100
Gifr= 64

return

If you are faced with the task of turning on and off a device or several devices with one button, and you are looking for such an option, then you have clearly come to us at the right place. Here you will be offered several schemes for implementing similar projects on different microcircuits, and therefore with different operating principles, but with the same result. Well, let's talk about everything in order!

Control of one device (on/off) from one button (NE555)

We won’t bother too much about the first scheme, since the scheme is not our original idea, besides, this scheme has already been disassembled everywhere on the Internet. We saw that there is even a video about this. If you want, you can search.

Essentially, this circuit works on the NE555 timer chip. Yes, the microcircuit is already legendary and has achieved fame. Here, from this very timer, a multivibrator was created. So, if you create feedback on a timer, you get a multivibrator. And this very connection is created by pressing a button. As a result, the timer enters multivibrator mode and, with a certain frequency, begins to produce output pulses of either a one or a zero. As a result, it is this impulse that will control the power and indication circuit on a transistor with a relay and an LED.

What could be the downsides? Well, the main disadvantage is that the timer remains a timer, that is, it is not particularly interested in how many times you pressed the button, it is more interested in how to quickly charge or discharge a 1 μF capacitor. That is, it is possible that switching on and off may slip, not obvious and inaccurate operation. Some radio amateurs call this "contact rattling", but this has nothing to do with this term. This is the normal operation of the timer, nothing more. So, with this option everything is clear.

Control of several or one device (on/off) from one button (K155IE7)

Now the option is on the counter. This is the principle here. There is a binary counter on the K155ie7 chip, at its output the potential changes with the input signal. Again, it's either a one or a zero. There are four exits in total. The first output on leg 3 changes its potential with every 1 press, the second on leg 2 with every 2, etc. In the end, what happens? It turns out that with one click you can control not only one device, but 4 at once, that is, according to the number of outputs. Here the main thing is to convert the low current signal into a high current signal. It is for this purpose that on the output leg we need, it is enough to “hang” a power module assembled on a 4n25 optocoupler, a transistor and a relay.

Also, in addition to controlling one, two, three or four devices, it will be possible to use such a scheme as a code key, that is, a combination lock. Here you can install a second counter and, depending on the high potentials on certain legs, provide power to operate the control locking element of the lock. We will not develop this topic, since it is better to make our own thematic article on this matter. We can only summarize that this scheme is not much more complicated than the first one; at the same time, it works with one click clearly and without deviations, and besides, it can control the power of 4 devices at once. This is exactly what we needed to achieve!
And now, whoever was too lazy to read and understand all this, we suggest you watch the video, which describes exactly the same thing.

Turning on/off multiple devices using microcontrollers (on Arduino)

Well, another variation of working with a whole “galaxy” of different devices is the use of microcontrollers. One of the most popular and at the same time understandable devices is Adruino, based on the Amtel 328P microcontroller. Microcontrollers are able to solve assigned tasks much more “flexibly” than analog circuits, especially if we take into account the possibility of customization and reconfiguration. Therefore, once you have mastered microcontrollers, you will simply start doing everything on them on a whim, since the current price of microcontrollers is comparable to analog elements. So, about turning on and off several devices on a microcontroller in the article “Arduino controls several devices"

Video about turning on and off several devices (one, two, three, four) with one button

This device allows you to turn the load on and off by pressing one button without locking. It is based on a T-trigger formed by a D-trigger and a single-shot input to eliminate contact bounce and interference. Using the device, you can control, for example, turning on the light. The control input reacts to a short to ground, which also allows the device to be used in a car.

Principle of operation

The circuit contains 2 D flip-flops. The first one is connected according to a one-shot circuit. Inputs D and CLK are shorted to common, and they always have a logical zero. Through R2, a logical one is supplied to input S. The output is connected to the RESET pin via an RC circuit. Next comes a standard T-trigger circuit based on a D-trigger - the D input is connected to the inverting output, and the RS pins are not used and are connected to common.

Let's see what happens when you press the button.

At the moment the button is pressed, a logical zero arrives at pin S, it also goes to the output, and through R1 it resets the trigger, which goes to the initial state. Capacitor C1 smoothes the cycle, and its capacitance determines how long the button must be pressed for the trigger to work.

After pressing the button, the device status becomes as follows:

The only change compared to the initial state is that the trigger output has acquired a logical one state. It will maintain this state until the next press, then the output will go back to the logic zero state.

Schematic diagram

To switch the load, the trigger controls the field-effect transistor VT1 through the current-limiting resistor R3. Power supply for the circuit is 7-35V.

The device assembled on a breadboard looks like this:

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
VR1 Linear regulator

LM7805CT

1 To notepad
IC1 Trigger

CD4013B

1 To notepad
VT1 MOSFET transistor

IRFZ44R

1 To notepad
R1 Resistor

47 kOhm

1 To notepad
R2 Resistor

10 kOhm

1 To notepad
R3 Resistor

20 ohm

1 To notepad
C1 Electrolytic capacitor10uF 16V1