Hi!
I have the following problem:
I’m using a PWM to control a fan. However, with a PWM duty cycle other than 0% or 100%, my sensors do not deliver values but give the following error for each sensor:
[W][dallas.sensor:130]: 'serverroom_temp_3E28' - Scratch pad checksum invalid!
I ruled out hardware or wiring issues, because I have the same problem with only the temp sensor attached.
It is working with a PWM frequency of 1000Hz, however that’s not usable as the coils of the motor are getting noisy by that.
I tried to solve the problem by turning the fans off while I’m updating the sensor, but that also did not help. (see my attached file)
Setup:
- nodemcu2
- 4 dallas sensors on D0, 4.7k pull up between 3.3v and D0 as recommended
- 4 fans on ports D1-D4
Maybe somebody in this forum can help, I’m grateful for every idea.
name: server-fan
platform: ESP8266
board: nodemcuv2
# temperature
dallas:
- pin: D0
update_interval: never
id: "dallas_sensor"
globals:
- id: fan_1_val
type: float
restore_value: no
initial_value: '0.0'
- id: fan_2_val
type: float
restore_value: no
initial_value: '0.0'
- id: fan_3_val
type: float
restore_value: no
initial_value: '0.0'
- id: fan_4_val
type: float
restore_value: no
initial_value: '0.0'
sensor:
- platform: dallas
address: 0x3500000807BFC128
name: "serverroom_temp_C128"
id: "serverroom_temp_C128"
- platform: dallas
address: 0x3A00000808A43428
name: "serverroom_temp_3428"
id: "serverroom_temp_3428"
- platform: dallas
address: 0xD800000807C93328
name: "serverroom_temp_3328"
id: "serverroom_temp_3328"
- platform: dallas
address: 0x9000000809283E28
name: "serverroom_temp_3E28"
id: "serverroom_temp_3E28"
- platform: template
id: "sensor_noise_reducer"
lambda: |-
id(fan_1).turn_off();
id(fan_2).turn_off();
id(fan_3).turn_off();
id(fan_4).turn_off();
id(dallas_sensor).update();
id(fan_1).turn_on();
id(fan_2).turn_on();
id(fan_3).turn_on();
id(fan_4).turn_on();
id(fan_1).set_level(id(fan_1_val));
id(fan_2).set_level(id(fan_2_val));
id(fan_3).set_level(id(fan_3_val));
id(fan_4).set_level(id(fan_4_val));
return {};
update_interval: 10s
# fans
output:
- platform: esp8266_pwm
pin: D1
frequency: 18000 Hz
id: fan_1
zero_means_zero: true
min_power: 0.3
- platform: esp8266_pwm
pin: D2
frequency: 18000 Hz
id: fan_2
zero_means_zero: true
min_power: 0.3
- platform: esp8266_pwm
pin: D3
frequency: 18000 Hz
id: fan_3
zero_means_zero: true
min_power: 0.3
- platform: esp8266_pwm
pin: D4
frequency: 18000 Hz
id: fan_4
zero_means_zero: true
min_power: 0.3
fan:
- platform: speed
output: fan_1
name: "serverroom_fan_inlet"
id: "serverroom_fan_inlet"
restore_mode: "RESTORE_DEFAULT_ON"
on_speed_set:
then:
- lambda: |-
id(fan_1_val) = id(serverroom_fan_inlet).speed / 100.0;
- platform: speed
output: fan_2
name: "serverroom_fan_outlet"
id: "serverroom_fan_outlet"
restore_mode: "RESTORE_DEFAULT_ON"
on_speed_set:
then:
- lambda: |-
id(fan_2_val) = id(serverroom_fan_outlet).speed / 100.0;
- platform: speed
output: fan_3
name: "serverroom_fan_top"
id: "serverroom_fan_top"
restore_mode: "RESTORE_DEFAULT_ON"
on_speed_set:
then:
- lambda: |-
id(fan_3_val) = id(serverroom_fan_top).speed / 100.0;
- platform: speed
output: fan_4
name: "serverroom_fan_bottom"
id: "serverroom_fan_bottom"
restore_mode: "RESTORE_DEFAULT_ON"
on_speed_set:
then:
- lambda: |-
id(fan_4_val) = id(serverroom_fan_bottom).speed / 100.0;
# Enable logging
logger:
level: INFO
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "secret"
password: "secret"
manual_ip:
static_ip: 10.10.0.191
gateway: 10.10.0.250
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Server-Fan Fallback Hotspot"
password: "secret"
captive_portal: