Light control via wifi. SONOFF LED is a smart LED driver with WiFi control. Chinese lighting control systems

Light control via wifi. SONOFF LED is a smart LED driver with WiFi control. Chinese lighting control systems

We live in an age of progress and high technology. Today, every home has a computer, as well as a bunch of mobile devices, such as tablets, smartphones, netbooks, transformers (netbooks with a removable touch screen or tablets with docking stations) and so on. It is not surprising that many people now have the ability to control light via Wi-Fi. Moreover, you can control not only the light, but also other electrical appliances. Such installations are called “Smart Home” and have been known since the early 2000s, but have become widespread among ordinary users only in our days.

Some general information

It’s worth noting right away that to control light or any other electrical appliance we will need a special station or relay. They come in different types, with different functional abilities, as well as sets of capabilities. For example, the cheapest devices have the form of an outlet with a remote control. That is, you insert the “Wireless socket” into a regular socket (to connect to the power supply). In a wireless device, you turn on, for example, a lamp and using the remote control you can turn the light off or on. Everything is very, very simple.

But there are more expensive and advanced gadgets that allow you to control household appliances through special applications on tablets and smartphones. In this case, the connection can occur both on a local network and via the Internet. As you understand, it is simply impossible to describe everything in one article, so we will analyze only two types of Smart Home devices.

Wireless outlet

The word “wireless” here means that you can connect to it via Wi-Fi and control its operation. Let's look at how such gadgets work, using the example of a device from Edup. This is a Chinese company, but produces quite high-quality products.

So, how to use this socket:

  1. We connect the device to the power supply (to a regular outlet).
  2. There is a button on the top of the device. Press and hold it until the Wi-Fi indicator starts blinking (if you hold the button but another icon is constantly blinking, then release the button and press briefly again). Thus, we switched the device to search mode for Wi-Fi networks in order to bind to the router.

Now let's move on to the tablet or smartphone (with the help of which remote control will take place). In our case, the application is called Edup Wi-Fi. After installing the application on your tablet, you will have to register.

After that, log into the application using your login. But now there will not be a single device in it: the fact is that you need to add equipment manually, so we exit the application.

Now open the settings of your smartphone (tablet) and go to the “Wi-Fi” section. Turn on the adapter. When the system offers a list of devices available for connection, find your “wireless” outlet and connect to it. The connection we need is called “Wifino1”. After we have connected to the device, we return to the Edup WiFi application.

Here you need to click the “Settings” button, which is located at the very bottom of the screen on the right. Next, click “Initialize Device”. Information about the connected device will be displayed at the top: MAC address and name.

Below you will need to enter the name of your Wi-Fi network in the SSID field. You must enter exactly as indicated in the router, with all symbols, uppercase or lowercase letters, and so on. The name must match absolutely. And, accordingly, enter the password for your Wi-Fi network.

After this, press the “Start” button. The phone will begin sending the necessary commands to the Wi-Fi outlet. All you have to do is wait for the pairing to be completed. When this happens, the indicator on the outlet itself, which was previously blinking, will stop blinking and will remain constantly on.

Now, when you log into the Edup WiFi app again, the “Devices” section will show your wireless socket connected to the router. Opposite the name there will be a button, when clicked, the device will turn on or off. As you can see, controlling your household appliances via Wi-Fi is a fairly simple and fast process.

It is worth noting that you can plug any household appliance into the outlet. The main thing is that its power does not exceed the rated power of the gadget. Also, the application with which the device is controlled is quite slow. That is, it is still being finalized and improved, so you may experience some difficulties when logging into your registered account, as well as in working with the program.

The second gadget that will allow you to control the lights in your home via Wi-Fi is a relay. This equipment is more powerful and can withstand higher loads. In this case, everything works directly. That is, the relay itself distributes Wi-Fi, to which you need to connect and then launch the corresponding application and control the operation of the relay in the program.

You don't need to make any special settings. The relay is supplied with setup instructions and a disk with the necessary software. In fact, a relay is practically no different from a socket. But if you can control the outlet via the Internet, the relay requires a direct connection via Wi-Fi or Bluetooth.

There are other options for “Smart Homes” with which you can set up control of all household electrical appliances at once. But the cost of such equipment will be appropriate and affordable to few people.

How to protect your Wi-Fi network: Video

Despite the presence on the market of a fairly large number of companies engaged in systems such as “Smart Home”, most of them require deep integration into the existing electrical system of your apartment, house or office. The prices for such devices from renowned manufacturers are also not encouraging; in particularly advanced cases, you will have to part with a four-digit sum for remote lighting control alone. And I’m not talking about rubles or hryvnias.

But in the last few years the situation has begun to change dramatically. One after another, companies are born that offer home automation systems with good functionality at affordable prices. The company " ", which has been producing lighting control devices since 1997, provided me with its Mini Kit “Smart Home in 1 Hour” for review, which I will try to talk about today in the most accessible form. Looking ahead and in order to avoid premature comments, I will say that the set from the Belarusian company will not turn your home into a truly “smart” one, but at least it will allow you to get one step closer to this goal.

