本帖最后由 shadowba 于 2024-11-2 20:25 编辑
手头有一个富裕的服务器电源,想做个取电板,百度了一下有大神做的是CSRS通过I2C接入esphome,本人尝试了一下利用CRPS上的I2C接入,失败了!不通用,而且本人编程小白,所以还是果断放弃,另辟蹊径
本板可以实现两路电源的通断控制;
3路电源输出电流、电压、功率、电能、监测;
温度监测
预留CRPS电源I2C接入接口,供后期大神接入
预留内置风扇的PWM控制接口,以便日后对内置控制控制的需求;
上电后延时自动开启电源,开启两路输出(可esphome自定义调整)。
先上效果图:
加个班,焊接:
装机:
OK啦:
打完收工!
附嘉立创打板文件和编程小白的代码,原件参数基本在板子上都标出来了
globals:
# flash保存昨日抄表数(每天0点更新保存)
- id: global_yesterday_energy
type: float
restore_value: yes
initial_value: '0.000'
esphome:
name: "crps-power"
friendly_name: "crps-power"
on_boot:
priority: 600
then:
- delay: 5s
- switch.turn_on: switch0
- delay: 1s
- switch.turn_on: switch1
- delay: 1s
- switch.turn_on: switch2
comment: 服务器电源、功率监测、ONU和ROUTER通断控制、温度监测等
esp8266:
board: esp01_1m
api:
reboot_timeout: 0s
ota:
- platform: esphome
password: "143752f111a57aa407c64a6f10d5f408"
web_server:
port: 80 # web端口
wifi:
networks:
- ssid:
password:
reboot_timeout: 0s
ap:
ssid: "crps-power Fallback Hotspot"
password: "kp1uMJ8NFcRQ"
captive_portal:
i2c:
- id: bus_a
sda: GPIO4
scl: GPIO5
scan: true
time:
- platform: homeassistant
id: homeassistant_time
timezone: UTC-8
on_time:
- seconds: 0
minutes: 0
hours: 0
then:
- if:
condition:
time.has_time:
then:
- lambda: |-
id(global_yesterday_energy) = id(CRPS_energy).state;
sensor:
- platform: ntc
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: NTC Temperature
- platform: resistance
id: resistance_sensor
sensor: source_sensor
configuration: DOWNSTREAM
resistor: 27kOhm
- platform: adc
id: source_sensor
pin: A0
update_interval: 60s
- platform: uptime
name: Uptime Sensor
- platform: wifi_signal
name: "CRPS WiFi Signal"
update_interval: 60s
- platform: ina3221
address: 0x40
channel_1:
shunt_resistance: 0.02 ohm
current:
id: current1
name: "CRPS Channel 1 Current"
power:
id: power1
name: "CRPS Channel 1 Power"
bus_voltage:
name: "CRPS Channel 1 Bus Voltage"
shunt_voltage:
name: "CRPS Channel 1 Shunt Voltage"
channel_2:
shunt_resistance: 0.02 ohm
current:
id: current2
name: "CRPS Channel 2 Current"
power:
id: power2
name: "CRPS Channel 2 Power"
bus_voltage:
name: "CRPS Channel 2 Bus Voltage"
shunt_voltage:
name: "CRPS Channel 2 Shunt Voltage"
channel_3:
shunt_resistance: 0.02 ohm
current:
id: current3
name: "CRPS Channel 3 Current"
power:
id: power3
name: "CRPS Channel 3 Power"
bus_voltage:
name: "CRPS Channel 3 Bus Voltage"
shunt_voltage:
name: "CRPS Channel 3 Shunt Voltage"
- platform: total_daily_energy
name: CRPS Channel 1 energy
power_id: power1
id: energy1
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
- multiply: 0.001
- platform: total_daily_energy
name: CRPS Channel 2 energy
power_id: power2
id: energy2
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
- multiply: 0.001
- platform: total_daily_energy
name: CRPS Channel 3 energy
power_id: power3
id: energy3
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
- multiply: 0.001
- platform: template
name: Total_Daily_CRPS_Energy
id: CRPS_energy
update_interval: 60s
unit_of_measurement: 'kWh'
lambda:
return id(energy1).state + id(energy2).state + id(energy3).state;
- platform: template
name: CRPS_total_Power
id: CRPS_power
update_interval: 60s
unit_of_measurement: 'W'
lambda:
return id(power1).state + id(power2).state + id(power3).state;
- platform: template
name: CRPS_total_Current
id: CRPS_current
update_interval: 60s
unit_of_measurement: 'A'
lambda:
return id(current1).state + id(current2).state + id(current3).state;
- platform: template
name: Yesterday Energy
id: yesterday_energy
accuracy_decimals: 3
device_class: "energy"
state_class: "total_increasing"
icon: mdi:lightning-bolt
unit_of_measurement: kWh
update_interval: 60s
lambda:
return id(global_yesterday_energy);
binary_sensor:
- platform: gpio
id: button
pin:
number: GPIO15
mode:
input: true
pullup: true
inverted: true
on_click:
- min_length: 3s
max_length: 5s
then:
- switch.toggle: switch0
- min_length: 50ms
max_length: 350ms
then:
- switch.toggle: switch2
- platform: gpio
id: button1
pin:
number: GPIO0
mode:
input: true
pullup: true
inverted: true
on_press:
then:
- switch.toggle: switch1
switch:
- platform: gpio
pin: 2
id: switch0
name: CRPS_switch0
- platform: gpio
pin:
number: GPIO14
# inverted: true
id: switch1
name: ROUTER_switch1
on_turn_off:
then:
- delay:
seconds: 4
- switch.turn_on: switch1
- platform: gpio
pin:
number: GPIO13
# inverted: true
id: switch2
name: ONU_switch2
on_turn_off:
then:
- delay:
seconds: 3
- switch.turn_on: switch2
Gerber_PCB1_2024-08-28.zip
(147.25 KB, 下载次数: 5, 售价: 5 金钱)
物料清单
BOM_Board1_Schematic1_2024-08-28.xlsx
(9.96 KB, 下载次数: 8)
|