Close

Design challenge n.14: data exchange management

A project log for Green BMS

Open source Bluetooth Smart Battery Management System

Sergio GhirardelliSergio Ghirardelli 10/24/2021 at 18:100 Comments

A complicated challenge of this project was the management of data exchange in the installed networks.

The I2c communication with the cells is the main network (always alive), the Bluetooth communication with Android app is the secondary network, that is alive only when user connects with the App: how to manage data exchange?

The goal was to be able to read and write data with the maximum number of cells (40) within 5 seconds, so I had in theory 125ms per cell.

I analyzed i2c communication with my picoscope:

So I immediately thought of using a fixed timing with which to read and write the data on each cell.

But this setting proved risky for a simple reason: when I enabled Bluetooth communication with the Android application, problems arose due to the variable and unpredictable length of this data exchange.

In practice, cell writing/readings steps were periodically skipped, with loss of synchrony.

Not being able to predict the duration of the Bluetooth data exchange, I therefore decided to leave the idea of a fixed timing and work sequentially, letting each step begin with the end of the previous one.

In summary I organized the task in this way:

This solution guaranteed the execution of each step without losses.

To keep the Bluetooth data exchange time below an acceptable value (about 20 ms), I split the exchange data to be received / sent into the various loops.

Discussions