What’s hidden inside a smart socket?

In today’s world, the importance of various types of devices from the “smart home” category is growing day by day. There is nothing surprising in this, after all, thanks to these, sometimes very simple equipment, we can remotely control home lighting, heating or ventilation. Besides, thanks to all kinds of sensors, reading temperature, humidity and light intensity has become much simpler. The data collected by the system can be used to intelligently manage actuators such as relays. In other words, today’s technology allows us to build really complex structures at a low cost, which we can call a smart home.

Some of the simplest appliances that allow us to enter the world of smart devices are the extremely popular smart outlets. They allow us to easily control other devices by running them from an app. Personally, I don’t have much experience in using this type of outlet, as I usually built the circuits that allow me to manage other appliances on my own. However, I recently received a certain smart outlet, which I have been testing all the time. Driven by professional curiosity, I checked out what its interior hides, and that’s when I came up with the idea for the article you are just reading.

The premise was quite simple, to test and describe how smart outlets are built. When choosing test units, I was primarily guided by popularity. I selected three devices, differing in price, so as to see if this has a greater impact on their quality. In this material I will tell you a little about the very idea of this type of equipment, and then we will analyze for ourselves their construction. In addition, I will touch on a certain dark side of smart outlets.

Of course, this is in no way an advertisement for either of these devices. I bought them personally, precisely with this article in mind. I will also try to be as objective as possible, but I emphasize, these are only my conclusions, which are based on my own knowledge.

Today's heroes

Sockets (from left) Blow, Sonoff and Gosund.

As I mentioned the protagonists I will subject to deeper analysis today will be three. Searching the most popular listings on one of Poland’s auction sites, I chose Blow, Gosund and Sonoff sockets, which I considered to be the cheapest, mid-shelf and most expensive devices, respectively. As a technical addendum, you can see the table below, where I’ve put some dry facts from the manufacturers’ websites and auction descriptions.

All sockets are similar, but not identical. They differ in details, the previously mentioned price, performance, application support or additional functionalities. What is worth mentioning is the fact that an increase in price does not mean more capabilities of the device as such. The highest power is characterized by the Sonoff, although the Blow outlet can deliver an identical value of current, but these are the values that these devices are described on the nameplates. The limited capacity has only the mid-shelf Gosung, which can deliver a current of 10A. As for support for control applications, the situation here is very similar, a much more interesting element is the additional functionality. All sockets support remote switching on and only the plugged-in device according to the schedule, but only the most expensive unit is deprived of the function of measuring the consumed energy, which, I can’t hide, surprised me a bit.

Also worth mentioning is the sheer quality of the smart outlets, which is almost identical in every case. The appliances are made of plastic, to which at first glance you can not complain. Each device looks quite solid, although it is worth mentioning that the medium-shelf Gosund, according to the data in the manual, is characterized by flammability class V0. Which means that the material used does not burn for more than 10s in the sustained combustion test, does not smolder and does not drip.

Smart socket theory

A conceptual theory for building a smart outlet.

However, before we move on to discuss each of today’s heroes, I’d like to tell you a little about the theory of smart outlet construction itself. It will give you a much better understanding of how it works, as well as the various aspects of each of the devices tested.

The smart socket in its theory is not a complicated device at all. Here we have an AC circuit that powers the device itself, as well as the equipment connected to it. The control circuit, in the form of a more or less familiar microcontroller, decides whether this fictitious equipment in the form of, for example, a bedside lamp will be activated. Thanks to the wireless connection to our home Internet network, this chip can, at the moment of clicking the “turn on” button on the phone screen, activate the coil of the relay. It is through this chip that plugged-in appliances can be turned on or off remotely. In addition, the control chip responds to the usually single function button placed on smart outlets and controls the illumination of signaling LEDs.

In many models of sockets we can find such a thing as a current/power measurement circuit. This is nothing more than a simple circuit, usually based on a single chip, whose task is to read the value of the mains voltage and the current flowing. This data is transmitted to the controlling microcontroller, so that the user can see on the screen of his phone the values of current and power consumed by the connected equipment.

Each outlet must also have its own power module. Its circuits, as a rule, need a much lower voltage than mains 230V. If we seeded the microcontroller with just such a voltage, its core could very quickly change its state of aggregation from solid to gas with possible carbon residues. This is why designers build simple transformerless power supply systems, which are some variation of voltage converters.

