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

Modbus Battery monitor using IN219 Attiny3224 on a 100A 75mV shunt.
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.
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.
|| 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 |
|| 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 |
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.
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"
}| Qty | Value | Footprint | References |
|---|---|---|---|
| 2 | 10K | Resistors_SMD:R_0805 | R102, R103 |
| 1 | 100nF | Capacitors_SMD:C_0805 | C103 |
| 1 | 10uF | Capacitors_SMD:C_0805 | C102 |
| 1 | 1uF | Capacitors_SMD:C_1206 | C101 |
| 1 | 270R | Resistors_SMD:R_0805 | R101 |
| 1 | ATTINY3224-SS | Housings_SOIC:SOIC-14_3.9x8.7mm_Pitch1.27mm | IC101 |
| 1 | BAT- | Pin_Headers:Pin_Header_Straight_1x01 | P107 |
| 1 | DEBUG | Pin_Headers:Pin_Header_Straight_1x05 | P104 |
| 1 | INA219-module | Divers:INA219Module | U102 |
| 1 | MAX485/3485 | Housings_SOIC:SOIC-8_3.9x4.9mm_Pitch1.27mm | IC102 |
| 1 | NCP1117ST50T3G | TO_SOT_Packages_SMD:SOT-223-3Lead_TabPin2 | U101 |
| 1 | NTC1 | Pin_Headers:Pin_Header_Straight_1x02 | P102 |
| 1 | NTC2 | Pin_Headers:Pin_Header_Straight_1x02 | P103 |
| 1 | RS485 | Divers:Wago250PushSocket5way | P101 |
| 1 | SHUNT+ | Divers:M5Bolt | P105 |
| 1 | SHUNT- | Divers:M5Bolt | P106 |
It measures 70.6 × 28 mm and has 2 copper layers, 1.6 mm thick.
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.
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.
Its repository states no licence, so its author keeps all rights: ask ieb before reusing the design.

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

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…



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

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