Will Low Cost ESP8266 4 Channel Power Monitor Work With ESPHome?

Does anyone have experience using this kind of board to interface with ESPHome?

It uses a CD4052 multiplexer to connect the four inputs to the single A0 pin on the ESP8266 but I can’t find any references in the Docs.

https://www.mottramlabs.com/esp_products.html

Cool cheap boards (sucks the shipping cost to Canada is through the roof! ) .

The blue board looking at the schematics doesn’t look like it would be supported in Esphome. BUT The GREEN version(Mottramlabs-Products) of the board looks like it could be used. Due to using the ADS1115

1 Like

I ended up ordering one of the greenboards and had it shipped to a friend in the UK which will in turn forward the package to me, but will be a few weeks still on getting the SCT-013 from Aliexpress.

Just curious why you picked this particular board?

I have used a Node MCU with 4-channel relay - Amazon.com that would likely perform same as your configuration.

Side Note:
Based on my experience, the stuff from China gets really cheap once you order in bulk. I ordered 50 pieces of NodeMCU (Ali Express) and it ended up as less than $2 a piece with free shipping!

The board in this thread is to monitor the power usage using SCT-013-xxx split core transformers. (Learn | OpenEnergyMonitor)
The green circuitboard (Mottramlabs-Products) " ESP8266 - 4 Channel Mains Current Sensor" uses ADS1115 which is supported by the ESPHOME.

The link you provided is for board that control relays.

1 Like

Thanks for clarifying, while your original note peaked my curiosity I misunderstood the details.

Did you notice they post the schematic too? Could use fairly readily to implement your own and not pay shipping…

Anybody find a way to get the blue board to work? Also curious if this will work as I just ordered the blue board.

1 Like

The board maker sent me this link to a Github thread but I have not had time to try it yet:

I have mine already working on ESPHOME. The support is already there for the chip on the board.
I only have one channel. At first I was going to move to a different home , and didn’t install it in the fuse panel , but the way things are going looks like I will be here for another year. So may install it into the fuse panel. I have it only right now on my laptop on my desk. I used for testing.

here is a copy of my testing esphome.



esphome:
  name: home-power
  platform: ESP8266
  board: d1_mini

wifi:
  networks:
  - ssid: !secret wifi_ssidiot
    password: !secret wifi_password
    priority: 0
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
    priority: 1

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Home-Power Fallback Hotspot"
    password: "9iwxxxxxxXpBc"


  manual_ip:
    static_ip: 192.168.1.153
    gateway: 192.168.1.1
    subnet: 255.255.255.0      


  reboot_timeout: 2min
#  fast_connect: true


# Enable logging
logger:
  level: DEBUG
  baud_rate: 0
  logs:
    ads1115: ERROR  
# Enable Home Assistant API
api:
  reboot_timeout: 5min

ota:
  password: "dxxxxxxxxxxxxxxxxx"
  
  
web_server:
  port: 80
  
captive_portal:



substitutions:
  esp_id: "esp-energymon"
# Common ADS1115 Sensor Setting
  ads_gain: "2.048"
  ads_update_interval: "850ms"
  #ads_update_interval: "250ms"
  ads_delta: "0.2"
  ads_heartbeat: "120s"
  ads_voltage: "120"
  
i2c:
  sda: GPIO04
  scl: GPIO05
  scan: False

ads1115:
# 1st ADS1115 (ADDR -> Grnd)
  - address: 0x48
    id: ads1115_1
    continuous_mode: on


# Example configuration entry
switch:
  - platform: gpio
    pin: GPIO013
    name: "Buzzer"
    #restore_mode: ALWAYS_OFF 
    inverted: true

  - platform: restart
    name: "ESP Home Power Restart"    

sensor:
# Channel 1
  - platform: ct_clamp
    sensor: ads1115_1_a0
    id: current_ch1
    name: "${esp_id} Current Ch 1"
    update_interval: 5s
## New Start    
    #sample_duration: 5s
    accuracy_decimals: 3
## New End    
    
    # Needs adjusting for individual Deployment
    filters:
      - calibrate_polynomial:
           degree: 2
           datapoints:
            - 0.00 -> 0
            - 0.00090 -> 0.11774325429
            - 0.003 -> 0.1885245901639344
            - 0.029 -> 4.10655737704918
            - 0.055 -> 7.516393442622951
            
        


      - sliding_window_moving_average:
          window_size: 5
          send_every: 1
      - lambda: if ( (x * ${ads_voltage}) < 10 ) { return 0; } else { return x ; }



    # When Current updates, update Watts
    on_value:
      then:
        - sensor.template.publish:
            id: watts_ch1
            # Local Voltage is 240V - adjust as required. 
            state: !lambda 'if ( (id(current_ch1).state * ${ads_voltage}) < 10 ) { return 0; } else { return id(current_ch1).state * ${ads_voltage}; }'
         
            
  - platform: ads1115
    ads1115_id: ads1115_1
    multiplexer: 'A0_GND'
    gain: ${ads_gain}
    name: "ADS1115-1-A0"
    id: ads1115_1_a0
    accuracy_decimals: 3
    update_interval: ${ads_update_interval}
    internal: true
    filters:
      # Samples every 250ms...Average over 10 Secs, Send every 5 Secs
    - sliding_window_moving_average:
          window_size: 40
          send_every: 20
    - delta: ${ads_delta}



