Today we are going to look at the Sonoff products from Itead, some very interesting devices that form an attractive and very economical alternative to turn your home into a smart home.
There is no doubt that home automation and IoT are in fashion. Some examples gaining popularity are lighting control, climate control, monitoring energy consumption, or intrusion, fire, or water leak alarms, among countless other examples.
Major manufacturers, such as Samsung, Apple, or Philips, are well aware of this trend and are developing their solutions for home automation and IoT. However, in general, for now they are excessively expensive, closed, and with immature development.
Compared to the early attempts of the big manufacturers, the Sonoff product range from Itead presents itself as a low-cost and very well-implemented alternative, which is why it is gaining great popularity.
This small (in comparison) company has managed to develop a growing family of cheap devices that work perfectly and are easy to use, and which we can integrate ourselves into our home to add a home automation component.
Furthermore, Sonoff products have integration with major voice assistants like Google Home or Alexa. We can even integrate them with other cloud services through the popular IFTTT application.
Finally, for more advanced users and makers, it is possible to overwrite the original firmware of the Sonoff device and program our own code, or use one of the alternative firmware developed by the community. Let’s look at some of the main products.
We are going to see a list of some of the devices in the Sonoff family and the options we have for using them from the mobile application.
Sonoff Devices
WiFi Relay
Probably the main and best-known component of the Sonoff family is the WiFi-controlled relay. Its use is very simple: we simply power the device from the primary side, and the secondary side will receive current when the relay is activated.

The relay also incorporates a button to toggle the relay manually. Besides being convenient in various situations, it is an essential measure to protect us from possible WiFi failures.
There are other variants, such as one that incorporates a temperature and humidity sensor, for example to automatically activate a fan, or a humidifier, open a window, control the temperature of an aquarium, or activate an alarm, an irrigation system, etc…, or that incorporate an RF remote control.

On the other hand, there are also 4 or 8 channel relay modules, which allow us to turn on multiple devices easily.
Additionally, we also find a wide variety of plastic boxes, some of them waterproof and suitable for outdoor use, to house the Sonoff relay.

WiFi Switch
If what we want is to control the lighting in our house, perhaps the most suitable device in the Sonoff series is the WiFi-controlled switch. There are variants of single, double, or triple switches.

This switch behaves similarly to a normal touch switch, meaning we can still activate the switch by hand. But it adds the possibility of turning on, off, and knowing the state of the light point.
The aesthetics are quite pleasant (although tastes vary). It has a protective glass with a bluish light that shows the state of the switch. The switch is touch-sensitive, so it has no moving parts.
It should be noted that the switch requires its own power supply (AC230V), but in most switches in our homes we only have one of the phases. Therefore, we will need to run an AC cable from the nearest junction box.
There are no switched or crossed versions. But it is not necessary, as we can achieve this behavior through the WiFi functionality. (in fact, we could even control a lamp by acting on the switch without the cable even reaching it!)
WiFi Light Bulb Socket
A simple option to automate any light point, a simple socket that we interpose between the bulb and the original socket, allowing us to turn it on or off from the mobile phone.

This option is very simple and can be useful, for example, if we cannot run power for the previous switch, if we want to get a light point from a power outlet, or even to be able to turn off only some of the lights in a lamp.
WiFi Plug Socket
This option is the simplest to control via WiFi the switching on of any device connected to a power outlet. A WiFi-controlled plug that we interpose between the power outlet and the electrical device.

It is interesting to note that, since the application allows timing the WiFi device, this simple device also replaces traditional timers.
WiFi-RF Gateway
A very interesting device that allows us to control radio frequency devices controlled with a 433Mhz remote, such as some air conditioners, alarm systems, etc.

When configuring this device we must press the buttons on the remote we want to “clone”. The gateway will learn the signals, and we can use the same functions as with the remote.
However, it will not work with garage door openers or other security remotes, as they use a rolling code (precisely to prevent copying).
Another interesting use of the RF gateway is to add a wide variety of wireless sensors. Many cheap alarm systems incorporate sensors (motion, door opening, flood, fire). They are usually not great alarm systems, but with the gateway we can incorporate these sensors and use them for other things (like turning on a light, or whatever we imagine).
SC WiFi Station
A very interesting device that incorporates light level, sound, dust, air quality, temperature and humidity sensors, in a compact format.