This is what the simple idea of building a smart outlet looks like, which can be modified, of course. The current and voltage measurement circuit is an optional element, which I will mention later. Besides, this type of construction can also be expanded, improving its stability or safety.

Blow WIFI Smart Socket

Blow socket after opening.

Let’s take the cheapest socket first, the Blow WIFI Smart Socket. Getting into its interior, is not something difficult. It is enough to undermine the plastic several times at the visible connection point. After this procedure, it will be possible to remove the upper part, while paying attention to the wire connecting the grounding between the plug and the socket, which should be unscrewed. Inside there is a single PCB, connected to the body with a small screw. After unscrewing it, it is possible to remove all the available electronics.

The socket makes quite a good impression, although one can complain about the rather frail ground connection wire and the thickness of the laminate, which is only 0.8mm. Besides, it is worth mentioning that in two places, where the miniature SMD components are quite close to the fields where the mains voltage occurs, holes have been cut in the board, improving the safety of the whole structure.

The power section of the Blow socket is based on a small BP2525 chip, along with several accompanying passive components. This chip is a non-isolated step-down design, which only needs rectified and capacitor-filtered mains voltage for operation. A constant voltage of 5V is generated at the output of the circuit, while the efficiency of such a power supply circuit is 150mA. Besides, as the manufacturer declares, the circuit supports overload and overheating protection.

On the opposite side of the PCB was placed a circuit based on the BL0937 chip, allowing to measure the current flowing through the 1mΩ power resistor and the voltage present in the power circuit. In addition to this, the design also provides information about the power consumed, determined from these parameters. BL0973 is quite an interesting circuit, which even has a small signal processor inside, determining the measured values and sending them further in the form of specific frequencies to a larger microcontroller.

Blow socket relay.

The relay used in the Blow smart socket is the M3FF3.0-1A, for which, unfortunately, no documentation can be found. The only information is the one written on its case, that is, a coil supplied with 5V and a contact capacity of 20A at 250V AC. Thus, it was selected with some reserve, taking into account that, according to the manufacturer, the socket can deliver a maximum current of 16A.

Control module.

The brain of the socket is a 32-bit BK7231N microcontroller running at 26MHz, although its maximum clocking can be as high as 120MHz, from information available on the internet, it is used in most low-cost smart devices. The chip is equipped with 2MB of flash memory and 256KB of SRAM, which is sufficient for most simple IoT projects. The chip is placed on a separate board with an integrated antenna for communication with WIFI and Bluetooth. The laminate is soldered directly onto the PCB with the rest of the electronics.

Gosund EP2

Gosund EP2 after opening.

Compared to the cheapest socket, the design of the Gosund EP2 is much more complex. It is much more difficult to get to the interior and the process will end up rather damaged, one of the plastic parts, unless only my copy was assembled this way. You can get to the insides after removing the plastic covering the plug socket. Then you’ll see a circular piece holding the metal ground. It is held by two screws, after unscrewing which you can see the main electronics. In addition to this, an antenna, which improves communication aspects, is glued to the plastic casing from the inside. It is worth paying attention to it when disassembling the device.

Podobnie jak w poprzednim gniazdku, całość robi raczej dobre wrażenie. Laminat płytki drukowanej jest tutaj nieco grubszy – 1,6mm, choć moją uwagę zwróciły niektóre elementy umieszczone dość blisko miejsc, na których pojawia się napięcie sieciowe. Mimo tego pod względem projektu, widać, że konstrukcja ta jest nico bardziej przemyślana, ale przyczepić muszę się do uziemienia, które prawdopodobnie w moim egzemplarzu nie było do końca połączone.

Taking apart the socket, I noticed that the metal grounding elements in the plug and socket were not fully connected. Remnants of the soldering process, in the form of tin and flux, could be seen on them, but the metal plates were not connected to each other. When the equipment was assembled, the metal parts were in contact with each other, so the connection was there, but note this oversight, probably created during production.

The power supply section is located at the very bottom of the design, based on the well-known BP2525 chip, the same one that appeared in the previously described socket. As before, it generates a voltage of 5V, which is later converted to a value of 3.3V by the LM1117 stabilizer. However, it is worth mentioning that in this socket the power supply circuit has been slightly more extended. Around the main chip you will not find only a few passive components necessary for operation. There are more power-filtering capacitors, an optional choke has appeared, and besides, the circuit has been expanded with an additional varistor that protects the whole thing. Taking this into account, it is safe to say that in terms of power supply the Gosund looks quite good.