# Template Sensors for Watts
  - platform: template
    id: watts_ch1
    name: "${esp_id} Watts Ch 1"
    lambda: return id(current_ch1).state * ${ads_voltage} ;
    unit_of_measurement: W
    accuracy_decimals: 3
    device_class: power


# Energy Sensors (kWh) for HA Dashboard
  - platform: total_daily_energy
    name: ${esp_id} Total kWh Ch1
    power_id: watts_ch1
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh



# Voltage from HA
  - platform: homeassistant
    name: "Voltage"
    #ESPHome ID
    id: average_voltage
    entity_id: switch.1000c00249_voltage
    internal: true
  - platform: wifi_signal
    name: "${esp_id} WiFi Signal Sensor"
    update_interval: 60s    




# Total Energy sensor requires Times - could be SNTP or Home Assistant
time:
  - platform: homeassistant
    id: homeassistant_time  
    
    

2 Likes

Thanks, I will give that a go.

Hi @digiital , I gave this a go over the week and it seems to work great. I do however have a couple of follow-up questions …

  1. The switch you have added for the buzzer just lets out a faint crackle when I activate it, does yours produce a beep or other sounds?
  2. You set the substitution “ads_voltage” to “120” and I have changed this to “240” in my case. I see that you have also included a “Voltage” reading from a Home Assistant entity this has this - should this be used in the calcs instead of “ads_voltage” for greater accuracy?

Thanks!

  1. you can ignore that, I was playing around trying to get the buzzer to work, never did, didn’t remove the code.
  2. Yes its fine to change to 240. The code hasn’t been touched in a few months so I’m not sure which part you were referring too on the VOLTAGE.

Make sure you adjust the following numbers. I used a know power, like a lightbulb, tried heaters as well a few items to get a average to place down below . I don’t recall if I used a youtube video at first to see how it was done. Or just applying a 60w bulb and heater and looked at the logs to see the output.

   filters:
      - calibrate_polynomial:
           degree: 2
           datapoints:
            - 0.00 -> 0
            - 0.00090 -> 0.11774325429
            - 0.003 -> 0.1885245901639344
            - 0.029 -> 4.10655737704918
            - 0.055 -> 7.516393442622951

OK thanks, I did re-calibrate the polynomial.

Regarding the voltage question, you have the following:

image

image

And the calculations all use “ads_voltage” (i.e. 120 or 240) instead of “voltage” from a Home Assistant entity e.g.:

image

Why not use “voltage” instead of “ads_voltage”?

“Voltage” is just a label/name…
I’m pretty sure you could just remove that section. I was experimenting to see if I could figure out the voltages. But I stopped working on it

I’m trying the blue board with this:

4-Channel-Mains-Current-Sensor-ESP8266/mainspower.yaml at patch-2 · Darthmonkey/4-Channel-Mains-Current-Sensor-ESP8266 (github.com)

And seems to work fine.

Would anyone have an update on whether one of these is worth getting and essentially:

  • Whats the difference in performance between the green and the blue board?
  • How accurate is each board?
  • Does it work with ESPHome (and a recent sample code for 4 channels?)
  • Does it require calibration and how is that performed?

Appreciate any feedback :blush:

The headline “Will Low Cost ESP8266 4 Channel Power Monitor Work With ESPHome?” is actually misleading.

The website states that the product shown in the picture from @Jonah1970 is actually a “ESP8266 - 4 Channel Mains Current Sensor

Accurate power measuring will be impossible with that type of device :exploding_head:

The blue uses the internal ADC from the esp while the green board uses a (better) ads1115 - still both only measure current and not power :warning:

Does it matter at all? What does it help to know the AC current?

:point_up:

No idea. Low cost power monitoring can be achieved with pzem004t v3’s which not only comes factory calibrated with coil or clamp but are also cheap as hell :ok_hand:

3 Likes

I calibrated with different bulbs and a plug power meter to check bulbs real and precise power.
Then I calibrated high power with a current clamp.

I verified precise voltage to set it in the code and I think it is enough accurate for me. In future I will test the difference with a PZem

1 Like