Skip to the content
2 layers68.4 × 51.1 mmPb Monitor v2, the printed circuit board in 3D

PbMonitor v2.0

Size
68.4 × 51.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
79
Nets
69
Pads
311
Tracks, vias
477, 233
Pours
2
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
29 Mar 2026
Updated
2 Apr 2026

Overview

Pb Monitor v2 is an open-source printed circuit board by ElektorLabs, from the ElektorLabs/Pb-Monitor-v2 repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 68.4 × 51.1 mm with 79 parts on 69 nets, routed with 477 tracks and 233 vias.

It is built around the ESP32-C6-MINI-1U-H4, ZLDO1117QK50TC and B140HW-7-HXY, with the NCD0805G1, NCD0805R1 and SMF05C.TCT among its other parts. Its parts include 24 resistors, 22 capacitors, 17 switches, 5 diodes and 4 ICs. It belongs with the ESP32 and RISC-V boards of this library.

Main components

6

README

README.md

pbMonitor V2 — 48V Battery Back Monitor

A compact, open-source battery monitoring system for 48V battery banks. Built around the ESP32-C6 Mini, it reads four voltage taps, bidirectional current, and up to four temperature sensors — displaying live data on a 0.96" OLED and flagging faults through status LEDs and serial output.


Features

  • Voltage monitoring — measures four independent taps (12V, 32V, 48V, 64V) via a 12-bit SPI ADC
  • Bidirectional current — charge and discharge detection with configurable sensitivity
  • Temperature — up to 4× DS18B20 sensors on a single OneWire bus, fully bit-banged (no external library)
  • Live OLED display — two alternating pages: voltages/current and temperatures
  • Fault detection — overvoltage, undervoltage, overcurrent, overtemperature with hysteresis to prevent flicker
  • Status LEDs — green = healthy, red = any active fault
  • Non-blocking firmware — temperature conversion runs asynchronously; no delay() in the main loop
  • Hardware watchdog — 5-second timeout reboots the system if any sensor stalls the loop
  • Serial debug output — live readings at 115200 baud, all in a single batched line per cycle
  • Custom PCB — KiCad hardware design files included

Repository Structure

text
pbMonitorv2/
├── src/
│   └── pbMonitor/
│       └── pbMonitor.ino       Main firmware (Arduino sketch)
├── hardware/
│   ├── *.kicad_pro             KiCad project file
│   ├── *.kicad_sch             Schematic source
│   ├── *.kicad_pcb             PCB layout source
│   ├── schematic.pdf           Exported schematic (human-readable)
│   └── BOM.csv                 Bill of materials
└── README.md

Hardware

Full component values and footprints are in hardware/BOM.csv. Schematic PDF: hardware/schematic.pdf.

Signal Chain

text
Battery tap ──► Resistor divider ──► TLV9004 op-amp ──► TLA2518 ADC ──► ESP32-C6

The op-amp buffers the resistor divider output and keeps the ADC input within the 0–3.3V safe range regardless of load on the divider.

Pin Map

SignalESP32-C6 GPIO
TLA2518 CS14
TLA2518 SCLK21
TLA2518 SDO (MISO)22
TLA2518 SDI (MOSI)20
DS18B20 OneWire2
LED Green1
LED Red3
OLED SDA / SCLDefault Wire pins

ADC Channel Map

ChannelSignal
CH0Bidirectional current sensor (0A = 1.65V = VREF/2)
CH164V tap — full pack positive terminal
CH248V tap
CH332V tap
CH412V tap
CH5–7Spare / unconnected

Getting Started

Prerequisites

Add the ESP32 board package URL in Arduino IDE preferences:

text
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Then install: Boards Manager → esp32 by Espressif Systems

Libraries

Install via Arduino Library Manager:

LibraryVersion
Adafruit SSD1306≥ 2.5
Adafruit GFX Library≥ 1.11

OneWire and DallasTemperature are not required. The DS18B20 driver is built into the sketch.

Building with arduino-cli

bash
# Compile
arduino-cli compile --fqbn esp32:esp32:esp32c6 src/pbMonitor/pbMonitor.ino

# Upload (replace /dev/ttyUSB0 with your port)
arduino-cli upload --fqbn esp32:esp32:esp32c6 --port /dev/ttyUSB0 src/pbMonitor/pbMonitor.ino

Upload Steps (Arduino IDE)

  1. Open src/pbMonitor/pbMonitor.ino
  2. Select board: Tools → Board → ESP32C6 Dev Module
  3. Set the calibration constants (see below)
  4. Click Upload

Calibration

All calibration constants are grouped at the top of pbMonitor.ino. No other changes are needed.

Voltage Divider Ratios

cpp
#define RATIO_64V   19.4f
#define RATIO_48V   14.6f
#define RATIO_32V   9.7f
#define RATIO_12V   3.7f

Calculate the ratio from your actual resistor values:

text
RATIO = (R_top + R_bottom) / R_bottom

Example: 180 kΩ top + 10 kΩ bottom → RATIO = 19.0

