Tasmotized NodeMCU 8CH Sonoff Relay
by radiowinr in Circuits > Arduino
64302 Views, 52 Favorites, 0 Comments
Tasmotized NodeMCU 8CH Sonoff Relay
This is a NodeMCU Tasmota-Sonoff Firmware Flashed 8CH Relay Control Project
Sonoff-Tasmota is an alternative firmware for ESP8266 based devices like NodeMCU allowing control over WiFi of Smart Home (ioT) Systems.
My idea was to have a 8CH Relays controlled over WiFi with a Tasmota Firmware Flashed (Tasmotized) NodeMCU board.
I was inspired by:
Fastest way to Flash and Configure ESP8266 Based Sonoff Devices with Tasmota or other firmware - by Vicious Computer on Youtube https://youtu.be/UDnNI5wkNNY
How To Change Firmware on Sonoff Devices for use in Home Automation Projects - by DrZzs on Youtube https://youtu.be/KMiP9Ku71To
Flashing SONOFF Tasmota Firmware on NodeMCU By Sarath341 on Instructables
Components and Software Needed
NodeMCU Development Board http://www.nodemcu.com/index_en.html#fr_54745c8bd7...
Sonoff Tasmota Firmware https://github.com/arendst/Sonoff-Tasmota
Termite Software (PC) https://www.compuphase.com/software_termite.htm
Advanced IP Scanner (PC) https://www.advanced-ip-scanner.com/it/
or Finger (Android / IOS APP) https://www.fing.io/
Arduino IDE https://www.arduino.cc/en/Main/Software
8CH Relays Board http://wiki.sunfounder.cc/index.php?title=8_Channe...
Dupont female to female wire https://www.amazon.it/Female-Dupont-Jumper-2-54mm-...
Breadboard https://it.wikipedia.org/wiki/Breadboard
MicroUSB Cable https://www.amazon.com/Anker-PowerLine-Micro-USB-3...
Prerequisites
Download the Sonoff Tasmota Firmware from Github https://github.com/arendst/Sonoff-Tasmota
Make sure you have the ESP8266 Library installed on your Arduino IDE.
If you want to know how to install ESP8266 library properly visit this complete blog of Flashing SONOFF Tasmota Firmware on NodeMCU https://www.factoryforward.com/flashing-sonoff-fi...
Integration
Tasmotized NodeMCU 8CH Relay can be integrated with various IoT platform:
HomeAssistant https://www.home-assistant.io
Yeti (Domotic App for Android and IOS) https://getyeti.co
MQTT Broker https://www.hivemq.com/blog/mqtt-essentials-part-3...
(Configuration example: https://www.tanzolab.it/openhab_sonoff)
(Example of free available MQTT Cloud Broker: https://customer.cloudmqtt.com/login)
It's also possible to direct access the Tasmotized NodeMCU 8CH Relay via its embedded WEB server (either as AP or with DHCP or static IP address) using a Web Browser.
To access the Tasmotized NodeMCU 8CH Relay from the Internet you need to port forward your router to redirect to the Tasmotized NodeMCU 8CH Relay Web Server (see below the Web page accessible via the Web browser)
Web Server of the Tasmotized NodeMCU 8CH Relay
This is the Web server page accessible via your preferred Web browser to direct access to the Tasmotized NodeMCU 8CH Relay and command the 8 relay independently.
From this page it's also possible to configure the Tasmotized device, perform a firmware upgrade and send commands via console to the device.
See also:
Initial Configuration Tasmota Firmware: https://github.com/arendst/Sonoff-Tasmota/wiki/Ini...
Configure Sonoff Tasmota Firmware: https://hobbytronics.pk/config-sonoff-tasmota/
Integrazione SONOFF con MQTT: esempi di programmazione: https://www.tanzolab.it/CM3-HOME_sonoff
Configuration of the Tasmota Firmware Flashed Device
By default, Tasmota Firmware fashed device will be in Sonoff Basic.
So you need to change it to ‘Generic’ in ‘Configuration’ menu.
Click ‘Configuration’ and inside that choose ‘Configure Module’.
Configuration for ESP8266 NodeMCU to Control 8CH Relay Board
Select the board as Generic and Save.
The device will restart.
This option is for all ESP8266 boards.
Now if you click the configuration, then you can able to see more GPIO options.
Using that you can select the GPIO Functions.
Depending on the GPIO setting the option will appear on the Homepage like DHT, Relay, Switch and Many more.
In this project I used:
GIO0 as Relay8 (pin D3 of the NodeMCU) - Connected to the relay pin 8 of the 8CH Relay Board
GPIO2 as Relay7 (pin D4 of the NodeMCU) - Connected to the relay pin 7 of the 8CH Relay Board
GPIO4 as Relay6 (pin D2 of the NodeMCU) - Connected to the relay pin 6 of the 8CH Relay Board
GPIO5 as Realy5 (pin D1 of the NodeMCU) - Connected to the relay pin 5 of the 8CH Relay Board
GPIO12 as Relay2 (pin D6 of the NodeMCU) - Connected to the relay pin 2 of the 8CH Relay Board
GPIO13 as Relay4 (pin D7 of the NodeMCU) - Connected to the relay pin 4 of the 8CH Relay Board
GPIO14 as Relay3 (pin D5 of the NodeMCU) - Connected to the relay pin 3 of the 8CH Relay Board
GPIO15 as Relay2 (pin D8 of the NodeMCU) - Connected to the relay pin 2 of the 8CH Relay Board
GPIO16 as Relay16 (pin D0 of the NodeMCU) - Connected to the relay pin 1 of the 8CH Relay Board
Fritzing Scheme
Fritzing Scheme for the connection between the NodeMCU and the 8CH Relay Board.
Note: VCC is 5V DC
How to Flash Tasmota Firmware on Your ESP8266 Based Device
If you want to flash your ESP8266 device with the Arduino IDE use the sonoff firmware source code from GitHub: https://github.com/arendst/Sonoff-Tasmota
Other way to flash your ESP8266 device is by using the sonoff.bin with ESPTool (https://github.com/arendst/Sonoff-Tasmota/wiki/Esptool) by using Python command line or Platformio IDE.
Here you can download both sonoff.bin or sonoff source code firmware https://github.com/arendst/Sonoff-Tasmota/releases
Home Assistant Integration
How to integrate your Tasmotized NodeMCU 8CH Relay with Home Assistant
Prerequisites:
1. Setup the embedded Home Assistant MQTT broker (or an alternative MQTT broker)
2. Configure the Tasmotized NodeMCU with MQTT parameters of your broker such as Host (IP address), Port (1883 usually), Client, User and Password of your MQTT broker.
This is my configuration.yaml section to integrate the Tasmotized NodeMCU 8CH Relays (as Lights) in my Home assistant Panel:
#Tasmota_Sonoff_8CH_Relay
light:
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH1"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER1"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER1"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH2"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER2"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER2"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH3"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER3"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER3"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH4"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER4"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER4"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH5"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER5"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER5"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH6"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER6"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER6"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH7"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER7"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER7"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- alias: Tasmota_Sonoff_NodeMCU_8CH
platform: mqtt
name: "CH8"
state_topic: "stat/Sonoff_NodeMCU_GS/POWER8"
command_topic: "cmnd/Sonoff_NodeMCU_GS/POWER8"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
References
Sonoff-Tasmota Firmware Wiki: https://github.com/arendst/Sonoff-Tasmota/wiki
Sonoff-Tasmota Firmware: https://github.com/arendst/Sonoff-Tasmota
Flashing SONOFF Firmware on NodeMCU: https://www.factoryforward.com/flashing-sonoff-fi...