Skip to the content
PCBKitNew board
2 layers70.6 × 28 mmModusBatteryMonitor, the printed circuit board in 3D

ModusBatteryMonitor

ieb/ModbusShunt

Modbus Battery monitor using IN219 Attiny3224 on a 100A 75mV shunt.

Size
70.6 × 28 mm
Copper layers
2
Thickness
1.6 mm
Parts
17
Nets
18
Pads
61
Tracks, vias
144, 6
Pours
6
Routed
Yes
KiCad
KiCad 4
Created
21 Dec 2022
Updated
15 Jan 2023

Overview

ModusBatteryMonitor is an open-source printed circuit board by ieb, from the ieb/ModbusShunt repository on GitHub. It is a 2-layer board of 70.6 × 28 mm with 17 parts on 18 nets, routed with 144 tracks and 6 vias.

It is built around the ATTINY3224-SSU and RS485. Its parts include 7 connectors, 4 ICs, 3 capacitors and 3 resistors. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

2

README

README.md

Modbus Battery Sensor.

Mk1 used the ADC on an Attiny3224. Fine for voltage but not really accurate enough for low levels of current on a 75mV 100A shunt.

This version is built arround a INA219 which is far easier to use. It speaks modbus to communicate with a modbus controller that can control if its on or not.

The controller will be a Attiny or ESP32 driving a eInk display depending. This will only be on when the boat is in service.

A BLE version was created, but in the end I felt it was overcomplicated and would need to deep sleep to avoid draining the battery.

The device speaks Modbus RTU, 9600 baud, 8N1.

Holding registers

|| Register || type || units per bit || R/W || description || | 0 | int16 | serial number | R | serial number, can be written once only | | 1 | int16 | device address | R/W | modbus unit or device address | | 2 | int16 | A | R/W | Shunt full scale current range, default 100A | | 3 | int16 | mV | R/W | Shunt full scale voltage, default 75mV | | 4 | int16 | 0.1C | R/W | Temperature probe 1 offset, default 0 | | 5 | int16 | 0.001x | R/W | Temperature probe 1 scale, default 1000 eg 1x | | 6 | int16 | 0.1C | R/W | Temperature probe 2 offset, default 0 | | 7 | int16 | 0.001x | R/W | Temperature probe 2 scale, default 1000 eg 1x |

Input registers

|| Register || type || units per bit || description || | 0 | int16 | mV | Battery voltage | | 1 | int16 | 0.1 A | Shunt current | | 2 | int16 | 0.01 C | Temperature probe 1 |
| 3 | int16 | 0.01 C | Temperature probe 2 |
| 4 | int16 | bitmap | Lower 8 bits are Serial documented here bit 8 indicates and error reading voltage, bit 9 indicates and error reading current | | 5 | int16 | mV | MCU Supply voltage | | 6 | int16 | 0.1 C | MCU Temperature | | 1000 | int16 | counter | modbus frames recieved | | 1001 | int16 | counter | modbus frames sent | | 1002 | int16 | counter | modbus errors recieved | | 1003 | int16 | counter | modbus frames ignored | | 1004 | int16 | counter | modbus errors sent | | 1005 | int16 | counter | modbus buffer overflow |

megaTinyCore

This code needs megaTiny core 2.6.4 to work as there are some timing bugs that cause it to fail with the default platform IO 2.5.11 version. Upgrading is a pain as it requires installing a custom package. Installs from github fail as the layout of the source repo is wrong and missing files.

The hacky way is to install manually as its not possible to install from a git repo due to a bug in the pio code that parses versions numbers.