The text may and most likely does contain grammatical, spelling, punctuation and other types of errors, including semantic ones. I strongly encourage readers to point out these errors and correct me through private messages.

▌About the company’s products and the reviewed set


Now Nootekhnika sells two kits for self-installation: Mini and Maxi Kit. The latter is distinguished by the ability to manage a larger number of load groups and is equipped with additional temperature/humidity and motion sensors. I received a Mini Kit and it consists of:

The red wire extending outside the housing is a jumper that determines the operating mode of the unit. Initially, the unit operates in relay mode, i.e. simply turns the load on and off. Breaking this connection puts the device into dimming mode, which makes it possible to regulate the power of the corresponding devices (incandescent lamps, heaters, fans, etc.).

Blocks of the “SU” type have appeared on sale quite recently; before that, dimmable (SN, ST) and “relay” (SL) blocks were sold as separate devices. There are only 5 models in the SU series, which differ in maximum switching power: 0.2, 0.3, 0.5, 3, 5 kW. There are also modules included in the phase break (SB series), waterproof blocks for outdoor use (SR series) and an LED strip controller (SD series). The catalog of power units with prices can be viewed on the official website of Nootekhnika, where all existing models and the SU111 series of units are also available.

Switches (radio transmitters)
The delivery set includes two remote controls: PU311-2 and PU313-2. The company has a great variety of remote controls, although in fact there are only 3 structurally different versions plus a remote control key fob. The PU series has two revisions, which are designated by the prefix “1” and “2” at the end of the name. These are switches with touch keys in white or beige and they differ primarily in the functionality of the keys themselves (they are not universal, despite the fact that they are touch sensitive).

The working area of ​​the remote control is matte to the touch, and the frame, which is its basis, is made of glossy plastic. In the upper left corner there is an indication LED, which is activated each time one of the buttons is pressed.

The remote control runs on CR2032 batteries. The guaranteed battery life of the remote controls is 1 year, but in reality it should be much longer. On the company's official website, when using the remote control 48 times a day (with a standard battery capacity of 210-240 mAh), the remote control will last for 3.8 years, taking into account the self-discharge of the battery. 1 year guaranteed, because the maximum declared range (50 meters) is maintained in the first 1-1.5 years of operation. As such, the remote control does not have a low battery indicator; in the future, it will be possible to determine a low battery by the dimly lit indicator at the moment the command is transmitted.

Remote controls come in one-, two- and three-channel types. An unlimited number of power units can be assigned to each channel. The main thing here is not to get confused, since only up to 32 remote controls can be linked to the blocks. The maximum operating range in open space is 50 meters. I experimented with the range and this is what I can say: the unit receives and executes commands at the stated distance, provided there is direct visibility to the window of the room in which it is installed. With reinforced concrete floors, everything is a little more complicated: in the entrance of a panel high-rise building, the block is enough for 2-3 floors, and the signal no longer passes through. Within the apartment, of course, there are no problems.

The third version of the remote control that I mentioned at the beginning is this. There is no switch as such in this case, there is only a transmitter unit for connecting to return (push-button) switches. Here is the tactile response desired by many and the ability to use switches of any design you like. The remote control, the variety of wall switches and their cost can be seen at.

Ethernet gateway
It is included in the local network and acts as an intermediary between the nooLite system and computers or mobile devices. It looks like a small black box with an external antenna. The package includes a power supply and a patch cord for connecting it to a router or modem.

An album with additional photos, including pictures taken during the preparation process, is located at.

The Ethernet gateway does not have direct access to the Internet and operates on a local network. It also does not know how to request a DHCP address and is only available via 192.168.0.168, which can be changed to something else during subsequent configuration. I cannot help but note that an ordinary user may have problems connecting this device, especially if this static address is already used by someone on the subnet. But I'll tell you about this later.

Motion sensor PM111
It was purchased separately in order to equip one of the rooms with automatic lighting control. In size it is identical to the wall switches included in the Mini Kit, and in its functions it is completely reminiscent of them, because simply sends an on and subsequent off command to a pre-bound power unit.

An album with additional photos, including pictures taken during the preparation process, is located at.

PM111 is powered by two AAA batteries (included), and their charge should be enough for at least a year of operation. When the charge level is critical, the LED located under the thermal sensor lens will notify you with three short flashes repeated every 8 seconds. On the rear panel there are three trimming resistors for setting: the response threshold depending on the illumination (1 ... 100 lumens), the shutdown time after operation (5 s ... 21.8 minutes) and the sensitivity of the sensor. Parallel operation with any nooLite remote control is supported. For reference: sensor in and its.

▌Installation and configuration using the example of your own home

The most interesting thing is the installation. I am a little afraid of electricians, despite the fact that I am friends with electronics. For reasons unknown to me, she has a grudge against me and, as soon as the opportunity arises, she tries to show her superiority. This time there were no incidents, the kit can actually be installed in an hour if you plan and prepare everything in advance.

