User Tools

Site Tools


doc:appunti:hardware:sonoff

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
doc:appunti:hardware:sonoff [2021/01/20 16:54] – created niccolodoc:appunti:hardware:sonoff [2021/01/20 17:07] – [Flashing the Tasmota firmware] niccolo
Line 1: Line 1:
-====== IoT - Sonoff Basic R2 ======+====== Internet of Things: Sonoff Basic R2 ======
  
-{{.:sonoff:sonoff-basic.jpg?300 |The Sonoff Basic Smart Switch}} 
 Il vantaggio di quesi **power switch intelligenti** marchiati **Sonoff**, è che sono facilmente programmabili con il firmware **[[https://tasmota.github.io/docs/|Tasmota]]**. Tasmota è un progetto **free ed open source** che consente di realizzare la propria infrastruttura **IoT** totalmente indipendente da qualunque architettura cloud di terze parti. In pratica è possibile gestire i dispositivi basati sul **chip ESP8266** utilizzando protocolli aperti (**MQTT**) e creando il proprio server cloud, ad esempio con il broker MQTT **mosquitto**, ed utilizzando i più vari MQTT client, come ad esempio **[[https://www.home-assistant.io/|Home Assistant]]**. Il vantaggio di quesi **power switch intelligenti** marchiati **Sonoff**, è che sono facilmente programmabili con il firmware **[[https://tasmota.github.io/docs/|Tasmota]]**. Tasmota è un progetto **free ed open source** che consente di realizzare la propria infrastruttura **IoT** totalmente indipendente da qualunque architettura cloud di terze parti. In pratica è possibile gestire i dispositivi basati sul **chip ESP8266** utilizzando protocolli aperti (**MQTT**) e creando il proprio server cloud, ad esempio con il broker MQTT **mosquitto**, ed utilizzando i più vari MQTT client, come ad esempio **[[https://www.home-assistant.io/|Home Assistant]]**.
  
-{{.:sonoff:sonoff-basic-r2-case.jpg?340|Sonoff Basic R2: Opening the case}}+The main advantage of **Sonoff** branded **smart power switches** is that they are easily programmable with the **[[https://tasmota.github.io/docs/|Tasmota]]** firmware. Tasmota is a free and open source software that allows you to create your own **IoT** infrastructure totally independent from any third-party cloud architecture. In practice, it is possible to manage devices based on the **ESP8266 chip** using open protocols (**MQTT**) and creating your own cloud server, for example with the MQTT **mosquitto** broker, and using the most various MQTT clients, such as **[[https://www.home-assistant.io/|Home Assistant]]**. 
 + 
 +{{.:sonoff:sonoff-basic.jpg?360|The Sonoff Basic Smart Switch}}
  
 To **open the plastic case** of the Sonoff Basic R2 you have to unlock the four **snap fit joints**: there are two on each of the long edges. To **open the plastic case** of the Sonoff Basic R2 you have to unlock the four **snap fit joints**: there are two on each of the long edges.
 +
 +{{.:sonoff:sonoff-basic-r2-case.jpg?340|Sonoff Basic R2: Opening the case}}
 +
 +In the following pictures you can see the **pin headers** that I soldered on the PCB, that pin will be used to connect the USB to serial adapter used to **flash the Tasmota firmware**.
  
 {{.:sonoff:sonoff-basic-r2-components.jpg?340|Sonoff Basic R2: Components }} {{.:sonoff:sonoff-basic-r2-components.jpg?340|Sonoff Basic R2: Components }}
Line 14: Line 19:
 {{.:sonoff:sonoff-basic-r2-antenna.jpg?200|Sonoff Basic R2: ESP8285 chip and antenna}} {{.:sonoff:sonoff-basic-r2-antenna.jpg?200|Sonoff Basic R2: ESP8285 chip and antenna}}
  
-==== Tools required to flash the Tasmota firmware ====+===== Tools required to flash the Tasmota firmware =====
  
   - **Pin headers** to be soldered on the Sonoff Basic PCB.   - **Pin headers** to be soldered on the Sonoff Basic PCB.
Line 24: Line 29:
  
 The Tasmota firmware can be downloaded from the **[[https://github.com/arendst/Tasmota/|Tasmota GitHub repository]]**, I used the **tasmota.bin** version 9.2.0 found into the **[[https://github.com/arendst/Tasmota/releases/tag/v9.2.0|download page]]**. The Tasmota firmware can be downloaded from the **[[https://github.com/arendst/Tasmota/|Tasmota GitHub repository]]**, I used the **tasmota.bin** version 9.2.0 found into the **[[https://github.com/arendst/Tasmota/releases/tag/v9.2.0|download page]]**.
-==== Flashing the Tasmota firmware ====+ 
 +===== Flashing the Tasmota firmware =====
  
 To flash the Tasmota firmware I used a **GNU/Linux** computer and an **USB to serial** adapter based on the **CP210x** chip. With the help of a multimeter I verified that the adapter provides the **3.3 Volt** power on the proper pin: this current is used to power the Sonoff device during the flash. To flash the Tasmota firmware I used a **GNU/Linux** computer and an **USB to serial** adapter based on the **CP210x** chip. With the help of a multimeter I verified that the adapter provides the **3.3 Volt** power on the proper pin: this current is used to power the Sonoff device during the flash.
Line 83: Line 89:
 ^ CORS Domain  | If empty (default) Tasmota allows HTTP requests only from the connecting client. You can specify an asterisk to allow the sharing of resources with any domains, or you can specify just one URL (e.g. **%%http://host.domain.tld%%**) which will be the only one domain allowed to share Tasmota HTTP resources.  | ^ CORS Domain  | If empty (default) Tasmota allows HTTP requests only from the connecting client. You can specify an asterisk to allow the sharing of resources with any domains, or you can specify just one URL (e.g. **%%http://host.domain.tld%%**) which will be the only one domain allowed to share Tasmota HTTP resources.  |
  
-=== Hardware Module Configuration ===+==== Hardware Module Configuration ====
  
 After WiFi configuration, you can reboot the Tasmota device, wait unitll **it gets an address from your WiFi Access Point** and **complete the configuration**; you have to tell to the Tasmota firmware what hardware it can control. After WiFi configuration, you can reboot the Tasmota device, wait unitll **it gets an address from your WiFi Access Point** and **complete the configuration**; you have to tell to the Tasmota firmware what hardware it can control.
Line 94: Line 100:
     * Connecto to the web interface, **Main Menu** => **Console** and enter the command **WifiConfig 5**. This means //wait until selected AP is available again without rebooting//. Beware that the //6 short presses// of the button (see below) will revert to WifiConfig 2.     * Connecto to the web interface, **Main Menu** => **Console** and enter the command **WifiConfig 5**. This means //wait until selected AP is available again without rebooting//. Beware that the //6 short presses// of the button (see below) will revert to WifiConfig 2.
  
-=== Button Reset ===+==== Button Reset ====
  
 If you have trouble connecting to a Tasmota device and the device have a button, you have at least two methods to try to recover. If you have trouble connecting to a Tasmota device and the device have a button, you have at least two methods to try to recover.