text
	cd ~/src
	git clone https://github.com/SpenceKonde/megaTinyCore.git
	cd megaTinyCore
	git co -b 2.6.4
	mkdir ~/.platformio/packages/framework-arduino-megaavr-megatinycore@2.6.4
	cd ~/.platformio/packages/framework-arduino-megaavr-megatinycore@2.6.4
	cat << EOF > .piopm
	{"type": "tool", "name": "framework-arduino-megaavr-megatinycore", "version": "2.6.4", "spec": {"owner": "platformio", "id": 11448, "name": "framework-arduino-megaavr-megatinycore", "requirements": null, "uri": null}}
	EOF
	cat << EOF > package.json
	{
	  "name": "framework-arduino-megaavr-megatinycore",
	  "version": "2.6.4",
	  "description": "Arduino Wiring-based Framework for Microchip tinyAVR 0-series and 1-series chips (megaTinyCore)",
	  "keywords": [
	    "framework",
	    "arduino",
	    "microchip",
	    "tinyAVR"
	  ],
	  "repository": {
	    "type": "git",
	    "url": "https://github.com/ieb/megaTinyCore"
	  }

ToDo

  • Basic implementation, with modbus, holding registers and input registers.
  • Implement test client
  • Reimplement modbus frame handling
  • Implement sleep mode, wake on frame
  • Average current and voltage over time period, eg 30s
  • Test frame handling of packets for other units.
  • Calibrate NTC sensors.
  • Test write to holding registers.
  • Implement current monitoring with auto scaling for different ranges using features of the INA219

Parts

17
QtyValueFootprintReferences
210KResistors_SMD:R_0805R102, R103
1100nFCapacitors_SMD:C_0805C103
110uFCapacitors_SMD:C_0805C102
11uFCapacitors_SMD:C_1206C101
1270RResistors_SMD:R_0805R101
1ATTINY3224-SSHousings_SOIC:SOIC-14_3.9x8.7mm_Pitch1.27mmIC101
1BAT-Pin_Headers:Pin_Header_Straight_1x01P107
1DEBUGPin_Headers:Pin_Header_Straight_1x05P104
1INA219-moduleDivers:INA219ModuleU102
1MAX485/3485Housings_SOIC:SOIC-8_3.9x4.9mm_Pitch1.27mmIC102
1NCP1117ST50T3GTO_SOT_Packages_SMD:SOT-223-3Lead_TabPin2U101
1NTC1Pin_Headers:Pin_Header_Straight_1x02P102
1NTC2Pin_Headers:Pin_Header_Straight_1x02P103
1RS485Divers:Wago250PushSocket5wayP101
1SHUNT+Divers:M5BoltP105
1SHUNT-Divers:M5BoltP106

Questions

How big is the ModusBatteryMonitor PCB?

It measures 70.6 × 28 mm and has 2 copper layers, 1.6 mm thick.

What parts does the ModusBatteryMonitor use?

17 parts, built around the ATTINY3224-SSU and RS485. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the ModusBatteryMonitor KiCad files?

From the ieb/ModbusShunt repository on GitHub, at the commit this page was made from: the board is pcb/ModusBatteryMonitor.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the ModusBatteryMonitor design in my own project?

Its repository states no licence, so its author keeps all rights: ask ieb before reusing the design.

Similar boards

  • 2 layers56.7 × 25.4 mmBatteryMonitorATTiny3224, the printed circuit board in 3D

    BatteryMonitorATTiny3224

    ieb/BatterySensor

    A Modbus RTU Battery Current and Voltage sensor board based Attiny3224, MAX485, MAX9918 chips.

    24 parts1
  • 2 layers21.1 × 19.6 mmSoic14-bb, the printed circuit board in 3D

    Soic14-bb

    jaco-pixeldump/attiny-soic-14-barebone-breakout-board

    A compact, breadboard-friendly breakout adapter PCB for 14-pin SOIC Microchip ATtiny microcontrollers (such as ATtiny3224, ATtiny1624, ATtiny824, ATtiny424, as well as 1-series and 0-series parts like ATtiny1614…

    5 parts1MIT
  • 2 layers79 × 80 mmDiy esc, the printed circuit board in 3D

    Diy esc

    Siddharth2308/esc

    79 parts1
  • 2 layers93 × 93 mmAMN TopPcb, the printed circuit board in 3D

    AMN TopPcb

    hschack/ANM_TOP_PCB

    31 parts
  • 2 layers62.5 × 48.5 mmVacSensor, the printed circuit board in 3D

    VacSensor

    hschack/ZB3245TSS_OPENPNP

    More to come Link Mellow Fly Super8Pro https://teamgloomy.github.io/flysuper8proh723general35.html

    25 parts
  • 2 layers64 × 78 mmActuator board, the printed circuit board in 3D

    Actuator board

    ieb/autopilot

    An ML Autopilot designed and written almost entirely by Google AntiGravity.

    37 parts
  • 2 layers89.2 × 38.3 mmCanGNSS, the printed circuit board in 3D

    CanGNSS

    ieb/CanGNSS

    NMEA2000 GNSS device using Neo M8N receiver and attiny3224 MCU.

    22 parts