Skip to main content

MoaT EMS Battery

% start synopsis % start main

This module implements a generic battery controller.

The client is a microcontroller, e.g. an ESP32 or a RP2040. It runs MicroPython and talks to the server via the MoaT messaging protocol.

The server side runs in the MoaT multiplexer that talks to the battery. It typically uses a web page for setup, and/or connects to DBus.

% end synopsis

Rationale

One of the MoaT project's objectives is to implement a uniform, multiplexable front-end for various devices.

Battery management systems typically have interfaces with device-specific command sets that can only be talked to by a single client, so devising a common language makes sense.

Also, a BMS may not have the required features. For instance, you might want to chain multiple batteries in series or in parallel. Or, the BMS firmware does not understand that some battery chemistries require adaptive strategies for charging that cannot be expressed with a single charge curve.

Why so complex?

The client connects to the actual BMS hardware with TTL serial, SPI, I²C, RS485, CAN, or similar. For the most part, these interfaces do not support galvanic separation, may not even exist on a server.

The client needs to constantly monitor battery current, cell and system voltage, battery temperature et al.. It must be able to disconnect the battery's relay if any parameter exceeds the cell and battery specifications. This function should run continuously even if communication with the server fails.

% end main

Setup

As typical clients are resource-constrained, you need to add the Battery management code to the MicroPython flash image. Add this repository's manifest, from moat/micro/_embed/manifest_bms.py, alongside the one from moat.micro.

Add a "BMS" app to the "moat.micro" configuration::

apps:
  …
  bat1: bms.std.Cmd

bat1:
  …

The "bat1" section (or however you want to name it) is described in moat/ems/battery/_cfg.yaml. More extensive documentation is TODO.

Start the client and multiplexer normally; the MoaT BMS will run as part of the multiplexer.

Server-only operation

Some systems don't need a client. A commercial BMS with an RS485 interface e.g. can be connected directly to the server, no intermediate client required.

In this case, set the "dev:" entry in the "port:" section to "null".

Modules

Right now the only battery model is "std". It connects several subsystems:

  • system voltage, current and temperature

  • cell voltage and temperature

It controls

  • the balancing system(s)

  • the battery relay

Also, it sends the battery's SoC and its voltage and current limits to whichever program requires them, as well as displaying them to the user.

Metadata

Release files for moat-ems-battery 0.2.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moat-ems-battery 0.2.22
File Size Uploaded
moat_ems_battery-0.2.22.tar.gz 24.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moat-ems-battery 0.2.22
File Interpreter ABI Platform
moat_ems_battery-0.2.22-py3-none-any.whl Python 3 none any Details

Total release size: 46.5 kB

Release files / moat_ems_battery-0.2.22.tar.gz

Download URL moat_ems_battery-0.2.22.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ac16afbcce77746389d67ce50c8b8619d3302382b593499a4bd62dac4ef04c32
BLAKE2b-256 checksum
How to use checksums
45d1682ba7e3a9e9e6346df8f3f3233bc28fb79b5fbd0ee292fb72d0aa04bc72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / moat_ems_battery-0.2.22-py3-none-any.whl

Download URL moat_ems_battery-0.2.22-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ac933ac447254b403c2fb0155fe331caac2ee936d5b731615021ba62a70c4c6
BLAKE2b-256 checksum
How to use checksums
b57c1f7d190b3cd28ddb68ba509b6c550e2e7f393a61af07de5cf2eb9c31c53b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.2.22 This release

2 release files

0.2.18

2 release files

0.2.17

2 release files

0.2.16

2 release files

0.2.14

2 release files

0.2.12

2 release files

0.2.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page