Sonoff basic
Introduction
The Sonoff Basic is a relay unit to be used as retrofit. It is based on the ESP8266 chip and can control one relay. A small green LED is onboard which can be controlled using PWM or GPIO commands. Other than normal controlling on and off (of what ever you control with the relay) you can use PWM to control the LED to shine less during the night or whatever.
Hardware
- ESP chip version: ESP8266 (some uses variants of ESP8285)
- Flash size: 1M
- Onboard USB-TTL converter: No
- GPIO's broken out/available to free use: None
- GPIO tied to onboard hardware: 0 (button), 12 (Relay 10A@230VAC), 13 (LED green)
- GPIO free to use: 14 (via)
- Power supply information: 90-250VAC
- Antenna: onboard PCB antenna
Wiring/flashing
A programmer is needed to flash this device.
Programmer ESP TX <--> RX (2nd via) RX <--> TX (3rd via) Power 3.3V <--> VCC (1st via [square]) GND <--> GND (4th via)
In order to get the unit in flash mode the GPIO-0 needs to be LOW. Hold the button pressed during power on. You can release the button just seconds after you have powered the unit, it's now ready for flash.
Soldered pin headers.
ESP Easy
Devices
Switch
Push button active high will make the relay pull when button is released, push button active low will pull the relay (instantaneously) when button is pressed. What you prefer.
Relay
Switch to Relay rule
on button#switch do if [button#switch]=1 gpio,12,1 else gpio,12,0 endif endon
LED rule
Depending if you want the LED to be on or off when the relay is open/closed you may use this rule:
on relay#switch do if [relay#switch]=1 //change this [relay#switch]=0 for LED off when relay is closed gpio,13,1 //or pwm,13,700 else gpio,13,0 //or pwm,13,10 endif endon