In this tutorial you will learn how to integrate the BMS772 into the B3RB.
It is important to take precautions when working with batteries:
Before connecting a battery to the BMS, test it first using a power supply which has current limiting enabled. See section: Setup validation. This is to avoid damage that could occur because of bad soldering, a short of some kind or swapped wires.
LiPo batteries can be dangerous and catch on fire. When first plugging in a LiPo battery, please do it outdoors in an area that is fire-safe. Have a fire extinguisher nearby.
The RDDRONE-BMS772 is a standalone BMS reference design supporting 3 to 6 cell batteries.
The General Purpose MCU S32K144 provides great flexibility and communication to a PX4 based FMU via UAVCAN or I2C/SMBus. More information about the board can be found in references [1][2].
The BMS will be integrated in the system following the wiring diagram below:
For setting up the hardware, we need:
prepare the 3D printed mount
solder connectors and make cables
solder the balance leads and make its extension cable
prepare a battery emulator setup
This particular 3D print will allow the RDDRONE-BMS772 to connect to the pre-production version of MR-B3RB lower chassis metal frame. Future versions may not need this adapter, or may be able to just use standoff's directly.
We recommend pluggable cable connectors as shown below. Follow these images for guidance. Some XT60 connectors have a "back shell" to also help cover the solder joints. The backshell is preferable.
Because of the limited space on the B3RB. it is preferable to use a balancing leads connector that points upward. This will better clear the PDB that is adjacent to this board, and allow you to more easily plug in the battery's balancing cable later. Solder the white balance connector as shown below:
If you cannot obtain a vertical balance lead connector, while sub-optimal, the right angle connector that ships with the board may be modified to stand upright by removing the tabs at the rear. Be extra careful about the correct orientation and alignment
You will also need to make an extension cable for the balance leads connector. The leads that typically come as part of the battery is quite short. The suggested cable length is approximately 17cm.
The extension cable can act as a fuse. While the wires in the picture below are thin, they can blow up in case of short circuit, the a battery damage could be avoided.
In this section we will prepare a setup to emulate the battery using a power supply. For this setup we need:
4 x 1kΩ resistors
2 wires: one black and one red
Female balance leads connector with wires
Here are the steps:
Connect the female balance leads connector with wires and cut them to make them short.
Solder the resistors in series then solder two cables in both sides (black and red) as depicted in the picture above. Please make sure that the sides of the black and red wires are similar to the picture.
connect Black and red wires of the battery cells emulator to - and + input from the power supply.
Set the voltage in your power supply to 12V, then plug the input port to the power supply and the output port to the load that you are powering.
You can compile a binary from this GitHub repository: https://github.com/NXPHoverGames/RDDRONE-BMS772 or flash the existing binary https://github.com/NXPHoverGames/RDDRONE-BMS772/blob/main/Binary/nuttx.bin (follow these instructions).
Activate the cyphal can and setup the can id:
In this section, we present three methods to display received messages via CAN:
using yakut CLI
using pycyphal library
using pycyphal library and ROS2
Before the three next steps, you need to prepare the environment variables and add the DSDL namespace as follow:
Yakút is a simple cross-platform command-line interface (CLI) tool for diagnostics and debugging of Cyphal networks. (For more information refer to [3])
The BMS772 software is already publishing three messages:
type: reg.udral.physics.electricity.SourceTs_0_1, port: 4096
type: reg.udral.service.battery.Status_0_2, port: 4097
type: reg.udral.service.battery.Parameters_0_3, port: 4098
Print published Cyphal message in a terminal:
First, clone the following repository:
Run the script to print the received cyphal messages:
Clone the following repository:
Run the ros2 node:
Print the topic:
Once the topic is publishing battery state messages, we can display it in Foxglove. Fist add the topic to the while listed topics in robot.launch.py file
In your PC, download the following layout file and add it to Foxglove studio:
You should see two different tabs: one tab General for displaying the B3RB topics and one tab Battery for displaying the battery status raw data:
[1] BMS gitbook: https://nxp.gitbook.io/rddrone-bms772/software-guide-px4/introduction
[3] https://github.com/OpenCyphal/yakut