It is designed both to monitor the state of our home at all times and from anywhere, and to perform automatic actions (turn other devices on or off, send an alert, etc.) when any variable exceeds a value.
What We Miss
The Sonoff range is quite comprehensive and growing rapidly. But, to say something, we miss the IR gateway, which would allow us to control devices controlled by infrared remotes (the TV, my air conditioner, the Roomba).
We also miss a WiFi thermostat, which would allow us to turn the boiler on or off, change the setpoint. It would be a great addition to the family, especially combined with the Sonoff SC, and would rival other thermostats like the famous Nest.
So you know, Itead! Get to work. We want a thermostat and an IR gateway!
Sonoff Application
Control of all Sonoff devices is done through a single mobile application available for Android and iPhone. Its simplicity and good performance are one of the strong points of the Sonoff range.
Once the application is downloaded and our user account is created, we must pair the devices we have. Here the simplicity of the solution stands out, especially when compared to other IoT products from “major brands” (I have tried some, and pairing them was a real nightmare).

All devices in the series incorporate a pairing button and some LED indicator. When pressed, the device’s light will start blinking, and we can search for it from the mobile application.
After a few seconds, the application will find the new device and add it to our window. That easy!
Depending on the type of device we have added, it will create a widget in the application with the actions it can perform.

We can share devices with other people, so all family members can use them. We can even share but set permissions for certain actions, for example in the case of children.
On the other hand, the application takes care of updating the software of the devices. If a new software version is available for a device, it will notify us, and we can update the firmware in seconds by just pressing a button.
The application also allows adding timers and countdowns to control all devices. For example, we can automatically turn off all lights at a certain time, turn on an irrigation system, among many other uses.

Another very interesting option is the “Scenes” function, which are action flows triggered when an event occurs. For example, if motion is detected, turn on these two devices, or if I press this switch, also turn on this relay.

If we combine all the functions, the number of options we can perform is practically infinite. Even more so if, as mentioned, it is possible to add integration with voice assistants, or more complex workflows through IFTTT.
Reprogramming the Device
If all the standard options available are not enough for you, or if you love tinkering with your best maker spirit, it is possible to reprogram these devices with your own code.
If we look inside Sonoff devices, they mount an Espressif processor like the well-known ESP8266 or the ESP8285, both already known on the blog, and which we can reprogram with the same tools as an Arduino.
The advantages of reprogramming the device are several. Customizing behavior, integrating it with our own projects, adding sensors or actuators (motors, servos, etc.). We also gain in security and privacy, and protect ourselves from the possibility that Itead’s servers one day stop working.
However, we also lose some things, such as integration with certain cloud services and (unless you have a server set up) access from outside the local network.
Reprogramming the Sonoff device is an advanced procedure, which requires soldering (a little, but it does), and computer knowledge, especially to get the most out of the available options. However, the task has been simplified quite a bit thanks to firmware designed by the community for Sonoff devices, such as ESPurna developed by Xose Perez, or Tasmota developed by Theo Arends.
On the other hand, we can use these devices even for functions different from those they were used for. In fact, a Sonoff relay is a good way to buy and modify an ESP8266 that we can plug into AC230V, in a compact plastic box, which we can add to our projects.
Conclusion
The Sonoff range is a simple and cheap way to automate the home. The standard options give us an almost infinite number of combinations, especially if we consider the timing function and scenes.
In addition to the usual and well-known relays, we have a large number of less known devices, such as switches, power sockets, a sensor station, and an RF gateway that allows us to add many more sensors. Although we miss a thermostat and an IR gateway.
For the more adventurous users, it is possible to reprogram the devices with one of the firmware developed by the community, and integrate it with other Open Source developments (Home Assistant, your MQTT server).
Finally, we can also use these devices as a programmable processor (usually the relay) and include it in our electronics and robotics project.
As you can see, some very interesting devices with endless possibilities. In future posts we will see the process for changing the firmware of Sonoff devices.

