The idea of controlling lighting fixtures using touch switches is not new; similar switches or light switches were produced back in the last century. But the dimensions of such devices were significantly larger than standard ones, which caused problems during installation. It is also worth noting that the cost of the first touch switches was quite high; naturally, this did not contribute to their popularity. With the development of technology, the situation has changed radically, and today capacitive, infrared and remote switches are in stable demand.
Design and operating principle
Despite the variety of models of touch communicators, most of them have a standard design consisting of the following elements:
- Housing made of heat-resistant plastic (see A in Fig. 1). The dimensions of the structure allow installation in a typical mounting location of a conventional switch.
- Electronic unit (B), it includes a power adapter and a semiconductor switch control circuit.
- Board with capacitive sensors (C).
- The front panel (D), as a rule, is made of quartz glass; budget models may use other materials.
Fig. 1. Legrand six-key touch wall switch
Now we’ll tell you how such devices work. The electronic unit monitors the state of the sensor. When you touch a certain place on the front panel of the switch with your hand (it is marked accordingly), the capacitance of the sensor changes. The electronic unit detects this and changes the state of the contactless semiconductor switch, which opens or closes the electrical circuit.
Practical Considerations
Although all the above conditions are compelling, there are some practical limitations to obtaining such results.
During shutdown state
An ideal transistor has V CE = V CC and IC = 0.
But in practice, less leakage current flows through the collector.
Therefore, IC will be several µA.
This is called collector leakage current,
which, of course, is negligible.
During saturation state
An ideal transistor has V CE = 0 and IC = IC(sb).
But in practice V CE is reduced to some value called knee voltage
.
When V CE decreases more than the knee stress, β decreases sharply.
Since IC = βI B, this reduces the collector current.
Therefore, that maximum current IC that maintains V CE at knee voltage is known as the saturation collector current
.
Saturation collector current = IC(sat)= fracVCC−VkneeRC
A transistor which is made only to operate for switching purposes is called a switching transistor
.
This works either in saturation or in the clipped area. In the saturation state, the collector saturation current
flows through the load, and in the shutdown state,
the collector leakage current
flows through the load.
Scope of application
Initially, this type of switch was planned to be used to turn on/off lighting, but the design turned out to be so successful that the scope of its application has expanded significantly. Today, most modern household appliances have touch controls; examples include kitchen stoves, hoods, microwaves, etc.
Kitchen hood Cata Midas 900
The only limitation on connecting to touch switches is the power of the equipment; its permissible parameters are indicated in the device passport.
Additional functionality
Modern technical base has made it possible to install microcontrollers in the electronic control unit of a touch switch, which has significantly expanded the functionality of switches and allowed them to fit into the concept of a smart home. Such switches can be controlled by voice, infrared or radio remote control, smartphone via WI-FI or a programmable timer.
The touch switch can be connected to the smart home system and controlled using a mobile phone
Touch switches can be used in conjunction with sensors that respond to motion or light levels. In the first case, such devices turn on a lamp, table lamp or other lighting fixtures when someone enters a room, such as a bathroom. With the second implementation option, the light will turn on at a low light level.
Sesoo triple touch switch and motion sensors
Some manufacturers, for example, Livolо, produce touch switches with a dimmer function or that control combined sockets, to which almost any household appliance can be connected.
Livolo touch switch with socket block
Advantages of capacitive switches
Speaking about the advantages of this type of switches, the following qualities should be noted:
- Long service life. This is greatly facilitated by the absence of moving parts and contact groups.
- Compatible with all types of lighting fixtures. Models with dimming are available for LED strips and energy-saving lamps, if they have such an option. In addition, switching of any circuits that meet the operating conditions of the switches is allowed
- Availability of additional functions.
- Possibility of integration into the Smart Home system.
- Large selection of colors and designs.
Switches “Hares” model range Kopou - No mechanical contacts.
- The touch sensor can be installed in a standard “glass” for a hidden wiring switch.
Now briefly about the shortcomings. First of all, it is necessary to note the difference in cost with conventional mechanical switches, but it has become significantly less than 10-20 years ago. The price of inexpensive Chinese touchscreen models today is much cheaper than mechanical switches from well-known brands, such as GTS or Electronics.
Sometimes LED lamps connected to touch switches flicker. This may be due to both the low quality of the lighting sources themselves and the low-cost switch models. The problem can be resolved in two ways:
- Use products from well-known brands (Jazzway, Panasonic, Sapphire, Funry, LightaLight, Tronic, Sesso, etc.).
- Connect a 0.1 uF 630 V capacitor in parallel with the LED lamp.
How to solder field-effect transistors correctly and safely: 5 tips
I recommend that beginners pay close attention to this issue. Then you will not be disappointed with the work done.
Where is the ambush hidden or why is static dangerous for electronics?
In everyday life, we rarely feel static electricity, for example, when combing our hair with a plastic comb, getting out of the car after a trip, or in some other cases.
Usually, static causes minor troubles to our body that are simply annoying. But with semiconductors things are different.
MOSFETs have a very thin layer of insulation between the gate and the channel material. It forms a capacitive coupling between gate-source and gate-drain. Moreover, the dielectric itself creates this effect, working as a capacitance.
We know that any capacitor is manufactured to operate at a certain voltage. If it is exceeded, an insulation breakdown occurs. Ten volts are usually enough to damage the oxide film of the field grass, and sometimes less.
Now I’m showing with photographs what dangers we can create for transistors with our own hands if we don’t follow the rules for soldering them.
I took my favorite Moment transformer soldering iron, plugged its power cord into the outlet, but did not press the power button. I placed one end of the multimeter wire through an alligator clip onto the sting, and the other just leaned it against my finger. Set the AC voltmeter mode.
The device shows 28 volts. This is the kind of interference that is created even when the transformer is de-energized.
I continue the experiment. I left the black probe in the same place, and leaned the red one against the dielectric surface of the stool, where all the instruments are located.
Almost 6.4 volts. When I separated the red probe with air space, the reading became 8 volts.
But these are completely random measurements, the results of which depend on many factors, which means: the voltage can be significantly more or less.
We may not even feel this static, but its random discharge can burn out the thin semiconductor junction of the crystal.
To prevent this, it is important to follow the mandatory recommendations.
How to avoid hidden dangers and work safely with a soldering iron: 5 recommendations
Tip #1: Bypassing the leads
Damage to semiconductor junctions during storage and operation can be prevented by keeping microcircuits, transistors, and integrated electronics products in a layer of foil.
A similar result, in particular, is obtained if you wrap the contacts of their terminals with thin copper wire without insulation.
Tip #2: removing static from operating equipment
It is best to work with a professional soldering station with a grounded tip. If it is not there, then ground the soldering iron tip and the circuit board with separate conductors. Shunt the transistor leads with a thin wire, which will be removed after soldering.
A grounding bracelet on your hand or other part of the body allows you to remove the dangerous potential of static from tweezers and the tool you will be working with. Its 1 MΩ resistance eliminates the possibility of dangerous static discharge.
Tip No. 3: preparing the workplace
The dry air of northern latitudes, especially in winter, contributes to the accumulation of static on surrounding objects. Humidifiers and air washes successfully combat this phenomenon.
An antistatic mat immediately and reliably removes static potentials and the effects of electrical noise from the environment.
Tip #4: professional mixtures
A special flux of the FluxOff brand not only perfectly washes away rosin and traces of corrosion, but actually removes static. They just need to wet the board.
Tip #5: Quick soldering
Choose the minimum required soldering iron power, but work quickly with it. Experienced repairmen manage to heat up the tip, take solder with it, turn off the power to the soldering iron and then solder the part in place.
Some modern microcircuits and transistors are protected against static, but this does not eliminate the need to follow the rules of safe soldering with all other products.
Connection
The installation of touch switches is practically no different from the installation of conventional built-in and surface-mounted mechanical switches. You can read more about this process on the pages of our website. Let us remind you how to do this using the example of the kg020gs model from the manufacturer FD Electronics.
Connection algorithm:
- Remove the glass panel (see A, Fig. 7). This can be done conveniently using a thin slotted screwdriver.
- We connect the installation wires (B in Fig. 7), according to the diagram given in the passport.
Figure 7. First and second connection stages - We screw the board with touch contacts (A Fig. 8).
- We connect the panel with the button marking (B in Fig. 8).
Figure 8. Second and third stages of connection
Some manufacturers, for example, Livolo, produce pass-through switches for 220 V (their connection diagram is shown in Fig. 9). With their help, you can control lighting from several places.
Figure 9. A clear example of how to connect several pass-through touch contact panels
Each of these switches controls the lighting in the room from different locations. The concept involves using a main switch and one auxiliary (or more). On the main devices there are three terminals, the phase is connected to one, the zero is connected to the other, and the control conductor is connected to the third. Accordingly, such contacts are marked as: L – phase, N – zero and Com – control wire. Assistive devices
Secondary switches are connected through two terminals: N – zero and Com – control contact. Labeling may vary from manufacturer to manufacturer, so it makes sense to study the instructions. An example is the connection diagram for the electronic dimmer et0802193e, or its analogue tt6061a, which can be controlled with a light touch of your hand.
Touch dimmer connection diagram et0802193e
Important Pages
- GyverKIT kit - a large Arduino starter kit of my design, sold in Russia
- Catalog of links to cheap Arduins, sensors, modules and other hardware from AliExpress from trusted sellers
- A selection of libraries for Arduino, the most interesting and useful, official and not so
- Complete documentation on the Arduino language, all built-in functions and macros, all available data types
- A collection of useful algorithms for writing sketches: code structure, timers, filters, data parsing
- Video lessons on Arduino programming from the “Arduino Engineer's Notes ” channel are some of the most detailed in RuNet
- Support the author for his work on the lessons
- Feedback - report an error in the lesson or suggest an addition to the text ( [email protected] )
4.8 / 5 ( 25 votes)
Selecting a touch light switch
Before purchasing a device, you need to determine its functionality. To do this, the following criteria must be taken into account:
- Power of connected equipment and its connection diagram.
- Execution corresponding to the type of wiring.
- Operating conditions (if installation is planned in the bathroom, then a device with moisture protection is selected).
- Possibility of remote control (remote control or smartphone).
- Compliance of the design with the interior of the room, etc.
Having decided on the main tasks, you can begin to select a manufacturer. Naturally, you should give preference to well-known brands whose products are reliable. But at the same time, it is necessary to take into account the presence in the model range of switches of devices with the necessary functions. For example, Delumo has devices controlled by a radio remote control, and Sonoff specializes in Wi-Fi devices, Capsens Domuns Line lamps are “tailored” only for their touch switches, etc. There can be many nuances, so we recommend that you study the various options in detail.
Based on practical experience, in addition to well-known brands such as Legrand, we can recommend Vento Electric, Wemmon, Fanri, Merten, CGSS, Steu, Schneider, Ariston, etc.
MakeGood Classic wireless touch switch with remote control and backlight
We recommend monitoring online reviews where ratings of the best manufacturers are published. Selection criteria are made both by the model range of manufacturers, taking into account functionality and cost, and by other indicators.
Refinement of standard devices
Many people are not happy that the touch zone on the panel is quite small, and to record a signal you need to touch it in the indicated place. Let's give an example of how you can increase the area of indirect surface contact.
Increasing the sensor sensitivity area
You should take the wire and carefully solder it to the place where the signal is supplied from the sensor on the touch board (for this you need to study the circuit diagram of the device). The connected wire is laid around the perimeter of the housing. As a result, such a frame will make it possible to trigger the sensor when touching the front panel without amplifying the signal level.
It should be noted that such an improvement will void the manufacturer's warranty.
DIY touch switch
For those who like to work with a soldering iron, we can recommend several circuits of touch switches that will be easy to assemble with your own hands. Let's start with a simple field-effect transistor circuit, this is exactly the principle that was laid down in the first sensor devices.
Touch switch on a field-effect transistor
Designations:
- Resistances: R1 - 10..15 kOhm (must be selected for sensor response), R2 - 3...5 MOhm.
- Capacitors: C1 – 1000 pF (suppresses false triggering), C2 – 33.0 µF x 50 volts, C3 – 470 µF x 50 V.
- Transistor VT1 – KP 501A.
- Relay K1 can be used of any type whose operating current does not exceed 150.0 mA.
The circuit is powered from a source with a voltage of 12…24 V.
Now let's look at an option based on the NE555 asynchronous RS trigger. The device diagram is shown below.
Touch switch on NE555 chip
Designations:
- Resistors: R1 – 1.0 MOhm, R2 – 1.0 MOhm, R3 – 1.0 kOhm.
- Capacitors: C1 and C2 – 15 nF, C3 – 10 nF, C4 – 0.1 µF, C5 – 100.0 µF x 25 V.
- Diodes: D1-D2 – 1N4001, D3 – standard indicator LED.
- Microcircuit - NE555,
- The relay is the same as in the previous electrical circuit.
The above diagram does not need to be configured.
Concluding the topic of homemade sensor devices, we should mention the Ardunio system. On this platform, you can assemble a switching device that can be easily integrated into a Smart Home. In addition, such a device can be easily configured to operate independently, in accordance with a given program.
Compact touch sensor for the Ardunio system
In addition, the system allows you to create several profiles for specific tasks. However, this will require programming skills. You can get more detailed information about the Ardunio platform on our website.
Note that in the above circuits, a power source with a voltage of 12-24 V is required to power the control circuit. For this purpose, it is best to use switching power supplies. The electronic balance of LED and energy-saving lamps is ideal as such. Detailed information on this topic can also be found on our website.
Alternating current
Triac as on/off
A triac is a radio element similar to a transistor, but can operate on alternating current. High voltage is a dangerous thing, so an optocoupler with a triac output is used to control the triac. The simplest connection diagram looks like this:
To control the load only in on/off mode, it is advisable to install an optocoupler with a zero detector (for example MOC306x ), it will automatically turn off and turn on the load only when the voltage in the network passes through 0, which greatly reduces interference in the network. There are also resistors here: 220 Ohm - to limit the current to the optocoupler LED (see the characteristics of the optocoupler, I wrote above how to select a resistor). And a resistor between the optocoupler and the triac: 220-470 Ohm with a power of 1-2 W (it will heat up). The triac should be taken with a good current reserve so that it heats up less. Also, triacs come in the BTA and BTB ; the BTA case (metal part) is insulated and it is recommended to take them so as not to be shocked by current from the radiator. Component pinout:
The Chinese have ready-made modules with a triac and all the wiring. By the way, yes, the triac heats up under load! The presence of a radiator is mandatory, starting from 200 Watt.
Triac as a dimmer
To smoothly control an AC load, the task becomes much more complicated: you need to catch the moment the voltage switches, measure the time and turn off the triac, cutting off part of the sinusoid; this is called phase control.
This circuit requires an optocoupler without a zero detector, such as the MOC302x series . The diagram of such a craft might look like this:
51k resistors are necessarily powerful, since 1 Watt will be allocated to them: we extinguish the excess voltage so as not to burn out the LED of the optocoupler of the zero detector. You can also buy a ready-made module on Ali. It looks like this and has power pins, a triac control pin and a zero detector output. How to work with all this - watch the video below:
Somewhere there is a Chinese library for managing such a module, but I didn’t really like it. I give two examples for manual control of such a dimmer based on the GyverTimers library: single-channel and multi-channel. In multi-channel mode, it is enough to connect the zero detector output from only one module to the Arduino, but indicate the control pins in the sketch. The examples discussed below can be slightly optimized by replacing digitalWrite() with a fast analogue.
Single channel is NOT smooth
// example of a dimmer on a triac with an external zero detector // or a ready-made Chinese module https://ali.ski/yGU73N // single-channel dimmer without a timer, works by skipping // half-waves of a sine wave based on interruptions from the zero detector // suitable for motors and heaters, lamps flicker terribly! // Bresenham algorithm https://habr.com/ru/post/254719/ // dimmer takes values 0-255 // switchings are optimized #define ZERO_PIN 2 // zero detector pin #define INT_NUM 0 // corresponding interrupt number # define DIMMER_PIN 4 // triac control pin int dimmer; // dimmer variable void setup() { pinMode(ZERO_PIN, INPUT_PULLUP); pinMode(DIMMER_PIN, OUTPUT); digitalWrite(DIMMER_PIN, LOW); attachInterrupt(INT_NUM, isr, FALLING); // for a homemade circuit, set it to RISING! } void loop() { // set the value 0-255 dimmer = map(analogRead(A0), 0, 1023, 0, 255); delay(100); // in real code there should be no delays } // zero detector interrupt void isr() { static byte count, last, lastVal; int val = ((uint16_t)++count * dimmer) >> 8; if (lastVal != (val != last)) digitalWrite(DIMMER_PIN, val != last); lastVal = (val != last); last = val; }
Multichannel is NOT smooth
// example of a dimmer on a triac with an external zero detector // or a ready-made Chinese module https://ali.ski/yGU73N // multi-channel dimmer without a timer, works by skipping // half-waves of a sine wave based on interruptions from the zero detector // suitable for motors and heaters, lamps flicker terribly! // Bresenham algorithm https://habr.com/ru/post/254719/ // dimmer takes values 0-255 // on-off are optimized #define ZERO_PIN 2 // zero detector pin #define INT_NUM 0 // corresponding interrupt number #define DIM_AMOUNT 3 // number of dimmers const byte dimPins[] = {3, 4, 5}; // their pins int dimmer[DIM_AMOUNT]; // dimmer variable void setup() { pinMode(ZERO_PIN, INPUT_PULLUP); for (byte i = 0; i < DIM_AMOUNT; i++) pinMode(dimPins , OUTPUT); attachInterrupt(INT_NUM, isr, FALLING); // for a homemade circuit, set it to RISING! } void loop() { // set the value 0-255 dimmer[0] = 50; dimmer[1] = 120; dimmer[2] = 190; delay(100); // in real code there should be no delays } // zero detector interrupt void isr() { static byte count, last[DIM_AMOUNT], lastState[DIM_AMOUNT]; count++; for (byte i = 0; i < DIM_AMOUNT; i++) { int val = ((uint16_t)++count * dimmer) >> 8; if (lastState != (val != last )) digitalWrite(dimPins , val != last ); lastState = (val != last ); last = val; } }
Single channel smooth
// example of a dimmer on a triac with an external zero detector // or a ready-made Chinese module https://ali.ski/yGU73N // the GyverTimers library is used (minimum version 1.5) // by analogy you can make a dimmer on any Arduino timer // including among any of the 6 timers for Mega // setPeriod call is optimized #define ZERO_PIN 2 // zero detector pin #define INT_NUM 0 // corresponding interrupt number #define DIMMER_PIN 4 // triac control pin #include // timer library int dimmer ; // dimmer variable void setup() { pinMode(ZERO_PIN, INPUT_PULLUP); pinMode(DIMMER_PIN, OUTPUT); attachInterrupt(INT_NUM, isr, RISING); // for a homemade circuit, set FALLING Timer2.enableISR(); } void loop() { // set the value 500-9300, where 500 is the maximum power, 9300 is the minimum!!! // and 500-7600 for 60 Hz on the network dimmer = map(analogRead(A0), 0, 1024, 500, 9300); delay(100); // in real code there should be no delays } // interrupting the zero detector void isr() { static int lastDim; digitalWrite(DIMMER_PIN, 0); // turn off the triac // if the value has changed, set a new period // if not, then simply restart with the old one if (lastDim != dimmer) Timer2.setPeriod(lastDim = dimmer); else Timer2.restart(); } // timer interrupt ISR(TIMER2_A) { digitalWrite(DIMMER_PIN, 1); // turn on the triac Timer2.stop(); // stop the timer }
Multi-channel smooth
// example of a dimmer on a triac with an external zero detector // or a ready-made Chinese module https://ali.ski/yGU73N // the GyverTimers library is used (minimum version 1.5) // by analogy you can make a dimmer on any Arduino timer // including any of the 6 timers for Mega // multi-channel dimmer. Here is an example with a resolution of 256 (values 0-255) #define ZERO_PIN 2 // zero detector pin #define INT_NUM 0 // corresponding interrupt number #define DIM_AMOUNT 3 // number of dimmers const byte dimPins[] = {3, 4, 5 }; // their pins #include // timer library int dimmer[DIM_AMOUNT]; // dimmer variable volatile int counter = 0; // loop counter void setup() { pinMode(ZERO_PIN, INPUT_PULLUP); for (byte i = 0; i < DIM_AMOUNT; i++) pinMode(dimPins , OUTPUT); attachInterrupt(INT_NUM, isr, FALLING); // for a homemade circuit, set it to RISING Timer2.enableISR(); // 37 µs - interrupt period for 255 steps and 50 Hz // for 60 Hz set the number 31 Timer2.setPeriod(37); Serial.begin(9600); } void loop() { // set the value //dimmer[0] = map(analogRead(A0), 0, 1023, 0, 9500); dimmer[0] = 50; dimmer[1] = 120; dimmer[2] = 190; delay(100); // in real code there should be no delays } // interrupting the zero detector void isr() { counter = 255; Timer2.restart(); } // timer interrupt ISR(TIMER2_A) { for (byte i = 0; i < DIM_AMOUNT; i++) { if (counter == dimmer ) digitalWrite(dimPins , 1); // enable on the current tick else if (counter == dimmer - 1) digitalWrite(dimPins , 0); // turn off next time } counter—; }
Update! I wrapped these algorithms in a class, the GyverDimmer . See description and examples on GitHub.
Solid State Relay (SSR AC)
An AC solid state relay (buy SSR AC) looks and connects exactly the same as a DC solid state relay. The only difference is that there is no polarity:
Compared to an electromagnetic relay, it operates silently and also has an unlimited switching life. But there is also a minus: solid-state relays are based on semiconductor triacs and heat up under load. The lower part of the case is a thick aluminum plate. For heavy loads (several kilowatts), it is advisable to take an SSR with a good current reserve and/or mount it on a radiator. That's it. There are also solid state bodies of a slightly different format in the form of Arduino modules:
Such modules come in low and high level (High/Low level trigger) and are connected in the same way as relay modules: to the GND-VCC power supply and a separate control pin. The SSRs themselves here are small and weak: only 2A (around 500 Watt). But for controlling lighting, for example, this is more than enough. Using a relay, you can smoothly control a highly inertial load, such as a large heater. To do this, you need to use an ultra-low-frequency PWM signal; I have a ready-made library.
Combined method
An electromagnetic relay and a triac (solid-state relay) have disadvantages when working with high currents, which cancel each other out:
- An electromagnetic relay does not work well at the moment of closing and opening the load, because the contacts physically wear out and can generally stick. At the same time, it does not heat up during the flow of high current.
- The triac closes a powerful circuit without problems, sparks or wear, but gets very hot when current flows.
There is a great idea for combining these two devices to switch powerful circuits: a triac (or SSR) is placed in parallel with an electromagnetic relay. First, the circuit is closed by a triac, then after a few milliseconds the relay is closed. That's it, the triac can be turned off, the current will flow through the relay. To disconnect the load, we activate the triac again, turn off the EM relay, and after a few milliseconds turn off the triac. Bingo! If the switching is controlled by a microcontroller, implementing such a circuit is like calling two pins =) You can read about the implementation of an analog circuit (without an MK) on Habré.
Smooth Control (SSR LA)
There is another option for smooth control of an AC load: a solid state relay with built-in phase control and current input, it is called SSR LA. You need to take a relay with an input resistance of around 250 Ohms, so that you can apply 0-5 Volts to it and get the coveted 0-20 mA. I bought these and they work great. To supply 0-5 Volts from Arduino we need a PWM and RC circuit (link to the simulation project in EasyEDA), in the diagram it will look like this:
// Simple example, in which a potentiometer is also connected to A0 void setup() { pinMode(3, OUTPUT); // https://alexgyver.ru/lessons/pwm-overclock/ // Pins D3 and D11 - 8 kHz TCCR2B = 0b00000010; // x8 TCCR2A = 0b00000011; // fast pwm } void loop() { analogWrite(3, analogRead(0) / 4); delay(10); }
Briefly about security
When connecting touch control of lighting sources, you should adhere to the same rules and regulations as prescribed for mechanical switches. That is, before starting work, it is necessary to de-energize the line where the installation will be carried out. Further, we adhere to the following standards:
- The switches must be connected to the network in such a way that phase switching is carried out, not zero.
- If the power supply uses a ground wire, it must be connected to the appropriate terminal.
- If stranded wire is used for installation, its ends must be crimped or tinned. Otherwise, contact may be broken, which will lead to heating of the connection.
- Do not use a touch switch with obvious signs of a violation of the integrity of the structure.
- The load must match the parameters of the switch.