I will demonstrate the installation using the example of the apartment in which I currently live. This is a rental property, the owner of which agreed to install the system and my subsequent “entertainment” with the apartment, provided that everything returns to its place upon moving out. We have an unremarkable one-room apartment in a panel house with the following lighting scheme:


The model was created in the program. Ceiling chandeliers were replaced with lamps for clarity

Even before receiving the kit, it was decided to purchase a motion sensor and an additional power unit, since one of the lighting sources would be deprived of control if the Mini Kit was used in its “pure” form. The application scheme ultimately took the following form:

By default, instead of the fourth block, block No. 3 is assigned to the third channel of the remote control, but for experimental purposes it was decided to swap them. The process of binding/unbinding is quite simple and is described both in a separate and in a full-fledged one for the entire system. The second and third channels of the remote controls control the light in the bathroom and corridor, which is essentially a clear example of the implementation of a pass-through switch, only without wires.

I started connecting the power units from the living room, having previously de-energized that part of the apartment’s electrical network that is responsible for lighting. Additionally, I recommend getting an indicator screwdriver (if you don’t already have one) to check for the absence of potential on the lines you are going to work with. The process of dismantling the chandelier did not cause any difficulties, but the obscenely twisted wires, although not surprising, still left a certain residue.

An album with additional photos, including pictures taken during the preparation process, is located at.

Two white wires coming from the block are connected to the mains, and two black wires are connected to the subsequent load. For connection, the kit includes a set of 12 WAGO lever terminals. If you are still twisting, then stop immediately, I advise you to at least read on Geektimes and the comments to it (there is valuable information on another such article).

Both single- and stranded copper wires can be clamped into the VAG terminals. I learned this fact already in the process of writing the article, so the multi-core wires from the chandelier were pre-tinned. I cleaned the conductors sticking out of the ceiling in order to remove the oxides that had formed on them.

The block did not fit into the chandelier bowl, so it was left outside. If there was a neutral wire in the wiring box of the old switch, then it would be possible to place the block there or be a power block in the set. The unit's antenna (white wire) must not be cut, twisted or hidden in metal bowls to avoid shielding.

In the kitchen, the block also did not fit into the plastic cover of the “chandelier”. Yes, in quotes, because it’s just a wire with a socket on which a huge white cap used to be put on, absorbing a huge part of the light flux. It's time to lobby for the purchase of normal lamps. Similar steps were taken to install power units in the bathroom and hallway.

For absolutely all points, 300-watt units are redundant since I use 20-watt fluorescent energy-saving lamps. In the living room, the total power consumption is 60 W. Even taking into account the manufacturer’s recommended twofold power reserve (especially when placed in places where air convection is difficult), such units are still redundant. With incandescent lamps comparable in luminous flux to the energy-saving lamps I installed, the situation would be diametrically opposite. Most likely it will not fail, but it will feel very “hot”.

Installing switches is much simpler than connecting power units. They can be placed any way and anywhere, with the exception of mounting on metal surfaces. By default, the mounting panel involves installation using self-tapping screws or pre-applied strips of tape.

We remove the old switch and, using the same WAGO terminals, close the wires as if the switch was always on. As it turned out, the mounting box in the case of this switch was simply missing and the latter was inserted stupidly (precisely stupidly) into the drywall slot.


Yes, the yellow-green wire is the phase for connecting the corridor lamp. It's sad, isn't it?

The original strips of tape are too small for the resulting hole, so I used my favorite foam double-sided adhesive tape. Now I’m afraid that during subsequent dismantling I will tear off the mounting frame with a piece of plasterboard wall.

An album with additional photos, including pictures taken during the preparation process, is located at.

That's it, one switch is installed and ready to use. With the second one, I was rushing around the room for a while, deciding where to place it - by the bed or in the same place near the sofa. In the photo below, during the experiments, it was installed along with a stationary switch, which was later completely dismantled.

But the remote control by the bed is also convenient, despite the ability to control the light from a watch or smartphone. Therefore, the purchase and installation of it is just around the corner. At the moment, the lighting control scheme looks like this:

Where B are blocks, P are remote controls, and D is a motion sensor. The latter, similar to remote controls, can be attached to self-tapping screws or double-sided tape. To begin with, a small piece of adhesive tape will be enough, since you will most likely have to play around with the placement of the sensor. At the maximum set sensitivity, its viewing angle, determined experimentally, reaches 120-130 degrees, and the operating range completely covers my kitchen (2.5 x 2.5 meters). After some experimentation, the sensor was placed on one of the kitchen drawers so that it would not be affected by local cooking lighting or hood lights above the stove.


Currently the sensor is located on the right side of the handle

The sensor is triggered instantly, but there is still a slight delay due to the fluorescent lamp - it does not turn on immediately. I set the shutdown time to about 10 minutes. The sensor, it seems, should check for motion before sending a shutdown command to the unit, but I either freeze at these moments, or the sensor simply does not notice me. As a result, the light goes out and you have to wait 4-5 seconds to check for movement again. The light threshold was set to 30% of the state when the sensor is constantly on and tracking movements. At this level, operation occurs even on particularly cloudy winter days, which is what I was trying to achieve.

