DIY Smart Shunt 80V | 100A DC

by Steve Willson Kujur in Circuits > Arduino

1190 Views, 1 Favorites, 0 Comments

DIY Smart Shunt 80V | 100A DC

Untitled_1.2.2.jpg

Hey everyone, my name is Steve! Today, I'm excited to share with you the detailed process of how I designed and built this advanced Power Meter using an ESP8266 microcontroller and an INA226 Current Sensor. This project has been a fascinating journey of innovation and problem-solving.


First off, let me tell you about the ESP8266. It's a powerful and versatile Wi-Fi-enabled microcontroller, perfect for IoT projects like this one. Coupled with the INA226 Current Sensor, we can accurately measure current ranging from 1mA all the way up to 100A, as well as monitor voltages up to 80VDC. The precision of these measurements is crucial, especially when dealing with sensitive systems or batteries like Lifepo4.


One of the highlights of this Power Meter is its ability to handle negative current measurements, making it suitable for a wide range of applications. By integrating this device with Home Assistant, I've enabled wireless monitoring and control, allowing seamless integration into smart home setups.


I developed the firmware for this project using ESPHome, a powerful framework for building custom firmware for ESP8266 and ESP32 devices. This framework provides an intuitive way to define the device's behavior and connectivity, making it ideal for IoT enthusiasts like myself.


This is actually the second iteration of my Power Meter project. The first version taught me a lot, and I've incorporated numerous improvements into this new design. From enhanced accuracy to better integration capabilities, there's always room for innovation and refinement.


In the future, I plan to explore additional enhancements such as data logging, real-time analytics, and possibly even predictive maintenance features. The possibilities with this project are truly exciting, and I'm thrilled to share my experiences and learnings with you all.


So stay tuned as I dive deep into the technical aspects and share insights on how you too can create your own sophisticated Power Meter using readily available components and a dash of creativity!


You can watch the Video

Features

Untitled_4.3.1.jpg

Measurement

  • 0-80VDC
  • 0-100A

Built-in Features

  • Wireless
  • Extra Ports for Future Expandability


Images

Untitled_1.3.1.jpg
Untitled_1.5.1.jpg
Untitled_1.6.1.jpg
Untitled_1.6.2.jpg
Untitled_1.23.1.jpg

Precesion Samples

Untitled_1.59.2.jpg
Untitled_1.60.1.jpg
Untitled_1.59.1.jpg
Untitled_4.7.1.jpg

I used my lab bench power supply to test it, and it appears highly accurate with minimal errors; furthermore, it can always be calibrated for precision.

Thing I've Used

Aliexpress

Amazon



Making PCB

Untitled_4.5.1.jpg
Untitled_1.7.1.jpg

JLCPCB PCB+PCBA from $2, Sign up to Get $60 New User Coupons here: Link


I generally strive for professional results, which is why I use JLCPCB to bring my dreams to life. Speaking of JLCPCB, it's the world's largest PCB manufacturing company and consistently delivers fantastic outcomes. You can refer to the image above for an example.


Now, JLCPCB are offering

  • $2 for 2Layer, 5pcs
  • $5 for 4Layer, 5pcs

Gerber & Schematics - Download

Why ESPHome

I find Home Assistant invaluable for integrating ESPHome, which offers seamless wireless capabilities. Working with ESPHome is remarkably straightforward; its use of YAML for configuration ensures a user-friendly coding experience. This combination not only simplifies setup but also enhances the flexibility of my smart home system.

Code

substitutions:
  devicename: 100a-pm
  friendly_name: 100A PM


esphome:
  name: ${devicename}
  friendly_name: ${friendly_name}


esp8266:
  board: esp12e
  restore_from_flash: true
# Enable logging
logger:


# Enable Home Assistant API
api:
  reboot_timeout: !secret reboot_timeout
# OTA
ota:


# Wifi
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  reboot_timeout: !secret reboot_timeout
# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${friendly_name} Hotspot
    password: "123456789"


captive_portal:

i2c:
  sda: 4
  scl: 5


# Restart
button:
  - platform: restart
    name: Restart


# Time
time:
  - platform: sntp
    id: my_time


sensor:


# Wifi Signal
  - platform: wifi_signal
    name: WiFi Signal
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10
    update_interval: 60s


# Uptime
  - platform: uptime
    name: Uptime
    update_interval: 60s


  - platform: integration
    name: AH Data
    id: ah
    sensor: current
    time_unit: h
    restore: true
    unit_of_measurement: Ah
    integration_method: right
    accuracy_decimals: 1
    filters:
     - lambda: return x -160;
    disabled_by_default: true


# Getting AH
  - platform: template
    name: AH
    unit_of_measurement: Ah
    accuracy_decimals: 1
    lambda: |-
      return (id(ah).state * -1);
    update_interval: 2s          
    on_value_range:
        - above: 161
          then:
           - delay: 100s
           - sensor.integration.reset: ah
     
# Getting Power
  - platform: template
    name: Power
    unit_of_measurement: W
    id: my_power
    accuracy_decimals: 1
    lambda: |-
      return (id(voltage).state * id(current).state);
    update_interval: 3s


  - platform: ina226
    address: 0x45
    shunt_resistance: 0.7475 mohm
   
    current:
      name: Current
      id: current
      accuracy_decimals: 1
      filters:
       - sliding_window_moving_average:
          window_size: 100
          send_every: 100
   


       
    bus_voltage:
      name: Voltage
      id: voltage
      accuracy_decimals: 1
      filters:
       - multiply: 3.24375  


       - sliding_window_moving_average:
          window_size: 100
          send_every: 100


     
    max_current: 100A
    update_interval: 0.05s


After Gathering All the Parts

Untitled_1.8.1.jpg
Untitled_1.8.2.jpg
Untitled_1.9.1.jpg
Untitled_1.10.1.jpg
Untitled_1.12.1.jpg
Untitled_1.15.1.jpg
Untitled_1.18.1.jpg
Untitled_1.19.1.jpg
Untitled_1.20.1.jpg

Cleaning

Untitled_1.22.1.jpg
Untitled_1.22.2.jpg

After soldering, it's very necessary to clean the flux residue for optimal circuit performance and longevity.

Programming

Untitled_1.24.1.jpg

I used the CH340 chip to program the ESP8266 microcontroller.

Wire

Untitled_1.48.1.jpg
Untitled_1.48.2.jpg
Untitled_1.25.1.jpg
Untitled_1.26.1.jpg
Untitled_1.31.1.jpg
Untitled_1.37.1.jpg
Untitled_1.40.1.jpg

I really like making this wiring harness because it allows me to showcase my precision and craftsmanship in assembling electrical connections.

Preparing

Untitled_1.51.1.jpg
Untitled_1.53.1.jpg
Untitled_1.54.1.jpg
Untitled_1.55.1.jpg
Untitled_1.57.1.jpg
Untitled_1.58.1.jpg

Note - Please see the images for better understanding