# Arduino MKRZero with Arduino MKR CAN Shield to read Smart Battery

**URL:** <https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608>\
**Category:** Libcanard\
**Created:** [March 10, 2022, 3:43am UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608 "2022-03-10T03:43:32Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Voon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/eric_voon/32/1035_2.png) [@Eric\_Voon](https://forum.opencyphal.org/u/Eric_Voon)\
**Post date:** [March 10, 2022, 3:43am UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/1 "2022-03-10T03:43:32Z")

</div>

Hi, I am using Arduino MKR Zero with its CANBus shield and 107-Arduino-UAVCAN library to read my Tattu smart battery (it has BMS). I was curious that I received raw data when I was using normal CAN library but I can’t get any data when I was using UAVCAN provided library. Is there anything that I might do it wrongly or skip when using the 107-Arduino-UAVCAN library (I would say my wiring is correct)?

I asked battery provider’s technicians, they said they are following UAVCAN protocol following by BMS subscription, and yet they didn’t encrypt the UAVCAN message for the smart battery. So, I am curious why I didn’t receive any data using the 107-Arduino-UAVCAN library.

Do I need to code it by myself using that library (107-Arduino-UAVCAN) as a reference or I can just use the example in the library directly?

Thank you.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 10, 2022, 10:52am UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/2 "2022-03-10T10:52:21Z")

</div>

