Purposes of projet:
Concepts dealt with:
Software components used:
Physical devices used:
Procasting more suitable for:
Notes and disclaimer
|Driving review: 2.4|
ATTENTION: this guide appgranted to the R2 model is available here.
The smart switches of the family ITEAD Sonoff Smart Home they are extremely versatile, very economical and functional domotic components, but when it comes to integrating them in existing systems may, sometimes, rappresent a proproblem, especially in the presence of one or more diverters.
This is the case of the transformation of a light point (or of a more generic user) controlled by a traditional wall switch into a home automation element: we want to keep it manual, mechanical, integrating the home automation one.
There are more alternatives.
The first alternative - the simplest one - is to replace the entire wall element with a home automation touch switch, for example theITEAD Sonoff T1, which will provide both the "mechanical" functionality (in contact), both the home automation one. Specifically in the example, since it is a Sonoff will be reprogrammable with firmware Sonoff-Tasmota, therefore configurable by our loved ones HUB personal and therefore with our personal home automation.
A second alternative is to add a domotic element to the mechanical switch to "domotize it" (type Powahome). In this case the choice of this element must be made with criteria, especially if they are used for profirst personal domotics of the HUB personal (compatibility with them must be guaranteed).
A third alternative is to connect a button on the electronics of the Sonoff Basic R1.
Il Sonoff Basic R1 presents on the propria board a button for activation and deactivation relay manual. The pressure of this button comes out appgreasy when opening or closing the relay based on the pre-existing status. Essentially closes if it was before open, is opens if it was before closed: they are called function, in English, TOGGLE.
Wanting to use the Sonoff without any software modification, the only way to command "esternamethe "function"namethat's it to connect in parallel the two contacts of a traditional button (mechanical, wall) to the two contacts present on the button on the board of Sonoff Basic R1. This will practically replace the button on the actuator with an external one.
THE FOURTH - OBJECT OF THIS GUIDE
The fourth street, the one that prolet's say in this guide, is that of modify the firmware of the Sonoff Basic R1 in order to (among many other things) enable and be able to use the pitches (one, specifically, that "in the factory" is not enabled) present on the board and so you can attest one or more buttons, or a classic mechanical switch, thanks to the features guaranteed by the firmware.
No fear: we explain everything in the following paragraph.
First di profollow over, we remind you again that:
Notes and disclaimer
Description of the change
We therefore pursue this guide on the fourth street.
Il Sonoff Basic R1 (but also the other components of the same line prodotto) presents a series of contacts on the board.
Usually GND, TX, RX and 3.3V (VCC) are used for the riprofirmware weight; in this projet we will focus particularly on the fifth, the GPIO14 which, used in havenamecontact GND.
|ATTENZIONE: the images to follow refer to the version R1 dell'ITEAD Sonoff Basic. In case you have the R2, the concepts remain the same, but the points on which to connect vary. Carefully read the card dedicated to Sonoff Basic in the section dedicated to the versions.|
Usually GND, TX, RX and 3.3V (VCC) are used for the riprofirmware weight, while the GPIO14 (see photo) is not usually in use. For this projet will recommend to weld pins on the five contacts: so as to be able to reproprogram the firmware, and check - subsequently - the behavior of the unit used GPIO14 e GND.
To ensure that the couple of contacts GPIO14 e GND can be used for the purpose, it's necessary the adoption of an alternative firmware, specifically the Sonoff-Tasmota. The guide takes this firmware for granted.
|Nb. There's a ma.|
We appena explained that the Sonoff Basic R1 (equipped with firmware Sonoff-Tasmota) change status (open / closed) when the GPIO14 and the GRD are short-circuited. To change status again, it is necessary remove the short circuit e appsell it again.This is the behavior offered by a button (or button), NOT a switch (mechanical, wall-mounted) which has two mechanical states (closed and open) which yes prothey draw in time (until the next mechanical state change). In essence, with the modification to the electrical scheme we are proplacing, to manually control the TOGGLE of status it would be necessary to set the switch (mechanical, from the wall) to the off / on / off position. Such an annoying situation it is easily solved, as follows.
It will be possible to leave it unchanged the presence of the switch (mechanical, wall-mounted), which will act (at each change of state, regardless of whether it is the closing or opening of the contact between GPIO14 and GRD) How TOGGLE thanks to the use of the command Tasmota "SWITCHMODE”Duly configured.
Obviously there will be no mechanical position of the switch apt to indicate the functional statusnameof the Sonoff (relay closed or open). Each actuation of the switch will cause a change of state of the relay, end.
The most complex part, if you are not familiar with welding, is profirst this: to have contacts through which to connect the button / switch to GPIO14 and GRD.
Weld these pins (5) on the board at the pitches, taking care to place the shortest segment on the board. Once the welding is done, we will have contacts on which to position ourselves for the modification to the wiring diagram (we will use the female pins to connect to contacts of the button or switch).
Use of a button
This road involves the use of a Sonoff Basic R1 and the replacement of the pre-existing switch with a button (in the illustrated case of type "Normally Open“).
Let's see the initial wiring diagram:
And how becomes:
Once implemented this change, the work is completed.
To make the change work, however, it is necessary to implement:
- su Sonoff Basic R1 with original firmware: nothing, it works by itself;
- su Sonoff Basic R1 riprogrammato with firmware Tasmota: appuse the command "SWITCHMODE"
In the second case, the command is as follows:
which will interpret the short closing of the GPIO14-GRD contact (implemented via a button) as "change of status compared to the current one"
In case you use a button "Normally Closed", The command will be:
This is done by pressing / releasing the button will be implemented TOGGLE of the relay status of the Sonoff (turns off if on, turns on if off); at the same time, the same command can be implemented at home automation. Obviously if the Sonoff be controlled manually, the new state will be correctly detected inside the home automation practically instantly.
In the following video you can see the behavior of the circuit thus conceived:
Nb Use of one or more buttons such as "diverters" it's possible, but only:
- using appgrease buttons, and no switches;
- by connecting the contacts of all these buttons on the GPIO14 and GROUND contacts of the Sonoff Basic R1.
By doing this, pressing any of the buttons connected to the Sonoff will control its behavior.
Use of a switch
If you decide, instead, to leave it at home switch pre-existing, then the scheme will be the following:
As said, for a correct functionnameof the circuit and manual activation will be necessary, primarily, the presence of the firmware Tasmota, this because, as widely explained, only in the presence of Sonoff-Tasmota it will be possible to implement a configuration that allows interpretation each change of state (any!) of the switch as TOGGLE.
Performed the highernamefirmware and wired the circuit as above, you will need to set it from the console Tasmota the following command (it is assumed that the device has a name "Sonoff"):
which will prepare the closing or opening of the short GPIO14-GRD as "change of status compared to the current one". For the rest (home automation control, state change detection in home automation etc.) the same considerations made in the example related to the button will be valid.
Lastly, it is necessary to indicate to the firmware Sonoff-Tasmota what is the use of the GPIO14 pin, in our case "switch". To do this, go to Configuration / Module Configuration (Configuration / Module Configuration) of the web interface under the heading "GPIO14 Sensor", Select the item"01 Switch". Finally click on "SAVE"
Now the actuator will act as intended.
|ATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Sonoff (and more generally to devices ESP8266), for any doubt, question, information on the specific merit of these components.|