Regarding the catch regarding this sensor that I mentioned earlier. Let's imagine that in addition to the sensor itself, the controlled unit is tied to a wall-mounted remote control for manual control of lighting in the kitchen, as in my case. Neither sensors nor remote controls have feedback, and if the light in the kitchen turns on as a result of a motion sensor, and you turn it off using the remote control or the web interface, which will be discussed later, the motion sensor will continue to think that the light was turned on with its help and will continue to count down the preset 10 minutes to send the light off command. Did you get the point? If you re-enter the kitchen after turning off the lights manually, the sensor will not work. Therefore, I disconnected this unit from all remote controls, including the “Turn everything off” scenario channel, since the motion sensor itself is capable of turning off the lights in the kitchen in the absence of movement.

Scenario channels are a no less interesting topic. In the Nootechniki catalog you can find both remote controls with one script key and with all three. Scenarios allow you to control an unlimited number of blocks (this is the basic ability of the remote control): turn them all off at the same time, turn on the corresponding block to a preset brightness or color level (for an LED strip), or turn on the required group of lamps. With one channel you can only perform one action, i.e. It is not possible to turn on and off a group of lamps with one key. More about the scripting capabilities is written in (chapter 6) on the entire nooLite system. In general, before purchasing, I recommend that you familiarize yourself with it - this will save you from most questions.

Ethernet gateway, control from mobile devices and Pebble watches
For now, I’ll only tell you about the basic capabilities of the gateway. Information about the API and its integration into other Smart Home systems deserves a separate article. When installing, the manufacturer recommends that the router and Ethernet gateway be separated by at least half a meter, because The Wi-Fi network signal interferes with the signal reception of temperature/humidity sensors. Of course, the younger set does not have the latter, but why not play it safe for the future?

Special thanks to the developers for the green indicator(!) LED, and not the eye-catching blue spotlight that Chinese manufacturers like to use (the Xiaomi standing next to it, despite the blue LED, is an exception).

The first connection to the local network was not successful. Firstly, my network is built on addresses like 192.168.1.x, which has already made the gateway impossible to operate. Okay, we transfer the subnet to 192.168.0.x, but nothing still happens, I can’t access the address 192.168.0.168. I assume that this address on the network is already occupied by some of the home devices and directly connect the gateway to the computer using a patch cord. I assign the computer the address 192.168.0.1 with a subnet mask of 255.255.255.0.

That's it, now you can go to the gateway and even play with turning the lighting on and off. First, I recommend updating to the current version of the software and changing the standard gateway address to the one allocated to it in the settings of your router. Detailed instructions for flashing are in - I don’t see the point in repeating myself again. There is already a third version of the software, but the second one is current and stable, while the gateway itself comes with the first version. Updating the web interface is separate from updating the software and is the second step in the overall update process. The firmware itself can be downloaded from the Nootekhniki website.

The main innovations of the second version are the authorization settings, which did not exist before (any person on the local network could control the lighting knowing only the gateway address), the “Dawn” and “Sunset” functions, which will be discussed later, and, in fact, the ability to “forward” the required port to access the gateway from the external network. To do this, you need to have an external static IP address (as a rule, you can order it from your provider, rent costs about $1-2 per month) and perform a set of simple manipulations with your router. Instructions on this topic are in the archive with the update files.

The main function of the gateway is mediation between devices on the local network and the radio lighting control system. The gateway, not surprisingly, copes with this task. The start page of the web interface displays blocks and preset scenarios previously associated with the gateway.

Inside the menu item responsible for a specific block there are two buttons and an improvised LED. In the case of dimmable blocks, a “slider” is added to the page to set the desired lighting level.

In addition to the “Turn everything off” scenario, there are “Morning” and “Evening” functions. All of them are independent and are not synchronized in any way with the scenario channels on the switches due to the absence of any feedback.

Writing a script is quite easy. You need to turn on, turn off or set to a certain power all the lamps that you want to use in the scenario and click the “Save” button. In this way, you can create any scenario, for example, “Watching a movie,” when the lights in the entire apartment turn off, and a sconce or something like that is activated near the bed at minimum power.

In addition to scenarios, it is possible to set 8 weekly timers (icon in the upper right corner) and use them in scenarios. Here you can recall the “Dawn” and “Sunset” functions added to the second version of the software. Using weekly timers, you can set, for example, that from Monday to Friday at 8 am the “Dawn” actions will be performed, as a result of which the selected group of lamps (scenario, in fact) is activated with a smooth increase in brightness. This mode will only work if dimmable lamps are used and power units are configured accordingly.

In principle, that’s all, this is where the basic capabilities for controlling lighting from the gateway via the web interface end. Information about connecting sensors and working with them is in the user manual, which I have already consulted.

In general, the interface does not look very good on computers with large monitors, because... originally designed for mobile devices. Applications for , and in turn are stripped-down versions of the web interface, because there are no opportunities to create timers, scripts, bind and unbind blocks, and much more. In the case of the Android client, slide switches are used to turn the load on or off. Already created scripts can be overwritten directly in the application.