By the way of power supply, it is also worth mentioning the fuse placed in the phase circuit, which will trip when the current exceeds 10A. Hence the nominal amperage and lower power in comparison with other designs. I do not hide, the presence of this element extremely pleased me, because it is always an additional safety element, improving the safety of the device.

BL0937 measurement system.

The circuit whose task is to measure the value of the current flowing in the phase circuit, the voltage present there and to determine the power consumed by the connected device also looks familiar. It is the same BL0937 placed in an almost identical circuit with the same components as in the Blow socket. Here, however, the chip is placed on a board where the main microcontroller is soldered on the opposite side. Such a solution is understandable, after all, this results in a small universal module that supports the smart socket. However, despite this, the placement of BL0937 is, in my opinion, somewhat unfortunate. This chip is indirectly in contact with the network circuit, which, in my vision of a perfect smart outlet, should be as separate as possible from the rest of the components, for safety reasons. Besides, network circuits, generate interference that can affect the main processor. This also explains to some extent the use of an additional external antenna, rather than placing it, as in the previous socket, directly on the phenolic-paper substrate.

The main microcontroller that controls the Gosund socket.

The operation of the Gosund smart outlet is overseen by the W701 microcontroller. It is a 32-bit design, whose core is based on or compatible with ARM Cotrex M33, but this is not confirmed information, because in the documentation coming from the Far East it is described as KM4. Besides, the chip supports communication via WIFI and Bluetooth, and 256kB of SRAM and 2MB of flash were on board. Besides, the board with the microcontroller is equipped with a connector for connecting the already mentioned antenna.

It would also be appropriate to mention the relay, which is extremely difficult to access in this socket. It is described with the code HF32FV-16, and in this case the documentation is quite easy to find. The coil of the relay is powered by 5V, while its contacts can withstand a maximum current of 16A, so it is selected with some allowance for the Gosund socket’s limitation to 10A. It is worth remembering that the contacts of this element are made of AgSnO2, this information will come in handy later.

Sonoff S26

Sonoff S26 after opening.

The inside of the Sonoff S26 socket is by far the easiest to get to. On its underside there are three screws, after unscrewing which the device can be disassembled into two parts. As you can see, the designers did not focus on miniaturization here. This socket is the only one placed in this type of housing. This allowed the laminate with electronic components to be placed below the plug and socket, whose contact elements are wired to it.

To the quality of this device, as with the earlier sockets, I have no major comments. The first impression is as positive as possible, and the whole thing seems solid.

Phase circuit contacts.

I would like to draw attention only to the way the phase circuit is made. The lower contact inserted into the power socket is extremely close to, the upper contact, where the powered device is connected. The whole thing rests on small plastic latches, and on the lower contact there was clumsily applied silicone, whose task is apparently to separate the place with mains voltage from the pin of the plug being inserted into the socket. My feelings about such a solution are ambivalent, to say the least, because I am able to imagine a situation in which the lower and upper contacts are accidentally connected.

The power supply for this smart socket is designed quite correctly. The circuit is based on the BP2525 chip, identical to those used in earlier designs, and a miniature stabilizer generating 3.3V. Besides, the designers were tempted to add some optional elements like additional capacitors and a varistor, but a fuse placed in the phase circuit is missing.

Sonoff socket controller.

The main processor in the Sonoff smart socket is the ESP8266 chip known to most DIYers. This chip can be found on a great many miniature development kits. Its success is mainly due to its extensive capabilities and low price. This SoC supports communication via WIFI, and besides, quite a lot of peripherals can be connected to it. Inside the chip was a 32-bit Tensilica L106 RISC core running at a maximum frequency of 160MHz, supported by 64kB of SRAM.

Flash memory of the ESP8266 module.

The program executed by the ESP8266 microcontroller is stored in the external P25Q80H memory, which has a capacity of 1MB. This chip was placed on the opposite side of the control board, which is quite logical.

Sonoff outlet relay.

The relay used in this smart socket is FH17. A maximum current of 16A can flow through its contacts, which is also the peak value of the entire design. As in the equipment signed with the Gosund logo, the relay’s contacts are made of AgSnO2. Besides, it is necessary to mention the coil supply voltage, which is 5V.

The dark secret of smart sockets

