Ir para conteúdo
3DFinder
Entrar

Você está no 3DFinder

Buscamos em Thingiverse, MakerWorld e Printables ao mesmo tempo para te dar o melhor de cada uma.

Buscar mais como este
Modelo 3D 灯条控制器 por user_3390311866 no MakerWorld

Descrição

led灯条控制器,借用typec接口

配置文件中加入了暂停层,需要自行嵌入螺母,需要m3螺母,m3*8螺丝m3*10沉头螺丝,键盘轴体

esp8266

降压模块

继电器

c口母座

5521母座

kcd1 开关

c2c数据线

测试用的灯条:

esphome 配置

   

web_server:

  port: 80


 

globals:

  - id: option

    type: int

    restore_value: no

    initial_value: '2'


 

  - id: dimmer_lvl

    type: float

    restore_value: no

    initial_value: '0.9'


 

script:

  - id: apply_dimming

    then:

      - lambda: |-

          auto call = id(WS2811).turn_on();

          call.set_brightness(id(dimmer_lvl));

          call.perform();

      - logger.log:

          format: "dimmer_lvl = %.2f"

          args: ['id(dimmer_lvl)']


 

switch:

  - platform: gpio

    name: "relay"

    pin: GPIO3

    id: relay

    restore_mode: RESTORE_DEFAULT_ON

    inverted: no

    on_turn_on:

      - light.turn_off: WS2811

      - delay: 0.1s

    on_turn_off:

      - delay: 0.1s


 

  - platform: template

    id: pure_white

    turn_on_action:

      then:

        - switch.turn_off: warm_white1

        - switch.turn_off: warm_white2

        - switch.turn_off: warm_yellow

        - switch.turn_off: relay

        - light.turn_on:

            id: WS2811

            effect: none

            brightness: !lambda 'return id(dimmer_lvl);'

            red: 100%

            green: 96.8%

            blue: 86.7%

  - platform: template

    id: warm_white1

    turn_on_action:

      then:

        - switch.turn_off: pure_white

        - switch.turn_off: warm_white2

        - switch.turn_off: warm_yellow

        - switch.turn_off: relay

        - light.turn_on:

            id: WS2811

            effect: none

            brightness: !lambda 'return id(dimmer_lvl);'

            red: 100%

            green: 93.7%

            blue: 74.9%

  - platform: template

    id: warm_white2

    turn_on_action:

      then:

        - switch.turn_off: warm_white1

        - switch.turn_off: pure_white

        - switch.turn_off: warm_yellow

        - switch.turn_off: relay

        - light.turn_on:

            id: WS2811

            effect: none

            brightness: !lambda 'return id(dimmer_lvl);'

            red: 100%

            green: 90.98%

            blue: 63.14%

  - platform: template

    id: warm_yellow

    turn_on_action:

      then:

        - switch.turn_off: warm_white1

        - switch.turn_off: warm_white2

        - switch.turn_off: pure_white

        - switch.turn_off: relay

        - light.turn_on:

            id: WS2811

            effect: none

            brightness: !lambda 'return id(dimmer_lvl);'

            red: 100%

            green: 87%

            blue: 50.2%


 

binary_sensor:

 - platform: gpio

   pin:

      number: 15

      inverted: false

   name: "button1"

   id: button1

   on_click:

    - min_length: 20ms

      max_length: 450ms

      then:

          - lambda: |-

              if (id(dimmer_lvl) > 0.9) {

                    id(dimmer_lvl) = 1.0;

                  } else {

                    id(dimmer_lvl) += 0.1;

                  }

                  id(apply_dimming).execute();              

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button1

           then:

            - light.turn_on:

                id: WS2811

                brightness: 100%

            - lambda: |-

                    id(dimmer_lvl) = 1.0;

 

 - platform: gpio

   pin:

      number: 2

      mode:

        input: true

        pullup: True

      inverted: True

   name: "button4"

   id: button4

   on_click:

    - min_length: 20ms

      max_length: 450ms

      then:

          - lambda: |-

              if (id(dimmer_lvl) < 0.7) {

                    id(dimmer_lvl) = 0.6;

                  } else {

                    id(dimmer_lvl) -= 0.1;

                  }

                  id(apply_dimming).execute();    

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button4

           then:

            - light.turn_on:

                id: WS2811

                brightness: 60%

            - lambda: |-

                    id(dimmer_lvl) = 0.6;


 

 - platform: gpio

   pin:

      number: 01

      mode: INPUT_PULLUP

      inverted: True

   name: "button2"

   id: button2

   on_click:

    - min_length: 20ms

      max_length: 450ms

      then:

       - if:

           condition:

             light.is_off: WS2811

           then:

            - if:

               condition:

               - switch.is_on: relay

               then:

                - switch.turn_off: relay

               else:

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 0;

                    then:

                      - switch.turn_on: pure_white

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 1;

                    then:

                      - switch.turn_on: warm_white1

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 2;

                    then:

                      - switch.turn_on: warm_white2

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 3;

                    then:

                       - switch.turn_on: warm_yellow

           else:

            - light.turn_off: WS2811

            - switch.turn_off: relay

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button2

           then:

             - switch.toggle: relay


 

 - platform: gpio

   pin:

      number: 0

      mode:

        input: true

        pullup: True

      inverted: True

   name: "button5"

   id: button5

   on_click:

      - min_length: 20ms

        max_length: 450ms

        then:

          - lambda: |-

              if (id(option) > 2) {

                    id(option) = 0;

                  } else {

                    id(option) += 1;

                  }

          - if:

              condition:

                lambda: |-

                  return id(option) == 0;

              then:

                - switch.turn_on: pure_white

          - if:

              condition:

                lambda: |-

                  return id(option) == 1;

              then:

                - switch.turn_on: warm_white1

          - if:

              condition:

                lambda: |-

                  return id(option) == 2;

              then:

                - switch.turn_on: warm_white2

          - if:

              condition:

                lambda: |-

                  return id(option) == 3;

              then:

                 - switch.turn_on: warm_yellow

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button5

           then:

            - if:

               condition:

               - switch.is_on: relay

               then:

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 0;

                    then:

                      - switch.turn_on: pure_white

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 1;

                    then:

                      - switch.turn_on: warm_white1

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 2;

                    then:

                      - switch.turn_on: warm_white2

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 3;

                    then:

                       - switch.turn_on: warm_yellow

               else:

               - switch.turn_on: relay


 

light:

  - platform: neopixelbus

    type: GRB

    variant: WS2811

    pin: GPIO13

    num_leds: 14

    name: "NeoPixel Light"

    id: WS2811

    on_turn_on:

      then:

      - switch.turn_off: relay

    effects:

      - random:

          name: "Slow Random Effect"

          transition_length: 30s

          update_interval: 30s

      - addressable_rainbow:

      - addressable_twinkle:

      - addressable_random_twinkle:

    default_transition_length: 1s

 

也可以将继电器改为mos管

 

web_server:

  port: 80


 

globals:

  - id: option

    type: int

    restore_value: no

    initial_value: '2'


 

  - id: dimmer_lvl

    type: float

    restore_value: no

    initial_value: '0.9'


 

script:

  - id: apply_dimming

    then:

        - light.control:

            id: relay

            brightness: !lambda 'return id(dimmer_lvl);'

        - light.control:

            id: WS2811

            brightness: !lambda 'return id(dimmer_lvl);'

 

  - id: pure_white

    then:

        - light.control:

            id: WS2811

            effect: none

            red: 100%

            green: 96.8%

            blue: 86.7%


 

  - id: warm_white1

    then:

        - light.control:

            id: WS2811

            effect: none

            red: 100%

            green: 93.7%

            blue: 74.9%


 

  - id: warm_white2

    then:

        - light.control:

            id: WS2811

            effect: none

            red: 100%

            green: 90.98%

            blue: 63.14%


 

  - id: warm_yellow

    then:

        - light.control:

            id: WS2811

            effect: none

            red: 100%

            green: 87%

            blue: 50.2%


 

  - id: color_temperature

    then:

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 0;

                    then:

                      - script.execute: pure_white

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 1;

                    then:

                      - script.execute: warm_white1

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 2;

                    then:

                      - script.execute: warm_white2

                - if:

                    condition:

                      lambda: |-

                        return id(option) == 3;

                    then:

                       - script.execute: warm_yellow


 