After a whole month of using the system, I never used the web interface, simply because there was no need for it. Using a smartphone, I played with the light several times to demonstrate the system to friends, and a couple of times in bed when the clock was left on the table. Regarding watches, everything is completely different. I resorted to their help every time I forgot to turn off the light using the switch. Yes, in the future I will most likely add another remote control near the bed (for a girl, for example), but for now they can cope with this task quite well.

As for the application itself for Pebble, Vlad Zaitsev (vvzvlad) quite justified it when he talked about an excursion to the production of the Nootekhnika company. I subsequently got used to the logic of the application in just a couple of days, so I can still use it. There is also an app for Apple Watch, but I don't have an Apple Watch, so I won't show it to you.

▌Why do I (you) need this? Application of the nooLite system

Along with the solutions used in my apartment, I will show a few more examples of using this system.

1. A trivial opportunity to post switch anywhere in the room: near the computer, bed, near the sofa or even on the window. No wiring needed. It is enough to purchase a power unit with a double power reserve and any remote control you like. Read more about this.

2. Pass-through switch. most often used in corridors, where one switch is installed at the beginning of it, and the other at the end. A person who enters the corridor turns on the light using the first switch, and at the exit turns it off with the second switch. Have you calculated how many wires need to be laid in the wall? What if we add another switch?


One power unit and two switches completely solve this problem. In the case of a completed renovation, it will be even cheaper than re-drilling the walls.

3. Use in wooden houses where there are special requirements for the installation of electrical wiring. For those who didn’t know, hidden electrical wiring in wooden houses is at least not recommended, and in the case of using corrugated PVC pipes, it is completely prohibited. In general, the standards for wooden structures are quite strict and those who adhere to the rules and fear for their lives will be forced to spend money on either good hidden wiring in metal sleeves, or cover the beautiful wood with a 10-mm layer of plaster and lay the wiring under it. In the case of open wiring, so-called “retro wiring” using stylized cable and ceramic insulators has recently gained popularity. The solution is beautiful, but far from the most practical, time-consuming and expensive.

4. Wireless motion sensor for automatic lighting control. I would, of course, like to see more sensors in various form factors in the Nootekhnika arsenal, but even what we have already allows us to automate the lighting in the apartment and save on electricity. The main advantage of the sensor under review is the absence of wires. Typically, these devices are connected to the phase wire of the lamp and additionally require zero for power. Those. both installation and subsequent movement of the sensor in case of unsuccessful placement are complicated. Read more about this.

5. Light control from watches, computers and mobile devices located on the same local network. You can, of course, get tired of it and purchase a static IP address from your provider, forward the port to an Ethernet gateway and completely control the lighting from anywhere in the world, but taking into account the lack of feedback from the nooLite system units, the rationality of this solution, in my personal opinion, comes down to zero.

I'm afraid that if I continue to describe all sorts of scenarios, I will exceed the character limit set on the site for one article. There are more examples of using devices from Nootekhnika on their website. And yet, I know that similar control can be implemented on Arduino or even by assembling an independent device, so there is no need to write about this in the comments. It’s better to calculate how long it will take you, and then multiply it by the cost of one of your hours. Unless, of course, this is your hobby, but your wife, children or roommates can put up with the lack of light due to the debugging work you are doing.

    • How convenient are touch switches? What to do in the dark? Is there any backlighting?
      No, there is no backlight, in the dark you will have to navigate by touch. In the switches of the first revision it was more convenient to do this, since the buttons could be felt in the corners of the frame. In the second version, I periodically miss the center key. As such, there is no pitch darkness in my house; either a table lamp or a night light is always on, and given the “creative disorder” that I love, no matter how brave I am, I will not risk moving around the apartment in the middle of the night without, for example, a smartphone. If desired, you can change the touch switches to return ones using remote controls.
    • Is it possible to turn on the light with the toe of your left foot while wearing warm socks?
      You can use either your left or your right, but either in thin conductive socks or without them at all. You can also use your nose, yes. I'm not joking, because such situations happen.
    • What happens if the lights in the apartment are turned off? Will the blocks lose their binding? What condition will they be in after the power supply is restored?
      Nothing will happen. In the event of a power outage, the blocks will not lose their binding since all information is stored in non-volatile memory. If we talk about the SU series units supplied in the set, they do not have the function of storing the state when the 220 V network is lost. For other models, see the company’s website.
    • Is it easy to hack the system and gain control over the control of lights and electrical appliances?
      It’s quite easy, because the system doesn’t have any serious protection. And if you have an open Wi-Fi network and you use an Ethernet gateway with the first version of the software, then any “passerby” will only need to connect to this network and go to the standard gateway address 192.168.0.168. For radio control, only 16 address bits are used, so searching through the possible 65536 combinations will take a matter of hours. There is also no protection of the proprietary protocol; the signal from the remote control is easy to “catch” and record. There was even an article on Habré about. The question is, who might need to “hack” the lighting control system in an average apartment or house? Except for some naughty schoolchildren, but they usually welcome other methods.
    • How to predict when the batteries in the remote control will run out? I wouldn't want to be left in the middle of the night without the ability to turn on the light.
      I have already raised this question higher in the text, but I will repeat it anyway, since it really arises often. As such, the remote control does not have a discharge indication, but as the critical charge level approaches, the indication LED will glow dimmer and dimmer when transmitting commands. This is an indicator that it is time to replace the batteries. If during this time you do not bother to replace the batteries, and you are not at home (as a person capable of replacing the battery in the remote control) or, in fact, CR2032 batteries, then yes, there will be no opportunity to turn the light on or off.

