Pimp my Riden RD-6018W

This Episode will focus solely on hacking around in the Riden RD-6018W. Per default, the W version comes with a wireless interface and Ridens android app. Since that is less than useful the idea came up to see if we could flash our own firmware onto it.

Luckily Riden uses a COTS ESP12 module. Unluckily the module isn't simply flashed by plugging it into USB like we are used on the ESP32 nodemcu (and the likes) modules. The next task was to analyze and reverse engineer the module and its PCB implementation and hack a little USB-Serial adapter and breadboard magic, to flash a specific esphome firmware that talks modbus to the RD-6018 and exposes the control interfaces and log data to home-assistant.

After that was successfully done, control is now available in Home-Assistant and long term log-data is stored in Prometheus and available in Grafana.

Last but not least USB connection and working with the open-source toolkit RidenGUI also turned out to be no problem at all. All in all, this was a very successful session to get the most out of the Riden RD-6018 and the same should apply to the RD-6006 and RD-6012 models.

Hardware

Software

Update

As requested, here is the esphome config for it:

################################################################################
#  RD-6018W ESP-12F Configuration  #############################################
#  V1.0 chrono (Apollo-NG) 2022-11-13

substitutions:
  name: 'rd-6018'
  friendly_name: 'RD-6018'
 
################################################################################
#  GENERAL  ####################################################################

esphome:
  name:                         ${name}
  platform:                     ESP8266
  board:                        esp01_1m

wifi:
  ssid:                         !secret wifi_ssid
  password:                     !secret wifi_psk
  domain:                       ".iot.apollo.lan"
  fast_connect:                 on

logger:
  baud_rate:                    0
 
# Enable Home Assistant API and set reboot timeout
api:
  reboot_timeout:               60s
 
# Enable OTA updates
ota:

# Time sync needed for total_daily_energy calcs 
time:
  - platform:                   homeassistant
    id:                         homeassistant_time
    timezone:                   "UTC"
 
################################################################################
#  BUS Config  #################################################################

uart:
  tx_pin: 1
  rx_pin: 3
  baud_rate: 1000000
  debug:

modbus_controller:
  address: 0x01
  update_interval: 10s
 
################################################################################
#  SENSORS  ####################################################################

text_sensor:

  - platform:                   version
    name:                       "${name} - Version"
    icon:                       mdi:cube-outline
 

sensor:

  - platform:                   uptime
    name:                       "${name} - Uptime"
    update_interval:            60s
    icon:                       mdi:clock-outline

  - platform:                   wifi_signal
    name:                       "${name} - Wifi Signal"
    update_interval:            10s
    icon:                       mdi:wifi

  - platform: modbus_controller
    name: '${friendly_name} Internal Temperature'
    register_type: holding
    address: 4
    register_count: 2
    bitmask: 0xFFFF
    value_type: U_DWORD
    unit_of_measurement: °C
    state_class: measurement
    device_class: temperature
    lambda: |
      return data[item->offset + 1] == 0 ? x : -x;
  - platform: modbus_controller
    name: '${friendly_name} External Temperature'
    register_type: holding
    address: 34
    register_count: 2
    bitmask: 0xFFFF
    value_type: U_DWORD
    unit_of_measurement: °C
    state_class: measurement
    device_class: temperature
    lambda: |
      return data[item->offset + 1] == 0 ? x : -x;
  - platform: modbus_controller
    name: '${friendly_name} Output Voltage'
    register_type: holding
    address: 10
    value_type: U_WORD
    unit_of_measurement: V
    state_class: measurement
    device_class: voltage
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    name: '${friendly_name} Output Current'
    register_type: holding
    address: 11
    value_type: U_WORD
    unit_of_measurement: A
    state_class: measurement
    device_class: current
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    name: '${friendly_name} Output Energy'
    register_type: holding
    address: 12
    value_type: U_WORD
    unit_of_measurement: Ah
    state_class: measurement
    device_class: energy
    accuracy_decimals: 2
    filters:
      - multiply: 0.001
  - platform: modbus_controller
    name: '${friendly_name} Output Power'
    address: 13
    register_type: holding
    value_type: U_WORD
    unit_of_measurement: W
    state_class: measurement
    device_class: power
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    name: '${friendly_name} Input Voltage'
    register_type: holding
    address: 14
    value_type: U_WORD
    unit_of_measurement: V
    state_class: measurement
    device_class: voltage
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    name: '${friendly_name} Energy'
    internal: true
    register_type: holding
    address: 40
    value_type: U_DWORD
    unit_of_measurement: Wh
    state_class: measurement
    device_class: energy
    accuracy_decimals: 3
    filters:
      - multiply: 0.001

switch:
  - platform: modbus_controller
    name: '${friendly_name} Keypad Lock'
    address: 15
    register_type: holding
    bitmask: 1

  - platform: modbus_controller
    name: '${friendly_name} Power'
    address: 18
    register_type: holding
    bitmask: 1

number:
  - platform: modbus_controller
    name: '${friendly_name} Voltage Setting'
    address: 8
    value_type: U_WORD
    min_value: 0.01
    max_value: 60.0
    step: 0.01
    lambda: return x / 100.0f;
    multiply: 100

  - platform: modbus_controller
    name: '${friendly_name} Current Setting'
    address: 9
    value_type: U_WORD
    min_value: 0.01
    max_value: 18.0
    step: 0.01
    lambda: return x / 100.0f;
    multiply: 100

  - platform: modbus_controller
    name: '${friendly_name} Voltage Protection'
    entity_category: config
    address: 82
    value_type: U_WORD
    min_value: 0.01
    max_value: 60.0
    step: 0.01
    lambda: return x / 100.0f;
    multiply: 100

  - platform: modbus_controller
    name: '${friendly_name} Current Protection'
    entity_category: config
    address: 83
    value_type: U_WORD
    min_value: 0.01
    max_value: 18.0
    step: 0.01
    lambda: return x / 100.0f;
    multiply: 100

binary_sensor:
  - platform: modbus_controller
    name: '${friendly_name} Battery Mode'
    address: 32
    register_type: holding
    bitmask: 1

If you want to see more, please join Odysee and follow our channel there.