Revision [2824]

This is an old revision of SonoffSetup2017 made by ZorrUno on 2017-09-07 13:37:59.

 

Flashing and using a Sonoff with Tasmota firmware


Final Setup Test

Once flashed, I set the 'startup mode' to be on, so it can be used as a normal switch. I didn't really have to worry about running buttons into it's i/o. Then, whenever mains is switched on, it turns on... and turn on time seems to be about half a second. About 25 seconds later it will pick up the on/off value from mqtt server (if it is available)

Advantages with this setup:
I can just chuck in a sonoff in a light circuit anywhere, and set it up. I use the existing main switch - and it works normally without any mqtt server running. Later I put some buttons in another flush box beside the mains switch, and cover the mains switch with a flip pdl plates.

I then get:
- local mains isolation with the pdl switch (but covered so it isn't bumped)
- lights useable with no mqtt and/or wifi running... with the following disadvantages:
...... I'll be wasting power if power outage occurs and wifi/mqtt doesn't come back up
...... There will be some annoyance in a power outage, with possibly 30 seconds of lighting at night after a power cut until sonoff connects back to wifi/mqtt
- ability to split lighting ccts in the ceiling space (no need to get into the mains flush box... just throw in more cable and another sonoff)
- can put a ceiling fan on the same isolation cct, but control it with sonoffs (using 4 channel)
..... obviously this only works with wifi/mqtt running though




Devices

https://www.itead.cc/sonoff-wifi-wireless-switch.html

useful youtube tutorials

https://www.youtube.com/watch?v=n4MDRm2yAJg
http://www.andremiller.net/content/programming-an-itead-sonoff-wireless-smart-switch-esp8266

Tasmota

Tasmota Firmware - clone as a zip
https://github.com/arendst/Sonoff-Tasmota

Atom Text Editor with platform i/o

- install Atom https://atom.io/
- install packages, "platform-ide"
- had issues with Clang in Ubuntu... Go to Atom's Preferences menu, click packages, autocomplete-clang, settings, and change 'Clang Command" from "clang" to clang-4.0 (or the version running on your linux)
- Open Project, click on the Sonoff-Tasmota-Master folder

Isues with USB serial

- in Ubuntu, I needed to add my user to the dialout group

Setup the firmware & flash

- Update the user_config.h with wireless SSID, Password and MQTT server details
- save

Connect Sonoff

- solder the board pins (see tutorials everywhere)
- Set up a usb ftdi/serial programmer (I got a ch340g for $8 from trademe)
- make sure you set it to 3.3V...
- connect up the sonoff in programming mode (hold button and power up, release)
- in Atom PlatformIO menu, click upload

Monitor the serial happenings

- Use Atoms inbuilt serial monitor 115200, /dev/ttyUSB0 (in my case)
- check serial data for IP of device and that it connects to wifi etc

Configure it more on its web interface if you like

- my device is at http://192.168.1.113/ - it runs a web server for config etc
- Can also add new firmware like this if needed

MQTT

- Get a MQTT client, I used MQTTlens for chrome, mqttfx was too flakey
- subscribe to stat/sonoff/power
- publish cmnd/sonoff/power toggle (or on/off)

--
CategoryMicrocontrol
CategoryHomeAutomation
CategoryLinux
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki