Showing posts with label Tasmota. Show all posts
Showing posts with label Tasmota. Show all posts

Thursday, January 03, 2019

Wi-Fi LED Fairy Light Controller with ESP8266

A DIY Wi-Fi-controlled 5 V switcher for USB LED fairy lights, built around an ESP-12F module running Tasmota firmware. Powered by a battery bank, it lets you toggle garden lights remotely from your phone — no 230 V wiring outdoors and no freezing walks to the power outlet.

LED fairy lights in the garden
LED fairy lights switched on at night

The lights

"USB Fairy Lights" or "USB String Lights" — 10 m / 100 LEDs, available from China for under ~$3. They are 5 V USB-powered and weather-proof (except the USB connector).

USB LED string light product photo
Close-up of the LED string circuit

The 100-LED circuit with 5.1 Ohm series resistor — consumes ~1.8 W at 5 V.

Close-up of a single LED

Close-up of a single LED — brightness difference between first and last LED is barely noticeable from a distance.

The ESP-12F 5 V switcher

An ESP-12F module with a MOSFET switches the USB 5 V supply to the LED string. Running Tasmota firmware, it connects to your Wi-Fi network and can be controlled from a phone or any MQTT/HTTP client.

ESP-12F switcher board — front
ESP-12F switcher board — rear
Complete setup — battery bank, ESP switcher, and LED string

Complete setup — battery bank, ESP-12F switcher, and LED fairy lights.

With Tasmota's default configuration (no deep sleep), the battery bank needs recharging every few days. A larger battery and ESP8266 deep sleep could extend runtime to weeks.

Assembly

Before starting, ensure the ESP-12F module is pre-programmed with Tasmota (or any OTA-capable firmware). See ESP-12F programming guide for first-time flashing.

Items needed:

Parts laid out for the build

Step 1:

Assembly step 1

Step 2:

Assembly step 2

Step 3:

Assembly step 3

Step 4:

Assembly step 4

Step 5:

Assembly step 5

Step 6:

Assembly step 6

Step 7:

Assembly step 7

Step 8:

Assembly step 8

Step 9:

Assembly step 9

Final assembly:

Completed switcher assembly
Switcher connected to battery bank and LED string

Completed setup — ESP-12F switcher between battery bank and LED fairy lights.

Tuesday, January 01, 2019

$20 Pocket Router as Domoticz Smart Home Gateway

A custom OpenWrt firmware (autom8box) that packs router + Domoticz server + MQTT broker into an all-in-one home automation gateway running on a ~$20 off-the-shelf GL-MT300N-V2 pocket router.

Domoticz home automation gateway setup diagram

System overview: GL-MT300N-V2 running autom8box firmware as Wi-Fi AP, MQTT broker, and Domoticz server.

The problem

Wi-Fi based home automation products are cheaper than Zigbee or Z-Wave, but they typically require internet connectivity. Letting cloud servers control your home devices is not ideal — internet should be optional, not mandatory.

Thanks to the open-source community (Tasmota, ESPurna, etc.) for helping jailbreak devices like Sonoff, Blitzwolf, and Teckin. But jailbreaking solves only part of the problem — you still need a home automation gateway: Wi-Fi access point + MQTT broker + automation server (Domoticz, OpenHAB, etc.).

What autom8box provides

  • Wi-Fi access point — dedicated network for your IoT devices
  • DHCP and DNS server — automatic network configuration
  • MQTT broker (Mosquitto) — message bus for IoT devices
  • Domoticz — home automation dashboard and rules engine
GL-MT300N-V2 pocket router

GL-MT300N-V2 (~$20) — compact pocket router running the autom8box firmware.

Limitations: Limited Wi-Fi range and a reduced set of Domoticz plugins due to the 16 MB flash limit. But it's a good starting point for low-budget home automation.

Flashing steps

Step 1Download autom8box-mt300nv2.bin.

Step 2 — Power on the GL-MT300N-V2 and wait for its SSID to appear (shown as GL-MT300N-V2-xxx).

