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.24

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.24
File Size Uploaded
moat_ems_battery-0.2.24.tar.gz 24.4 kB Details

Built distribution (wheel)

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

Total release size: 46.6 kB

Release files / moat_ems_battery-0.2.24.tar.gz

Download URL moat_ems_battery-0.2.24.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
921d7e32f0ab9f5ac807ef7744dd21c60676d7eb72dcdf3ec81faf810fb8b3ec
BLAKE2b-256 checksum
How to use checksums
058835d0352209e77d62e63eefd3ec30a1b0b932d639e0b9efd1600b523ec24a
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.24-py3-none-any.whl

Download URL moat_ems_battery-0.2.24-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c34ac0bcd285c09f4f8fb51ab55b964f0851636daf9b82f055996630dbc91b55
BLAKE2b-256 checksum
How to use checksums
e36ebad638cf35269d8f5889aa4e003941fe614dcb5196d54123ccbca44f2c83
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.24 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