Esphome stand alone 120 volt AC blower or fan speed controller.
You can manually control the speed using a button or set it to automatically adjust based on temperature ranges, with or without Home Assistant automation or a constant network connection.
Components:
Robotdyn AC Dimmer Module, 1 Channel
ESP32D or better.
DS18B20 digital thermometer can be surface mounted.
Protoboard with connections for AC dimmer and Temperature sensor.
Can set up with percentage steps with temperature range using on_value_range:
or if use of fan.cycle_speed
Action` if you have speed count set.
or a each button press using a button.
Each button press will increase speed by cycling. through from on, 1, 2, 3, 4, 5 to off.
when using a button.
- platform: gpio
pin:
number: GPIO15
mode:
input: true
pullup: true
inverted: true
id: fanbutton
name: fan button
filters:
- delayed_off: 20ms
on_press:
- fan.cycle_speed: fan_speeds
Full ESPHOME Yaml
esphome:
name: esp32-test
friendly_name: esp32 test
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
# Open web port for browser access
web_server:
version: 3
port: 80
captive_portal:
text_sensor:
- platform: wifi_info
ip_address:
name: IP
bssid:
name: BSSID
mac_address:
name: MAC
binary_sensor:
- platform: status
name: Online
id: ink_ha_connected
- platform: gpio
pin:
number: GPIO15
mode:
input: true
pullup: true
inverted: true
id: fanbutton
name: fan button
filters:
- delayed_off: 20ms
#uncomment below if using speed count and a button press and not temperature control.
# on_press:
# - fan.cycle_speed: fan_speeds
button:
- platform: restart
icon: mdi:power-cycle
name: "ESP Reboot"
output:
- platform: ac_dimmer
id: pellet_fan_dimmer
gate_pin: GPIO16 # D16
zero_cross_pin:
number: GPIO19 #
min_power: 40%
method: LEADING
# best results with fan motor LEADING
#leading pulse: (default) a short pulse to trigger a triac.
#leading: gate pin driven high until the zero cross is detected
#trailing: gate pin driven high from zero cross until dim period, this method is suitable for mosfet dimmers only.
# one wire for use with Dallas sensor can connect several sensors to one one using Address of each.
one_wire:
- platform: gpio
pin: GPIO4 # D4
sensor:
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "Signal"
id: wifi_signal_db
update_interval: 120s
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
- platform: uptime
name: Uptime
state_class: measurement
device_class: duration
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
state_class: measurement
device_class: SIGNAL_STRENGTH
# the fan motor will studder each time the Dallas sensor updates.
# Found using 8266 such as D1 mini it would crash board.
- platform: dallas_temp
address: 0x31000000420c1628
id: dallastemp3
name: "esp test temperature"
icon: "mdi:thermometer"
device_class: "temperature"
#Filter to show in F in web portal
# uncomment below
# filters:
# - lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°C"
accuracy_decimals: 2
update_interval: 60s
#automation to set fan speed on temperature range.
# temper range set in C⁰ for values below
# if using speed count change speeds below accordingly
on_value_range:
- above: 95
below: 200
then:
- fan.turn_on:
id: fan_speeds
speed: 100
- above: 80
below: 95
then:
- fan.turn_on:
id: fan_speeds
speed: 80
- above: 65
below: 80
then:
- fan.turn_on:
id: fan_speeds
speed: 70
- above: 60
below: 75
then:
- fan.turn_on:
id: fan_speeds
speed: 65
- above: 50
below: 60
then:
- fan.turn_on:
id: fan_speeds
speed: 50
- above: 40
below: 50
then:
- fan.turn_on:
id: fan_speeds
speed: 30
- below: 35
then:
- fan.turn_off:
id: fan_speeds
fan:
- platform: speed
id: fan_speeds
output: pellet_fan_dimmer
name: "esp test fan"
#option if using a button set speed count. uncomment below
# speed_count: 5
# condition to be sure the fan shuts off and on at low and high temperature set points because speeds will only change when passing the temperature thresholds in the on value range automation above.
# temper range set in C⁰ for values below
on_turn_off:
- if:
condition:
sensor.in_range:
id: dallastemp3
above: 35
below: 90
then:
- fan.turn_on: fan_speeds
on_turn_on:
- if:
condition:
sensor.in_range:
id: dallastemp3
below: 32
then:
- fan.turn_off: fan_speeds
I’m using an ESP32 with an AC dimmer to control a pellet stove’s room air blower speed, adjusting it based on different temperature ranges.
Esp web portal page.
Home assistant dashboard
Fahrenheit Sensor Entity for use in Home Assistant
Sensor template in home assistant template.yaml to convert C° to F °
- sensors:
stove_temp_in_c:
friendly_name: "stove temp in C°"
unique_id: stovetemp11111
value_template: '{{ "%.2f"|format((( states("sensor.pellet_controller_fan_stove_fan_temperature") | float ) -32) *5/9) }}'