button:

  - platform: template

    name: pure_white

    on_press:

      then:

        - script.execute: pure_white


 

  - platform: template

    name: warm_white1

    on_press:

      then:

        - script.execute: warm_white1


 

  - platform: template

    name: warm_white2

    on_press:

      then:

        - script.execute: warm_white2


 

  - platform: template

    name: warm_yellow

    on_press:

      then:

        - script.execute: warm_yellow


 

binary_sensor:

 - platform: gpio

   pin:

      number: 15

      inverted: false

   name: "button1"

   id: button1

   on_click:

    - min_length: 20ms

      max_length: 450ms

      then:

          - lambda: |-

              if (id(dimmer_lvl) > 0.9) {

                    id(dimmer_lvl) = 1.0;

                  } else {

                    id(dimmer_lvl) += 0.1;

                  }

                  id(apply_dimming).execute();        

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button1

           then:

            - light.control:

                id: WS2811

                brightness: 100%

            - light.control:

                id: relay

                brightness: 100%

            - lambda: |-

                    id(dimmer_lvl) = 1.0;

 

 - platform: gpio

   pin:

      number: 0

      mode:

        input: true

        pullup: True

      inverted: True

   name: "button4"

   id: button4

   on_click:

    - min_length: 20ms

      max_length: 450ms

      then:

          - lambda: |-

              if (id(dimmer_lvl) < 0.7) {

                    id(dimmer_lvl) = 0.6;

                  } else {

                    id(dimmer_lvl) -= 0.1;

                  }

                  id(apply_dimming).execute();

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button4

           then:

            - light.control:

                id: WS2811

                brightness: 60%

            - light.control:

                id: relay

                brightness: 60%

            - lambda: |-

                    id(dimmer_lvl) = 0.6;


 

 - platform: gpio

   pin:

      number: 2

      mode: INPUT_PULLUP

      inverted: True

   name: "button2"

   id: button2

   on_click:

    - min_length: 20ms

      max_length: 450ms

      then:

       - if:

           condition:

             light.is_off: WS2811

           then:

            - if:

               condition:

               - light.is_on: relay

               then:

                - light.turn_off: relay

               else:

                - script.execute: color_temperature

                - light.turn_on: WS2811

           else:

            - light.turn_off: WS2811

            - light.turn_off: relay

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button2

           then:

             - light.toggle: relay


 

 - platform: gpio

   pin:

      number: 1

      mode:

        input: true

        pullup: True

      inverted: True

   name: "button5"

   id: button5

   on_click:

      - min_length: 20ms

        max_length: 450ms

        then:

          - lambda: |-

              if (id(option) > 2) {

                    id(option) = 0;

                  } else {

                    id(option) += 1;

                  }

          - script.execute: color_temperature

          - light.turn_on: WS2811

   on_press:

      then:

       - delay: 0.5s

       - if:

           condition:

             binary_sensor.is_on: button5

           then:

            - if:

               condition:

               - light.is_on: relay

               then:

               - script.execute: color_temperature

               - light.turn_on: WS2811

               else:

               - light.turn_on: relay


 

output:

  - platform: esp8266_pwm

    pin: GPIO3

    id: pwm

    min_power: 0%

    frequency: 3000 Hz


 

light:

  - platform: neopixelbus

    type: GRB

    variant: WS2811

    pin: GPIO13

    num_leds: 12

    name: "NeoPixel Light"

    id: WS2811

    on_turn_on:

      then:

      - light.turn_off: relay

      - light.control:

         id: WS2811

         brightness: !lambda 'return id(dimmer_lvl);'

    effects:

      - random:

          name: "Slow Random Effect"

          transition_length: 30s

          update_interval: 30s

      - addressable_rainbow:

      - addressable_twinkle:

      - addressable_random_twinkle:

    default_transition_length: 1s


 

  - platform: monochromatic

    name: Dimmer_Light

    output: pwm

    default_transition_length: 0s

    restore_mode: RESTORE_DEFAULT_ON

    id: relay

    on_turn_on:

      - light.turn_off: WS2811

      - light.control:

         id: relay

         brightness: !lambda 'return id(dimmer_lvl);'

      - delay: 0.1s

    on_turn_off:

      - delay: 0.1s

MakerWorld

灯条控制器

Publicado em 29 de jul de 2025

2
Curtidas
0
Downloads
3
Coleções
Categoria Other Hobby & DIY
Tags
LED
Licença BY-NC-SA
Ver no MakerWorld (abre em nova aba)