本帖最后由 sorrypqa 于 2023-12-23 16:41 编辑
今晚无聊画来玩玩,可以无级调整吊扇、普通交流风扇、交流马达的速度与钨丝灯泡、阻容降压的LED灯的亮度、比较适合当吊扇的调速器,ESP32和ESP-12F只装其中一个就可以了。
PCB制板文件:
Gerber_PCB_可控硅调光控制器.zip
(41.88 KB, 下载次数: 32)
嘉立创开源地址:
https://oshwhub.com/linhuajin/ke ... ng-kong-zhi-qi_copy
参考配置:
substitutions:
device_name: ac-dimmer-01 #设备名称
friendly_name: ac_dimmer_01
led_state_pin: GPIO2 #绿色指示灯引脚
u0txd_pin: GPIO1 #刷机用串口
U0Rxd_pin: GPIO3
esphome:
name: $device_name
comment: 交流调光/调速器。esp-12F模块、DS18B20温度传感器。 #有关此节点的注释文本信息。仅用于在 UI 中显示。
# name_add_mac_suffix: true #设备名字后面添加MAC地址
esp8266:
board: esp01_1m
restore_from_flash: true
preferences:
flash_write_interval: 5min #自定义数据刷新到闪存的频率
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption: #启用API层的传输加密
key: !secret api_key #用于加密的预共享密钥
reboot_timeout: 0s #与客户端(如HA)失去连接多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s
ota:
password: "e52d77214d5c74f9a9b3d44ee2fc678a"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true #快速连接,如果SSID是隐藏的,必须设置为true
reboot_timeout: 48h #WiFi离线多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s
# use_address: ali-switch-01.local #更新设备名称时,需要指定设备旧地址。
# manual_ip:
# static_ip: 192.168.99.111
# gateway: 192.168.99.1
# subnet: 255.255.255.0
# dns1: 114.114.114.114
# dns2: 180.76.76.76
# ap:
# ssid: "${friendly_name}"
# password: !secret ap_password
status_led: #状态指示灯
pin:
number: $led_state_pin
# inverted: true #反转输出状态
captive_portal:
#dallas:
# - pin: GPIO14
# update_interval: 60s
#i2c:
# - id: bh1750_i2c
# sda: $u0txd_pin
# scl: $U0Rxd_pin
# scan: true #启动时搜索I²C地址空间
output:
- platform: ac_dimmer
id: dimmer1
gate_pin: GPIO13 #用于控制可控硅的引脚。
# inverted: true
method: leading pulse
zero_cross_pin: #用于感测交流过零事件的引脚
number: GPIO12
mode:
input: true
# inverted: true
light:
- platform: monochromatic
output: dimmer1
name: "${friendly_name}_Light"
id: "${friendly_name}_Light"
restore_mode: RESTORE_DEFAULT_ON #
on_turn_on:
then:
- light.turn_on:
id: "${friendly_name}_Light"
brightness: 10% #默认亮度
switch:
- platform: restart #重启开关
name: "${friendly_name}_Restart"
icon: mdi:car-esp #自定义图标
- platform: safe_mode
name: "${friendly_name}_SafeMode"
- platform: factory_reset #恢复出厂设置
name: ${friendly_name}_factory
sensor:
- platform: uptime
id: ${friendly_name}_raw_up_time
update_interval: 15min
internal: true
on_raw_value:
then:
- text_sensor.template.publish:
id: ${friendly_name}_uptime_human
state: !lambda |-
int seconds = round(id(${friendly_name}_raw_up_time).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str();
- platform: wifi_signal #WiFi信号强度
name: "${friendly_name}_WiFi_Signal"
icon: mdi:signal #自定义图标
update_interval: 60s
# - platform: dallas
# address: 0xa63de1e380a20028
# name: "${friendly_name}_Temperature"
# - platform: bh1750
# name: "${friendly_name}_Illuminance"
# i2c_id: bh1750_i2c
# address: 0x23
# update_interval: 30s
text_sensor:
- platform: template
name: '${friendly_name}_Uptime'
id: ${friendly_name}_uptime_human
icon: mdi:clock-start #自定义图标
- platform: wifi_info
ip_address:
name: ${friendly_name}_IP #IP地址
icon: mdi:ip-network #自定义图标
ssid:
name: ${friendly_name}_SSID
icon: mdi:wifi #自定义图标
mac_address:
name: ${friendly_name}_mac
icon: "mdi:wifi-marker" #自定义图标
|