Sonoff basic DIY dimmer

This video prompted me to such a homemade product.
Since I have a task for illuminating a barbecue and, in general, now there is an option to make lighting along the contour of the gazebo, I remembered about the basic and the ability to screw a PWM module to it (sold by kilograms for a ridiculous price).

PWM module

5-15-400-MOS-FET-PWM

The characteristics of the module allow you to connect a tape with a wide range of power supply.
I connected a 12V tape.

We find a diode on the BASIC board and cut off the diode. We need one contact (see photo)

Sonoff basic

We collect everything according to the scheme (I’m not an artist, but I hope everything is clear)

Scheme

The code … here’s my favorite ESPHOME and the Home Assistant integration.

Code
esphome:
  name: led-strip
  platform: ESP8266
  board: esp8285

wifi:
  ssid: !secret ssid
  password: !secret password
  use_address: 192.168.0.129
  fast_connect: true
  manual_ip:
    static_ip: 192.168.0.129
    gateway: 192.168.0.1
    subnet: 255.255.255.0
logger:
api:
ota:
web_server:
  port: 80

binary_sensor:
  - platform: gpio
    id: push_buttonled
    name: "Led button"
    pin:
      number: GPIO0
      inverted: True
    on_press:
      then:
        - switch.toggle: led_relay      
      

  - platform: status
    name: "LedStrip Status"



output:
  - platform: esp8266_pwm
    pin: GPIO13
    frequency: 800 Hz
    id: pwm_output   


light:
  - platform: monochromatic
    output: pwm_output
    name: "Led Strip"
    id: led_strip

    on_turn_on:
    - switch.turn_on: led_relay
    on_turn_off:
    - switch.turn_off: led_relay

switch:
  - platform: gpio
    pin: GPIO12
    id: relay_led

  - platform: template
    name: "Led Relay"
    icon: "mdi:led-on"
    optimistic: true
    id: led_relay
    turn_on_action:
    - switch.turn_on: relay_led
    - light.turn_on: led_strip
    turn_off_action:
    - switch.turn_off: relay_led
    - light.turn_off: led_strip

  - platform: template
    name: "Led 100"
    icon: "mdi:led-on"
    optimistic: true
    id: led_100
    turn_on_action:
    - switch.turn_off: led_80
    - switch.turn_off: led_60
    - switch.turn_off: led_40
    - light.turn_on: 
        id: led_strip
        brightness: 100%
        transition_length: 5s
    turn_off_action:
    - switch.turn_off: relay_led
    - light.turn_off: led_strip
        

    
  - platform: template
    name: "Led 80"
    icon: "mdi:led-on"
    optimistic: true
    id: led_80
    turn_on_action:
    - switch.turn_off: led_100
    - switch.turn_off: led_60
    - switch.turn_off: led_40
    - light.turn_on: 
        id: led_strip
        brightness: 80%
        transition_length: 5s
    turn_off_action:
    - switch.turn_off: relay_led
    - light.turn_off: led_strip    
    
  - platform: template
    name: "Led 60"
    icon: "mdi:led-on"
    optimistic: true
    id: led_60
    turn_on_action:
    - switch.turn_off: led_80
    - switch.turn_off: led_100
    - switch.turn_off: led_40
    - light.turn_on: 
        id: led_strip
        brightness: 60%
        transition_length: 5s
    turn_off_action:
    - switch.turn_off: relay_led
    - light.turn_off: led_strip
    
  - platform: template
    name: "Led 40"
    icon: "mdi:led-on"
    optimistic: true
    id: led_40    
    turn_on_action:
    - switch.turn_off: led_80
    - switch.turn_off: led_60
    - switch.turn_off: led_100
    - switch.turn_on: relay_led
    - light.turn_on: 
        id: led_strip
        brightness: 40%
        transition_length: 5s
    turn_off_action:
    - switch.turn_off: relay_led
    - light.turn_off: led_strip
 
  - platform: restart
    name: "LedStrip restart"
    id: ledstrip_restart             


        
sensor:
  - platform: wifi_signal
    name: "LedStrip WiFi Signal"
    update_interval: 120s

text_sensor:
  - platform: wifi_info
    ssid: 
      name: LedStrip ssid
    ip_address:
      name: "LedStrip IP Address"

Made buttons to quickly switch to a given percentage (100, 80, 60 and 40).
The buttons for turning on the tape and the relay turn on and off each other, so that the power supply remains without load and only the BASIC is powered.

Home assistant

Π‘Π½ΠΈΠΌΠΎΠΊ1

sorry for the mistakes, because I write and read English fluently only with a google translator :rofl: :joy: :rofl: :joy:

4 Likes