▌Results

If you read this article to the end, then you are at least a hero, since I have never written such large materials before. It is simply unrealistic to cover in one article all the diversity of a seemingly simple system like nooLite; I’m afraid to imagine what will happen if I get some full-fledged smart home controller with a bunch of peripherals for review. Probably, it would be possible to divide the review into two parts, but then there would be even more text. From this material I excluded the chapter on the operation of the system at the data transfer level and the dissection of the main components, but I will definitely write it later.

I can safely recommend the official Nootekhnika website as a comprehensive source of information for further study of the system. Almost every device has detailed manuals, videos and short infographics. There, on the website, the system and its individual components are collected, so there will not be a traditional “Related Links” section at the end of the article.

As for the system itself, not only does it deserve attention, it is also worth the money. Hobby solutions based on Arduino and the like are still not plug&play devices and require painstaking installation and configuration, and advanced home automation systems based on the Z-Wave or X10 protocols will cost much more.

What I liked
    • Basic system price (switch block)
    • Easy to install and configure
    • System expandability
    • Control from mobile devices on the local network (especially from watches)
What I didn't like
    • Lack of feedback, remote controls and gateway are not synchronized in any way
    • Gateway cost and functionality
What would you like
    • Any kind of protection (encryption of the data transfer protocol)
    • Expansion of the capabilities of scene channels (the ability to turn the light on and off with one scene button, double tap to assign additional functions)
    • , . On my website I duplicate my publications from all over the Internet, so too. :)

Good day, dear reader.

A little lyrics at the beginning. The idea of ​​a “smart” light switch is not new at all and, probably, this is the first thing that comes to mind for those who have begun to get acquainted with the Arduino platform and IoT elements. And I am no exception to this. Having experimented with circuit elements, motors and LEDs, I want to make something more practical, which is in demand in everyday life and, most importantly, will be convenient to use, and will not remain a victim of experimentation for the sake of comfort.

In this article I will tell you how I made a switch that will work like a regular switch (that is, one that is usually mounted on the wall) and at the same time allows you to control it via WiFi (or via the Internet, as is done in this case).

So, let's make a list of what you will need to implement your plan. I’ll say right away that I intended not to spend much on components and chose the components based on reviews on the forums and the price-to-quality ratio. Therefore, some components may seem inappropriate here for experienced electrical enthusiasts, but please do not judge too harshly, because I'm just a beginner in electromechanics and would really appreciate comments from more experienced people.

I also needed: a server with which the switch will be controlled via the Internet, an Arduino Uno with which I programmed the ESP, a router and consumables such as wires, terminals, etc., all this can vary depending on tastes and will not affect to the final result.

Prices are taken from Ebay, where I bought them.

And here is what the elements from the table look like:

Now you can create a connection diagram:

As you probably noticed, the scheme is very simple. Everything is assembled easily, quickly and without soldering. A kind of working prototype that you don’t need to tinker with for a long time. Everything is connected with wires and terminals. The only negative is that the relay did not fit into the switch socket. Yes, initially I planned to push it all into the wall behind the switch to make it look aesthetically pleasing. But to my regret, there was not enough space in the socket and the relay simply did not fit either lengthwise or across:

Therefore, I temporarily moved the relay behind the socket until I found a suitable switch box with an outlet to hide the iron inside. But there is nothing more permanent than temporary, isn’t it? So it all looks like this now:

Electrical tape will save you from electric shock... I hope.

Now let's talk about the software part.

And before we start analyzing the code and details, I will give a general scheme for implementing control of a light bulb.

I hope that someday I will rewrite everything and the connection will be based on a faster protocol than HTTP, but for a start it will do. Remotely, the light bulb changes its state in approximately 1-1.5 seconds, and from the switch instantly, as befits a decent switch.

Programming ESP8266-01

The easiest way to do this is with Arduino. You can download the necessary libraries for the Arduino IDE from GitHub. All instructions for installation and configuration are there.

Next we need to connect the ESP to the computer, for this you will need either a USB to Serial Adapter (such as FTDi , CH340 , FT232RL) or any Arduino platform (I had an Arduino Uno) with RX and TX outputs.

It's worth noting that the ESP8266-01 is powered by 3.3 Volts, which means you should never connect it to an Arduino, which is (often) powered by 5 Volts, otherwise it will burn to hell. You can use a voltage reducer, which is shown in the table above.