This is probably because the vendor is actually implementing the legacy UAVCAN protocol, which is now maintained separately under the name of [DroneCAN](https://dronecan.github.io/). Use that instead.

---

<div class="post-metadata">

**Author:** ![Eric\_Voon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/eric_voon/32/1035_2.png) [@Eric\_Voon](https://forum.opencyphal.org/u/Eric_Voon)\
**Post date:** [March 10, 2022, 12:00pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/3 "2022-03-10T12:00:47Z")

</div>

I don’t think they are using legacy UAVCAN because Not even UAVCAN GUI Tool can recognise the BMS. I asked them regarding to this issue and confirm with them already, they said they are using UAVCAN but not telling me which version of UAVCAN. They told me that UAVCAN has many versions and they are using “BMS type”, they told me like this and I can only assume they said they are using UAVCAN v1.

Anyway, Thank you for your time to reply, much appreciated.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 10, 2022, 12:07pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/4 "2022-03-10T12:07:35Z")

</div>

UAVCAN has only two versions: v0 (now DroneCAN) and v1. I don’t know what the BMS type is. You need to get better support from the vendor.

---

<div class="post-metadata">

**Author:** ![Eric\_Voon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/eric_voon/32/1035_2.png) [@Eric\_Voon](https://forum.opencyphal.org/u/Eric_Voon)\
**Post date:** [March 10, 2022, 12:08pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/5 "2022-03-10T12:08:10Z")

</div>

ok Thank you for your precious time.

---

<div class="post-metadata">

**Author:** ![Eric\_Voon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/eric_voon/32/1035_2.png) [@Eric\_Voon](https://forum.opencyphal.org/u/Eric_Voon)\
**Post date:** [March 10, 2022, 12:13pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/6 "2022-03-10T12:13:14Z")

</div>

So, I can just use example (BMS subscribe) in library for supported UAVCAN v1 devices right?

Thank you.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 10, 2022, 12:14pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/7 "2022-03-10T12:14:43Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![Eric\_Voon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/eric_voon/32/1035_2.png) [@Eric\_Voon](https://forum.opencyphal.org/u/Eric_Voon)\
**Post date:** [March 18, 2022, 6:41am UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/8 "2022-03-18T06:41:18Z")

</div>

> [@pavel.kirienko](#):
>
> UAVCAN has only two versions: v0 (now DroneCAN) and v1. I don’t know what the BMS type is. You need to get better support from the vendor.

Sorry to interrupt you again, Tattu team has replied me as “we also do it according to the data structure of UAVCAN. UAVCAN defines the data structure and does not define the protocol content. The content of the agreement is defined by ourselves.”

I believe they claimed their BMS is using UAVCAN frame but they have different structure of messages in the frame.

Is that possible? The UAVCAN also defined the the content in the frame right, like which bytes are for voltage and so on.

And they are stressing that they are using UAVCAN all the time but they cannot answer my question of the version of UAVCAN that they are using.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 18, 2022, 2:23pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/9 "2022-03-18T14:23:29Z")

</div>

I don’t mind answering questions but I am concerned that maybe you are not spending your time in the most efficient way. Why not simply direct these questions to the vendor? I never seen their products and I have no idea how they implemented UAVCAN. I am happy to help with the protocol, its architecture, system design, official libraries, etc., but I cannot help you debug a random product that implements (or claims to) UAVCAN. If the vendor doesn’t understand what they are using, they would be welcome to seek help here.

---

<div class="post-metadata">

**Author:** ![coder\_kalyan](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/coder_kalyan/32/1361_2.png) [@coder\_kalyan](https://forum.opencyphal.org/u/coder_kalyan)\
**Post date:** [March 20, 2022, 5:49am UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/10 "2022-03-20T05:49:26Z")

</div>

Hello,

Based on some quick googling I found this documentation on the ardupilot forums: [https://discuss.ardupilot.org/uploads/short-url/9c0nyAi0ltZ0VJSpdwvMToOt2Uf.pdf](https://discuss.ardupilot.org/uploads/short-url/9c0nyAi0ltZ0VJSpdwvMToOt2Uf.pdf)

 ![image](https://forum.opencyphal.org/uploads/default/original/2X/7/78bcdd2234b9a6ec81e7c65b9412cffb61e594e5.png)

This looks like the message frame structure for UAVCAN v0, which (as Pavel said) is currently maintained under the DroneCAN project. However, it seems that these batteries are not very well documented so I’m not sure if it will work for you - best of luck, though! You can probably also ask the Ardupilot community (forum or Discord) to see if anyone there has experience with these batteries.

---

<div class="post-metadata">

**Author:** ![auturgy](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/auturgy/32/845_2.png) [@auturgy](https://forum.opencyphal.org/u/auturgy)\
**Post date:** [March 25, 2022, 11:36pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/11 "2022-03-25T23:36:05Z")

</div>

Tattu have basically implemented v0/DroneCAN incorrectly. I have an email thread with them somewhere, but basically Tattu need to fix it in order for their battery to be properly useable (as well as the broken implementation there’s silly things like hardcoded node ID so you can’t use more than one battery at a time). I think px4 merged a work around so that you can use a single battery (at the expense of any other can usage). Ardupilot didn’t.

---

<div class="post-metadata">

**Author:** ![Eric\_Voon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/eric_voon/32/1035_2.png) [@Eric\_Voon](https://forum.opencyphal.org/u/Eric_Voon)\
**Post date:** [March 29, 2022, 9:20am UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/12 "2022-03-29T09:20:10Z")

</div>

Thanks all.

---

<div class="post-metadata">

**Author:** ![Eric\_Voon](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/eric_voon/32/1035_2.png) [@Eric\_Voon](https://forum.opencyphal.org/u/Eric_Voon)\
**Post date:** [March 29, 2022, 9:21am UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/13 "2022-03-29T09:21:02Z")

</div>

> [@coder\_kalyan](#):
>
> message frame structure for UAVCAN v0

They said they are using UAVCAN’s structure but they defined the message inside. Is that possible?

---

<div class="post-metadata">

**Author:** ![pepeRossRobotics](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/peperossrobotics/32/1099_2.png) [@pepeRossRobotics](https://forum.opencyphal.org/u/pepeRossRobotics)\
**Post date:** [April 12, 2022, 2:13pm UTC](https://forum.opencyphal.org/t/arduino-mkrzero-with-arduino-mkr-can-shield-to-read-smart-battery/1608/14 "2022-04-12T14:13:49Z")

</div>

Might be a dumb question, but are you sure you have the correct CAN settings? Same CAN standard (2.0B vs FD) and same baud rate? I have had those issues in the past