Measure the actual battery tap voltage with a multimeter and the corresponding ADC voltage at the op-amp output to verify or fine-tune.

Current Sensor

cpp
#define CURRENT_SENSITIVITY  0.066f   // V/A — adjust for your sensor

Common values:

SensorSensitivity
ACS758-50B0.060 V/A
ACS712-20A0.100 V/A
ACS712-5A0.185 V/A

The sensor must output VREF/2 = 1.65V at 0A. Positive current = charging, negative = discharging.

Protection Thresholds

cpp
#define PACK_OVERVOLTAGE    58.0f   // V  (~14.5V/cell × 4)
#define PACK_UNDERVOLTAGE   42.0f   // V  (~10.5V/cell × 4)
#define PACK_CONNECTED_MIN  5.0f    // V  below this = pack disconnected, no UV fault
#define OVERCURRENT_A       50.0f   // A  peak discharge limit
#define OVERTEMP_C          55.0f   // °C battery thermal limit

Fault thresholds include a built-in hysteresis deadband (FAULT_HYSTERESIS_V = 0.5V, FAULT_HYSTERESIS_A = 1A) so fault flags do not oscillate when a measurement hovers near a trip point.


OLED Display

The display alternates between two pages every 2 seconds.

Page 1 — Voltages & Current

text
┌──────────────────────────────┐
│ pbMonitor v2        [ OK  ] │
├──────────────────────────────┤
│ 64V: 54.2V  48V: 48.1V     │
│ 32V: 32.1V  12V: 12.8V     │
├──────────────────────────────┤
│ I:  +12.50 A                │
│ ▲ CHARGING                  │
├──────────────────────────────┤
│ System Normal               │
└──────────────────────────────┘

Page 2 — Temperatures

text
┌──────────────────────────────┐
│ pbMonitor v2   Temps        │
├──────────────────────────────┤
│ T1:  32.5C   T2:  33.1C    │
│ T3:  31.8C   T4:  34.0C    │
├──────────────────────────────┤
│ Max:  34.0C                 │
└──────────────────────────────┘

Serial Monitor

Connect at 115200 baud. One line is printed per ADC cycle (500ms), followed by temperature lines when sensors are present:

text
64V:54.20 48V:48.10 32V:32.05 12V:12.80  I:+12.50A [CHARGING]
  T1: 32.5C
  T2: 33.1C

Active faults are appended inline:

text
64V:59.10 48V:52.30 32V:35.00 12V:13.10  I:+0.20A [IDLE]  !!OV

Fault Conditions

CodeConditionDefault TripNotes
OVOvervoltagePack > 58.0V
UVUndervoltagePack < 42.0VSuppressed if pack voltage < 5V (disconnected)
OCOvercurrent|I| > 50AAbsolute value — triggers on charge or discharge
OTOvertemperatureAny sensor > 55°C

When any fault is active, the red LED turns on and the green LED turns off. The OLED status bar shows the active fault codes (e.g. OV OT). All faults clear automatically once the measured value recovers past the threshold plus the hysteresis deadband.


Firmware Architecture

The main loop is fully non-blocking and timer-driven:

TaskIntervalNotes
ADC read + fault check500msReads all 5 channels, updates LEDs
Temperature conversion2000msPhase 1: send convert command
Temperature read2000ms + 750msPhase 2: read results after conversion window
OLED refresh2000msAlternates between page 1 and page 2
Watchdog resetEvery loop5s hardware WDT reboots on hang

The DS18B20 conversion window (750ms) runs concurrently with ADC reads and display updates — there is no delay() in the main loop.


Hardware Design Files

The hardware/ directory contains the complete KiCad project for the pbMonitor V2 PCB:

FileDescription
*.kicad_proKiCad project
*.kicad_schSchematic source (open in KiCad 7+)
*.kicad_pcbPCB layout source
schematic.pdfExported schematic for viewing without KiCad
BOM.csvBill of materials with component values and footprints

Designed in KiCad 7. Open the .kicad_pro file to load the full project.


License

MIT License — free to use, modify, and distribute with attribution. See LICENSE for full text.

Parts

