Close

Design challenge n.2: what is the best way to set the cell address?

A project log for Green BMS

Open source Bluetooth Smart Battery Management System

sergio-ghirardelliSergio Ghirardelli 10/10/2021 at 06:510 Comments

The address of each single cell is written in a variable within the sketch of the Attiny controller:

TinyWireS.begin (address);

Obviously I couldn't create a sketch for each cell, it would have been a terrible project and impossible to manage !!!

Imagine each software release having to create n different sketches ..

So the challenge was to find a simple and user friendly way to be able to set the address of the cells, keeping a single sketch.

The first idea I had was to install a dip switch in each cell module.

 I immediately put this solution aside, because it had a huge limit:

In order to manage a large number of cells (in perspective I would like to reach at least 72 cells) I would have had to use a 7-position dip switch.

6 bits = 64 addresses

This choice would have occupied too many I / O pins of the microcontroller!

So after some tests I found the solution I was looking for:

I used 2 buttons and 2 LEDs.

I have created a "programming" mode that can be activated or deactivated by pressing the 2 buttons simultaneously

I gave the user the possibility to set the cell address by setting the units (first button) and tens (second button).

The number of blinks of the LEDs is the feedback that indicates to the user how many units and how many tens.

When the user exits the programming mode, the set address is permanently saved in the Eeprom of the microcontroller.

So by occupying 4 pins, I created a solution that allows you to reach 99 addresses!

This design hurdle has also been overcome!

Here is a video that shows in practice how to set the address of each cell:


Discussions