I connected the frequency inverter with a Wemos D1 mini and Esphome. For this, a TTL to RS485 converter, 3.3V/5V, is needed.
Something like in this link
SCL pin from D1 mini goes to RX on the RS485 convertor and SDA goes to TX
In the code you have low speed (30Hz) and high speed (50Hz) for the pump. Also it will display current and power consumption of the pump.
# Configure software UART on SDA (GPIO4) and SCL (GPIO5)
uart:
- id: modbus_uart
tx_pin: GPIO4 # SDA (D1)
rx_pin: GPIO5 # SCL (D2)
baud_rate: 9600
stop_bits: 2
parity: NONE
data_bits: 8
modbus:
id: mod_bus_inverter
modbus_controller:
id: inverter
address: 1
modbus_id: mod_bus_inverter
update_interval: 5s
command_throttle: 1000ms
switch:
- platform: template
id: high_speed
name: "high_speed"
optimistic: true
turn_on_action:
- uart.write:
id: modbus_uart
data: [0x01, 0x06, 0x10, 0x00, 0x27, 0x10, 0x97, 0x36] # vitesse 50Hz
turn_off_action:
- uart.write:
id: modbus_uart
data: [0x01, 0x06, 0x10, 0x00, 0x17, 0x70, 0x83, 0x1E] # vitesse 30 Hz
- platform: template
id: pump_activation
name: "pump_activation"
optimistic: true
restore_mode: ALWAYS_OFF
turn_on_action:
- switch.turn_on: inverter_supply # convertisseur on
- delay: 1s
- switch.turn_on: high_speed
- delay: 2s
- uart.write:
id: modbus_uart
data: [0x01, 0x06, 0x20, 0x00, 0x00, 0x01, 0x43, 0xCA] # Start
- delay: 2s
#- switch.turn_off: high_speed
turn_off_action:
- uart.write:
id: modbus_uart
data: [0x01, 0x06, 0x20, 0x00, 0x00, 0x06, 0x02, 0x08] # Stop
- delay: 1s
- switch.turn_on: high_speed
- delay: 5s
- switch.turn_off: inverter_supply # convertisseur off
# Define inverter_supply switch if used
- platform: gpio
id: inverter_supply
name: "Inverter Supply"
pin: GPIO12 # Change to the actual GPIO controlling your inverter power
sensor:
- platform: modbus_controller
modbus_controller_id: inverter
id: inverter_current
name: "Pump curent"
address: 0x7004
register_type: holding
value_type: S_WORD
unit_of_measurement: "A"
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: inverter
id: inverter_power
name: "Pump power"
address: 0x7005
register_type: holding
value_type: S_WORD
unit_of_measurement: "Kw"
accuracy_decimals: 2
filters:
- multiply: 0.01
Also like it was in the other forum link, the parameters in the 9600 must be configure
Thank you everybody for this.