The connection diagram is simple: we connect TX, RX and GND of the ESP to RX, TX and GND of the adapter/Arduino, respectively. After this, the connection itself is ready for use. The microcontroller can be programmed using the Arduino IDE.

A couple of nuances when using Arduino Uno:

  • The Uno has a 3.3V output, but it wasn't enough. When you connect an ESP to it, everything seems to work, the indicators are on, but communication with the COM port is lost. So I used a different 3.3V power supply for the ESP.
  • In addition, UNO did not have any problems communicating with ESP, given that UNO was powered by 5V, and ESP by 3V.
After several experiments with the ESP8266-01, it turned out that the ESP is sensitive to the voltages connected to GPIO0 and GPIO2. At the moment of start, they should under no circumstances be grounded if you intend to start it in normal mode. More details about starting a microcontroller. I didn’t know this and I had to slightly change the scheme, because... in the ESP-01 version only these 2 pins are present and in my circuit both are used.

And here is the program for ESP itself:

Show code

#include #include #include #include #include extern "C" ( // this part is required to access the function initVariant #include "user_interface.h" ) const char* ssid = "WIFISSID"; // WiFi name const char* password = "***************"; // WiFi password const String self_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // token for minimal communication security const String serv_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // token for minimal communication security const String name = "IOT_lamp"; // switch name, read light bulbs const String serverIP = "192.168.1.111"; // internal IP WEB server bool lamp_on = false; bool can_toggle = false; int button_state; ESP8266WebServer server(80); // web server HTTPClient http; // web client const int lamp = 2; // Control the relay via GPIO2 const int button = 0; // "Catch" the switch via GPIO0 // function for ping the light bulb void handleRoot() ( server.send(200, "text/plain", "Hello! I am " + name); ) // function for invalid requests void handleNotFound ()( String message = "not found"; server.send(404, "text/plain", message); ) // Let there be light void turnOnLamp())( digitalWrite(lamp, LOW); lamp_on = true; ) / / Let there be darkness void turnOffLamp())( digitalWrite(lamp, HIGH); lamp_on = false; ) // Send manual on/off events to the server. void sendServer(bool state)( http.begin("http://"+serverIP+"/iapi/setstate"); String post = "token="+self_token+"&state="+(state?"on":"off "); // Using the token, the server will determine what kind of device it is http.addHeader("Content-Type", "application/x-www-form-urlencoded"); int httpCode = http.POST(post); http.end (); ) // Change the state of the lamp void toggleLamp())( if(lamp_on == true) ( ​​turnOffLamp(); sendServer(false); ) else ( turnOnLamp(); sendServer(true); ) ) // Receive from the server enable command void handleOn())( String token = server.arg("token"); if(serv_token != token) ( String message = "access denied"; server.send(401, "text/plain", message); return; ) turnOnLamp(); String message = "success"; server.send(200, "text/plain", message) // Receive a command to turn off void handleOff())( String token = server.arg(" token"); if(serv_token != token) ( String message = "access denied"; server.send(401, "text/plain", message); return; ) turnOffLamp(); String message = "success"; server.send(200, "text/plain", message); ) // Set the MAC to give the same IP void initVariant() ( uint8_t mac = (0x00, 0xA3, 0xA0, 0x1C, 0x8C, 0x45); wifi_set_macaddr(STATION_IF, &mac); ) void setup(void)( pinMode(lamp, OUTPUT ); pinMode(button, INPUT_PULLUP); // It is important to do INPUT_PULLUP turnOffLamp(); WiFi.hostname(name); WiFi.begin(ssid, password); // Wait until we connect to WiFi while (WiFi.status() ! = WL_CONNECTED) ( delay(500); ) // Assign functions to requests server.on("/", handleRoot); server.on("/on", HTTP_POST, handleOn); server.on("/off", HTTP_POST, handleOff); server.onNotFound(handleNotFound); // Start the server server.begin(); ) void loop(void)( server.handleClient(); // Check whether the switch is pressed button_state = digitalRead(button); if (button_state == HIGH && can_toggle) ( toggleLamp(); can_toggle = false; delay(500); ) else if(button_state == LOW)( can_toggle = true; ) )


A couple of notes on the code:
  • It is very important to declare the GPIO0 pin as pinMode(button, INPUT_PULLUP), because In the circuit we do not use a resistor for this button. And ESP has its own “built-in” ones for these very purposes.
  • When catching the state of a button, it is advisable to set a delay when reading it to avoid false positives at the moment of pressing.

WEB server programming

Here you can give free rein to your imagination and use any available means to create a service that will process requests sent by the switch and send requests to turn it on/off.

I used Yii for this purpose. I chose this framework for several reasons, I needed authorization (since the portal is available on the Internet) and role management (for future experiments), and I just like it. And now my management portal looks like this:

To control a light bulb within the reach of the network, the server itself on the ESP would be enough. But you want to have logs, logic and other devices in the future, so it’s better to use a separate server for control.

This is all about the portal, I think there is no point in writing more about it, but if you have any questions, I will be happy to answer them in the comments.

Instead of a conclusion

Thank you if you read the article to the end and perhaps found something useful in it. I will be glad for advice and criticism. In general, it still seems to me that the bottleneck in the circuit is the 5V adapter and I will be glad if you share your experience in solving such problems. As for the ESP8266-01, so far it has not caused me any complaints except for the special use of GPIO pins. It's been working steadily for the second week so far. Good luck with your projects.

Modern progress and computer technologies, which are becoming more and more advanced and innovative systems and devices every day, provide new opportunities for the Smart Home system, which now also provides the ability to control light via WiFi. The unique technology of interacting components, which act as receivers and transmitters, has made the life of a modern person even easier and has given rise to the installation of more rational lighting control, both in residential buildings and in office premises.

But it’s not only the control of light via WiFi that the system developed by the best minds of mankind can set up. With access to the Internet, you have the opportunity to:

  • Control household appliances;
  • Regulate the operation of climate control equipment by setting certain scenarios for it;
  • Control the opening and closing of gates and blinds;
  • Monitor, start or turn off electrical appliances.

How does WiFi control work?

Its essence is that a wireless network allows us to control the Smart Home system, including the lighting system, from any device. You will be able to give commands to the lighting system of your home, cottage, office or apartment.

Control Features

Lighting control is possible through any computer, tablet, or smartphone that is connected to a WiFi network; naturally, the Smart Home must be connected to the same network.

Light control via WiFi can be carried out both in wired Smart Home systems and in wireless systems.

The setup of one or another type of system is carried out by our experienced specialists - you can be sure that both system options, both wireless and wired, will provide you with reliable and faithful service. The light control system via WiFi is another pleasant bonus that makes life easier for modern progressive Smart Home users.

In a word, if you have a WiFi access point and a “Smart Home” system from BE SMART, then you can install a control system for light, sound and other household “joys” in a residential area, in an office, and even in public places - restaurants, hotels, etc. Moreover, the operation of the equipment will not only make your household worries easier, but will also help you save on energy costs.

Today I want to show you an interesting device with which you can control anything via the Internet using the Wi-Fi module ESP8266 (ESP-01) and the ATmega8A microcontroller.
In this combination, the module acts as a WiFi network controller and web server, and ATmega8A acts as a power node controller, receiving a line via a simple protocol from ESP8266 and having processed it issues a command to open one or another relay through a shift register 74HC595 and transistor assembly ULN2003.

Device diagram:

By accessing the specified IP address, default: 192.168.4.1, you can configure various modes and control the lighting in your apartment or house. The device has a web interface. Firmware for ESP8266 is based on "web dumps" from the respected « PVVX". I just added a couple of handlers in the file so that when a certain line is received from the web side, a 4-byte string will be sent to the UART interface - the command identifier. There are two such commands for each control channel: turn it on and off. Also, there are two additional commands that can turn on and off all lighting channels at once.
And then, by writing a simple web page, I can easily control the lighting of the apartment.

The device works as follows:

From the web side: to put it simply, when you click on any of the buttons, a script is first called, which changes the background of the button and changes the variable value from 1 to 0 and vice versa with each click, and then the AJAX handler is called, which is processed by the program in the ESP8266 and sent to the UART code , corresponding to the AJAX command. And ATmega8A accepts and processes this line.

From the microcontroller side: a string is received, processed, and if the string matches the test string, then the necessary actions are performed. It looks like this like this:

Void send_data() ( static char buff_data=0, rel_data=0; static char x=0; if(string_search("@1A00",rx_buffer)) // LIGHT ON kitchen ( rel_data|=0x81; printf("1CH ON\ r\n"); clear_buffer_rx(); x=0; if(demo<42000 && demo_off==0) demo++; } .................... .................... else if(string_search("@2A00",rx_buffer)) // LIGHT OFF кухня { rel_data&=~0x81; printf("1CH OFF\r\n"); clear_buffer_rx(); x=0; if(demo<42000 && demo_off==0) demo++; } relay_send(rel_data); }

This function compares the string that arrives in the UART with a string that executes certain commands. If it matches, then the action is performed.

The UART parser function is homemade, here is its code:

Char string_search(char *str1,char *str2) ( unsigned char addr=0,x=0,y=0; str1+=0; str2+=0; while(str1!=0) ( addr++; ) while(str1[y ]!=0 && str2[x]!=0) ( if(str1[y] == str2[x]) ( y++; x++; ) else ( if(y

The web page does not qualify for an award, and looks like this:

When you press any of the buttons, the lighting turns on!

The settings web pages are hidden from the main page and open when you enter links. I will indicate them below.

If desired, anyone can modify the main page by adding a button or link to it to go to the settings.

192.168.4.1/protect/wifi.htm
192.168.4.1/protect/setup.htm
192.168.4.1/protect/uart.htm
192.168.4.1/protect/upload.htm

For questions about updating the firmware, you can.

Photo of the mounted device:

Attention! Printed circuit boards were designed to be universal (for general use) and boards were used from what was already manufactured, this is all due to the reduction of development time and saving costs on the production of factory boards. Therefore, some nodes are not wired for the task of lighting control.