It is now time to look at the Sonoff basic and integrate it with home assistant. This
is extremely similar to the S26 that we looked at last week. The main difference is that
with the S26, you could simply plug it into a wall socket and then plug in your device
to it. With the basic, you need to manually connect wires for both the input and the actual
device. This is good if you want to hide the setup behind a desk for instance.
They are both very similar in functionality otherwise and have the same 10A or 2200W power
rating.
I would not push them to the limit and I think it would be a good idea to keep the load below
a 1000W. One thing I forgot to mention in the previous video is that they only work
on 2.4GHz networks and that is because the ESP8266 only supports this band.
With that being said, let’s take a closer look at the device. The box appears to be
well designed and inside we have the unit itself, some screws and then some booklets
which help you get started. The main device also looks to be well constructed. These covers
can be removed to make the actual wire connections. The input terminals on this side are used
to connect the device to your wall socket. You then have the output terminals which will
be used to connect the load that needs to be controlled. The wires will have to be screwed
in place using the screw terminals and once done, you can use the screws to hold the covers
in place for additional safety.
The booklet shows you how you can get started with the unit and connect a lamp, fan or LEDs
to it. You can use an APP to control it or even use it with a voice assistant. If you
just have a couple of these units then you could use it this way but I want to automate
the home and control everything using home assistant which means that we will have to
open it up and make some changes.
The module is held together using plastic clips which means that we need a sharp tool
to open it up. I would recommend using a guitar pick like this as they get the job done without
damaging the plastic but you could use any sharp object that you may have. Slide it around
the unit like so and you then be able to open the enclosure to reveal the board.
Once again, the board is well designed with safety in mind. You do have sufficient isolation
to increase the creepage distance, components separation and so on. The circuit operation
is similar to the S26 we saw last week. The AC input voltage is first converted to DC
using this full bridge rectifier chip that consists of diodes internally. This is then
stepped down using this buck converter and it is converted to about 5V which is used
to control the relay that’s on the other side of the PCB. We also have the flyback
diode that’s needed for protection. The 5V supply is then converted to 3.3V which
is used to power the ESP8266 chip that takes care of wireless connectivity along with the
logic. Lastly, we also have a status LED which is green and a pushbutton switch that can
be used for manual control. You will notice there are a couple of pins marked 3v3, Rx,
Tx and GND which are directly connected to the ESP8266 and these can be used to reprogram
the chip.
In order to use the module with ESPHome, we first need to update the firmware. We have
done this a couple of times before so do check out the home automation playlist if you are
not familiar with the process.
Start by creating a new node in ESPHome. Give it a suitable name, leave the board to the
default value shown here, and then add your WiFi network details to complete the setup.
I would recommend restarting ESPHome at this stage. Then, use the node options to compile
the firmware and then download the binary once it has completed.
We will need a 3.3V USB to serial converter module to update the firmware along with a
couple of jumper cables to connect the two together.
Use the wiring diagram shown on screen to connect it to the board and make sure you
use it in the 3.3V mode as supplying 5V to the ESP8266 may damage it. Now, if you plug
in the USB-serial converter then you will see the green LED glowing, this is the normal
operation mode but we need to switch to the programming mode. That can be done by first
pressing the tactile switch, and then powering ON the USB-serial converter board while keeping
the switch pressed for about 2-3 seconds after powering it ON. The LED will not blink and
this means that we are in the programming node.
Next we need to use the ESPHome flasher tool. If you do not have this then use the link
in the description to download it. Then, open up the ESPHome flasher tool, select the COM
port, binary file and then click this button to flash the firmware. Give it a few seconds
to complete and we are done. All you need to do next is disconnect the USB cable and
then plug it back in so that the board is reset. It will then automatically connect
to your WiFi network, and it will then come online as seen here. You should also receive
a notification at this point and you can click the link here to add it to your setup. Alternatively,
you could also use the configuration and then integrations option to reach this page and
add it.
From this point on, you can disconnect the USB-serial development board and configure
everything wirelessly using over the air updates. However, before we do this, it would be good
to add the configuration for the switch, LED and relay and test out the wireless updates.
Use the link in the description to access this page and then copy the configuration
lines shown here. Open up ESPHome, click the node EDIT button and then paste it in the
configuration file. You can update the names if you want to and once done, simply hit the
upload button and watch it update the node. It will take a couple of seconds to complete
and once done, the board will automatically come back online and we can then control it.
In order to control the unit, we need to add the entities to the dashboard. Head over to
the configurations option, then integrations and click the node name to open this window.
Click the device name to view the entity list and then use this option down below to add
it to the dashboard. If you return to the dashboard then you will be able to view all
the available options. You can view the button status, control the relay or output and also
view the LED status. The uptime, signal strength and version numbers are optional and you can
remove them to make it a bit cleaner if you don’t need them. This can be done by editing
the dashboard, then the node and removing the entities you do not want. Now, if you
toggle the button then you will see that the module switches ON and the green LED reflects
this. You can also control the LED individually if you want to.
Finally, it’s time to test it out with a device connected to it. So desolder the wires
and start placing it inside the enclosure. The screw terminals are slightly offset, which
means you can only insert it the right way around. Then, add the bottom cover to close
it. Please make sure the unit is sealed correctly before you plug it into the mains. I have
used a power cord to connect the unit to the mains using a plug and the other end is connected
to a lamp holder.
Keep in mind that the Sonoff basic only has terminals for the power pins and not earth.
So if your device uses the earth connection then please make sure this is still retained
as otherwise it is a safety hazard. If you don’t know how to do this then please just
use a Sonoff S26 like we did in the last video as this provides the earth connection as well.
Please do remember to add the covers along with the screws so that the wires are not
exposed. Once done, plug in the unit along with a lamp and you can then use the dashboard
to control the device. If you want manual control then you can press the onboard button
as well and the status will get reflected on the dashboard as can be seen here.
So that’s how you can use the Sonoff basic to control your appliances. Once again, please
do not work with these units if you do not know what you are doing as it can be dangerous.
We will look at a few more devices in the future videos before we put it all together
to create a home automation system. As always, I hope this was useful. Don’t forget to
like, share and subscribe if you haven’t already. Thank you for watching and I will
see you in the next one.