GL-MT300N-V2 SSID visible in Wi-Fi list

OEM SSID appearing in the Wi-Fi list.

Step 3 — Connect to the SSID. When prompted for a password, enter goodlife (printed on the device's back sticker).

Wi-Fi password prompt

Enter the default Wi-Fi password.

Step 4 — Once connected, you should see the confirmation message:

Wi-Fi connected confirmation

Successfully connected to the router.

Step 5 — Open a browser and navigate to:
http://192.168.8.1/cgi-bin/luci/admin/system/flashops

LuCI login page

LuCI login — leave the password box empty and click "Login".

Step 6 — In the firmware update section, uncheck "Keep settings", choose autom8box-mt300nv2.bin, then click "Flash Image".

Firmware upload page

Firmware upload — uncheck "Keep settings" and select the autom8box binary.

File selected for flashing

File selected — ready to flash.

Step 7 — Click "Proceed" to confirm:

Flash confirmation dialog

Confirm flashing — click "Proceed".

Step 8 — Wait about 2 minutes for the flash to complete:

Flashing in progress

Firmware flashing in progress — wait for the device to reboot.

Step 9 — After reboot, a new SSID autom8box will appear. Connect with password goodlife.

autom8box SSID in Wi-Fi list

The new autom8box SSID is now visible.

Step 10 — Open http://192.168.8.1:8080 in your browser — Domoticz is ready:

Domoticz dashboard running on autom8box

Domoticz home automation dashboard — running entirely on the pocket router.

Post-setup security

SSH credentials: user root, password goodlife

Change root password:

passwd root

Change Wi-Fi password:

uci set wireless.default_radio0.key=my-new-password
uci commit wireless
wifi

Change SSID:

uci set wireless.default_radio0.ssid=my-new-ssid
uci commit wireless
wifi

Important: autom8box does not auto-save the Domoticz database. After configuring your devices, SSH in and run reboot — during reboot the database is saved from RAM to the persistent partition. A hard power cut without rebooting may lose your configuration.

SOURCE CODE

github.com/hackboxguy/lede-a5v11 — build instructions and sources

autom8box-mt300nv2.bin — pre-built firmware image

Sunday, December 30, 2018

Build a $2 IoT/MQTT Node with a Bare ESP-12F

How to use a bare ESP-12F module as a standalone IoT/MQTT node — powered directly from a USB charger with just a handful of passive components, no base board required. Total cost: under $2.

Completed ESP-12F standalone MQTT node

Finished board — ESP-12F module with USB connector, ready to plug into any 5V charger.

Items needed

Prices based on AliExpress at the time of writing:

  • 1x ESP-12F module (pre-programmed with Tasmota firmware)
  • 1x 10k SMD resistor
  • 1x 10k through-hole resistor
  • 2x 4001 SMD diode
  • 1x USB male connector (PCB mount, SMD)

Schematic

ESP-12F standalone board schematic

Wiring diagram — USB 5V stepped down through two diodes to ~3.6V for the ESP-12F.

Board preparation

Step 1 — Ensure the ESP-12F module is programmed with Tasmota firmware. See the ESP-12F programming post for details.

Step 2 — Mount a 10k SMD resistor between the GND and IO15 pads of the ESP-12F module.

10k SMD resistor between GND and IO15

10k SMD resistor soldered between GND and IO15 pads.

Step 3 — Mount a 10k through-hole resistor between the VCC and EN pads of the ESP-12F module.

10k through-hole resistor between VCC and EN

10k through-hole resistor connecting VCC to EN (chip enable).

Another view of the VCC-EN resistor

Another angle showing the VCC–EN pull-up resistor.

Step 4 — Stick a piece of insulation tape on the right side of the ESP-12F module so the USB connector doesn't short any pads.

Insulation tape applied to ESP-12F

Insulation tape prevents shorts between the USB connector and ESP pads.

Step 5 — Place the USB connector as shown below. The SMD pins of the USB connector should sit over the insulation tape.

USB connector placed on ESP-12F

USB connector positioned over the insulation tape.

Step 6 — On the back side, fix the USB connector to the ESP-12F using hot glue. Don't apply hot glue on the SMD pin side yet — that comes later.

Hot glue fixing USB connector on back side

Hot glue secures the USB connector on the back side.

Step 7 — Solder two SMD diodes in series between the + line of the USB connector and the VCC pad of the ESP-12F module.

Two SMD diodes in series for voltage drop

Two 4001 diodes in series drop 5V USB to ~3.6V for the ESP-12F.

Step 8 — Connect the line of the USB connector to the GND pad of the ESP-12F module.

GND wire from USB to ESP-12F

USB ground connected to the ESP-12F GND pad.

Step 9 — Apply hot glue on both sides of the USB connector and ESP-12F for stability.

Hot glue applied for stability

Hot glue on both sides for mechanical strength.

Completed board from another angle

Completed board — ready for testing.

Testing

Step 10 — Power the board with a 5V USB charger and look for an open Wi-Fi SSID named sonoff-NNNN.

Step 11 — Connect to the SSID and follow the standard Tasmota generic module configuration.

Your $2 IoT/MQTT node is ready. Plug it into any USB charger, configure Tasmota to connect to your MQTT broker, and start automating.

Pogo-Pin Programming Dock for ESP-12F Modules

How to convert a Wemos D1 Mini into a pogo-pin programming dock for flashing Tasmota (or any firmware) onto bare ESP-12F modules — no breadboard wiring needed.

Pogo-pin programming dock for ESP-12F

Completed pogo-pin dock — a modified Wemos D1 Mini ready to flash ESP-12F modules.

Why?

ESP8266-based IoT modules can be purchased from AliExpress for as low as 1.3 EUR. These cheap Wi-Fi modules are handy for many home automation DIY projects, especially when used with open-source firmware like Tasmota. But programming bare ESP-12F modules requires connecting 8 pins — tedious on a breadboard and error-prone with dupont wires.

A pogo-pin dock lets you drop in a module, clip it down, and flash — repeatable and reliable.

Items needed

Items needed for pogo-pin dock

Everything you need to build the programming dock.

  • Wemos D1 Mini board
  • 8 pogo pins
  • ESP-12F module
  • USB-to-Micro-USB cable
  • Clip for holding the ESP module on the pogo-pin dock

Preparation

Step 1 — De-solder the existing ESP module from the Wemos D1 Mini board. This is the most difficult part — you need good soldering skills.

Wemos D1 Mini with ESP module removed

Wemos D1 Mini after removing the original ESP module.

Step 2 — Carefully solder 8 pogo pins onto the exposed ESP pads on the Wemos D1 Mini: TXD0, RXD0, IO0, IO15, GND, VCC, EN, RST.

Pogo pins soldered onto Wemos D1 Mini

Pogo pins soldered onto the exposed ESP pads.

Step 3 — Place a fresh ESP-12F module on the newly prepared dock and secure it with a clip.

ESP-12F module placed on the pogo-pin dock

ESP-12F seated on the pogo-pin dock, ready for flashing.

Pogo-pin dock with clip holding ESP-12F

Clip holds the ESP-12F firmly against the pogo pins during programming.

Flashing firmware

Step 4 — On your Linux host PC, clone esptool and download the Tasmota firmware:

cd ~
git clone https://github.com/espressif/esptool
cd esptool
wget http://thehackbox.org/tasmota/release/sonoff.bin

Step 5 — Connect the USB cable between your host PC and the Wemos D1 dock. Erase the ESP-12F flash:

./esptool.py --port /dev/ttyUSB0 erase_flash

Step 6 — Disconnect and reconnect the USB cable, then flash the Tasmota firmware:

./esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 sonoff.bin

Your ESP-12F module is now flashed and ready for use. Check the next post about using an ESP-12F as a standalone board for home automation projects.

Close-up of pogo pins contacting ESP-12F pads

Close-up showing the pogo pins making contact with the ESP-12F module pads.

Another angle of the pogo-pin dock

Another angle of the completed pogo-pin programming dock.