79
QtyValueFootprintReferences
8100RResistor_SMD:R_0805_2012MetricR11, R12, R15, R16, R19, R20, R22, R24
51uFCapacitor_SMD:C_0805_2012MetricC5, C6, C16, C19, C21
54.7nFCapacitor_SMD:C_0805_2012MetricC10, C11, C12, C13, C20
5Conn_01x01MountingHole:MountingHole_2.7mm_Pad_ViaK10, K11, K12, K13, K14
40.01uFCapacitor_SMD:C_0805_2012MetricC14, C15, C18, C22
40.1uFCapacitor_SMD:C_0805_2012MetricC2, C7, C8, C9
410kResistor_SMD:R_0603_1608MetricR1, R6, R7, R8
447kResistor_SMD:R_0805_2012MetricR10, R14, R18, R23
4MountingHoleMountingHole:MountingHole_3.2mm_M3_DIN965H1, H2, H3, H4
310uFCapacitor_SMD:C_0805_2012MetricC1, C3, C4
21kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR4, R5
24.7kResistor_SMD:R_0805_2012MetricR2, R3
2B140HW-7Diode_SMD:D_SOD-123D1, D2
2LOGOfootprints:elektorlabs-20x6.1mmG***, G***
2OLEDConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalK1, K3
11.10MResistor_SMD:R_0805_2012MetricR13
11.47MResistor_SMD:R_0805_2012MetricR9
110uFSamacSys_Parts:CAPAE400X550NC17
1332kResistor_SMD:R_0805_2012MetricR21
1732kResistor_SMD:R_0805_2012MetricR17
1B1 TempConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalK5
1B2 TempConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalK4
1B3 TempConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalK7
1B4 TempConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalK6
1BOOTSamacSys_Parts:SKRKAEE020SW1
1Current SensorConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalK15
1ENSamacSys_Parts:SKRKAEE020SW2
1ESP32-C6-MINI-1/UPCM_Espressif:ESP32-C6-MINI-1MOD1
1NCD0805G1LED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderLED1
1NCD0805R1LED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderLED2
1NCP167BFCT330T2GSamacSys_Parts:BGA4C35P2X2_64X64X33IC2
1PROGConnector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalK8
1QwiicConnector_JST:JST_SH_SM04B-SRSS-TB_1x04-1MP_P1.00mm_HorizontalK9
1SMF05C.TCTSamacSys_Parts:SOT65P210X110-6ND3
1TLA2518IRTERSamacSys_Parts:QFN50P300X300X80-17N-DIC4
1TLV9004xRUCRPackage_DFN_QFN:Texas_S-PX2QFN-14IC3
1UJ20-C-H-C-3-SMT-TRExternal Library:CUI_UJ20-C-H-C-3-SMT-TRK2
1ZLDO1117QK50TCSamacSys_Parts:ZLDO1117QK50TCIC1

Similar boards

  • 4 layers80.6 × 60.6 mmLorawan sensor node v2, the printed circuit board in 3D

    Lorawan sensor node v2

    ElektorLabs/lorawan-sensor-node-v2

    Solar Powered LoRaWAN Sensor Node V2

    84 parts1GPL-3.0
  • 2 layers79.5 × 79.5 mmEsp32-energymeter V2, the printed circuit board in 3D

    Esp32-energymeter V2

    ElektorLabs/esp32-energymeter

    The Elektor ESP32 Energy Meter project, featuring schematics, PCB designs, and ESPHome integration for advanced energy monitoring

    116 parts48MIT
  • 2 layers70 × 20 mmPicoBerry V1.0, the printed circuit board in 3D

    PicoBerry V1.0

    mfolejewski/PicoBerry

    PicoBerry - small CM4 carrier board with full 40-pin GPIO header

    36 parts63
  • 2 layers80 × 55 mmIm01, the printed circuit board in 3D

    Im01

    amuzdgp3-prog/im-01-pulse-device

    Отдельный модуль к системе обслуживания аппаратов 2.apixspb.ru. Устройство слушает импульсные выходы монетоприёмника и купюроприёмника, копит показания в FRAM и дважды в сутки передаёт их на сервер по LTE Cat.1.

    108 parts
  • 6 layers98.9 × 81.4 mmEthernetSwitch, the printed circuit board in 3D

    EthernetSwitch

    SamuelCicuitStudio/LAN9645-STM32-Managed-Ethernet-Switch

    Managed Ethernet switch platform built around the LAN9645 and STM32H743, featuring copper and SerDes ports, SPI management, RMII, LwIP, and a USB diagnostic CLI.

    231 parts
  • 2 layers52 × 29 mmCellular featherwing pcb, the printed circuit board in 3D

    Cellular featherwing pcb

    keenanjohnson/cellular-featherwing-pcb

    The PCB Design for a Cellular Adafruit Featherwing based on the Quectel BG96 LTE Cat M1 & Cat NB1.

    64 parts1
  • 2 layers70.6 × 70.6 mmProject PCB, the printed circuit board in 3D

    Project PCB

    hhh2004/DTAP2025_Team7_PCB

    51 parts
  • 4 layers37.6 × 34.9 mmGSM GPS HAT, the printed circuit board in 3D

    GSM GPS HAT

    shahariyar-maraz/PCB_Design

    70 parts

Questions

How big is the Pb Monitor v2 PCB?

It measures 68.4 × 51.1 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Pb Monitor v2 use?

79 parts, built around the ESP32-C6-MINI-1U-H4, ZLDO1117QK50TC, B140HW-7-HXY and NCD0805G1. 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 Pb Monitor v2 KiCad files?

From the ElektorLabs/Pb-Monitor-v2 repository on GitHub, at the commit this page was made from: the board is hardware/PbMonitor-v2/PbMonitor-v2.kicad_pcb and its schematic hardware/PbMonitor-v2/PbMonitor-v2.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Pb Monitor v2 design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).