Sparking relay contacts. (https://www.youtube.com/watch?v=nIB3kWqqAzE)

Smart sockets are quite a useful device, we can remotely control other equipment with them. In addition, many of the units available on the market support the measurement of voltage, as well as the power consumed by connected devices, so we can easily reduce our bills. However, despite the obvious advantages, it is necessary to mention a certain problem, which is encountered especially in those cheaper smart sockets.

While preparing this article, I asked you on my Instagram about the most common cause of smart outlet failures. By a slight margin, the answer that prevailed suggested that it was the relay, and you were right. Quite often, it is this component that fails, it seems that the outlet works, you can hear the relay ticking, but the equipment connected to it is powered all the time. In other words, the outlet, at some point, stops disconnecting power, as if it had failed. However, the cause of this uncomfortable situation is not the control logic, but precisely the relay, or more precisely the current flowing through its contacts.

When, an outlet simply powers another type of equipment, for example, a TV, nothing special happens. More or less current is lazily flowing through its contacts, and the main microcontroller is watching to see if by chance the user has decided to turn off the device. However, we should take a closer look at the moment when the device, connected to our smart equipment, is activated. Consumer electronics has the property that at the moment of start-up it can consume a current greater than that declared by the manufacturer, in which case we speak of inrush current. This phenomenon is something completely natural, and there are several reasons for it. Although as the main factor we can assume charging capacitors included in the powered device. The current drawn by them in the first moment after starting up is almost avalanche-like, its values can reach up to two or three times the declared amperage. Especially when several household appliances are connected to a smart outlet, via a power strip.

The relay contacts themselves are not perfect either; when the power is switched on, there are vibrations on them, which themselves generate current spikes. The result is sparks hiding inside the relays, invisible to us. Unfortunately, in addition to the sparks, the inrush current can cause the contacts to literally weld together. By which the relay ceases to respond to changes in current flowing through the coil, and the connected device remains powered. How quickly the contacts fail depends, among other things, on the material from which they are made. In Gosund and Sonoff sockets this is AgSnO2, which is pretty good news, since silver oxide, like zinc oxide, are much more resistant to momentary spikes in current. As I mentioned, the cheapest design uses a relay, for which I was unable to find documentation. By this I can suspect that the contacts of this element were made of silver alloy, which is commonly found in most relays, but does not cope very well with inrush current. The result can be glued contacts. So, if your outlet has stopped working after just a few days, the problem may be the material used to make the relay’s contacts.

A broader look at smart outlets

Finally, it would be appropriate to summarize in a few words the constructions described in this material. Each of them serves its purpose, but it is worth remembering the technical differences between each design. The cheapest socket, in addition to the obvious advantage of a low price, is qualitatively quite well made, but it is worth mentioning the design itself, which is simple to the extreme. It is supposed to work and nothing more, we will not find in it, any optional components or safety features. In addition, the relay, whose contacts become permanently connected, may prove to be a problem in the future.

A mid-shelf proposition, it also looks good. Inside you will already find a little more, optional electronics, making the device certainly a little safer. You can see that the design has been a bit more thought out. In addition, the relay contacts are made of a theoretically more durable material, and we should also mention the flammability class that the manufacturer declares.

The most expensive socket in the set, bod in terms of capabilities it is the poorest. Its design resembles the Gosund, and here, too, a bit more protection and filtering elements are used, although the fuse in the phase circuit is missing. In addition, note the relay contacts made of AgSnO2.

Any electronic equipment must be powered in some way, without the right voltage it will not work at all or will work, but only for a fraction of a second. There are quite a few solutions and designs whose task is to bring energy to the designed circuit. Some of the most commonly used are linear stabilizers and voltage converters. We will leave stabilizers for another material, while today I would like to tell you a little about the operation and design of inverters. In addition, we will also look at their problems and try to solve them.

In recent years, LED bulbs have made their way into our homes for good, replacing the now-discontinued tungsten filament designs. Not surprisingly, LEDs compare surprisingly well with other light sources - they consume little energy, can shine in a variety of colors, turn on instantly and do not heat up as much.

Sources:

  • https://www.erfang-ic.com/static/upload/BP2525D.pdf
  • https://www.belling.com.cn/media/file_object/bel_product/BL0937/datasheet/BL0937_V1.02_en.pdf
  • https://developer.tuya.com/en/docs/iot/cbu-module-datasheet?id=Ka07pykl5dk4u
  • https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_en.pd
  • fhttps://www.youtube.com/watch?v=nIB3kWqqAzE

Want to stay up to date?
Join the newsletter

Sign up and receive notifications of new articles, tidbits and short notes describing what I am currently working on.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top