{"id":210,"date":"2023-04-20T08:00:02","date_gmt":"2023-04-20T08:00:02","guid":{"rendered":"https:\/\/smolgeek.com\/?p=210"},"modified":"2023-05-30T06:33:23","modified_gmt":"2023-05-30T06:33:23","slug":"bms","status":"publish","type":"post","link":"https:\/\/smolgeek.com\/cs\/2023\/04\/20\/bms\/","title":{"rendered":"BMS monitoring"},"content":{"rendered":"<div class=\"taxonomy-post_tag wp-block-post-terms flex\"><svg class=\"icon icon-tags\" aria-hidden=\"true\" role=\"img\"> <use href=\"#icon-tags\" xlink:href=\"#icon-tags\"><\/use> <\/svg><a href=\"https:\/\/smolgeek.com\/cs\/tag\/android\/\" rel=\"tag\">Android<\/a><span class=\"wp-block-post-terms__separator\">, <\/span><a href=\"https:\/\/smolgeek.com\/cs\/tag\/java\/\" rel=\"tag\">Java<\/a><\/div>\n\n\n<p>There goes app that meant for basic control and monitoring of values from battery management systems. <\/p>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-container-1\">\n<figure class=\"wp-block-image alignleft size-large is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/filedn.eu\/l5hSrgny5aTmlBwoFQogJlk\/res\/pic\/BMS_Android\/BMS_dark_theme.gif\" alt=\"\" width=\"270\" height=\"480\"\/><figcaption class=\"wp-element-caption\">Approved UI layout <\/figcaption><\/figure>\n\n\n\n<p>Client at first only wanted to design UI and stated his programmer will do the rest.  Which I delivered to the clients satisfaction.<br>Project grew into full app anyway.  <br>App incorporates client&#8217;s basic logic written in C++ into it&#8217;s own Java logic. <br>Java calls C++ when it needs data and translates it into UI human readable form.     <br>It&#8217;s not most efficient way but it was one the requirements.<br><br>Most interesting experience about developing this app was reading binary communication sent via BMS protocol.<br><\/p>\n<\/div>\n\n\n\n<p>For those interested what is BMS communication like. Communication consists of frames.  <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th class=\"has-text-align-right\" data-align=\"right\">#<\/th><th class=\"has-text-align-left\" data-align=\"left\">Frame unit<\/th><th>L. <\/th><th>note<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-right\" data-align=\"right\">1<\/td><td class=\"has-text-align-left\" data-align=\"left\">STX<\/td><td>2<\/td><td>Start frame: 0x4E(78&#8243;N&#8221;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x57(87&#8243;W&#8221;)<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">2<\/td><td class=\"has-text-align-left\" data-align=\"left\">LENGTH<\/td><td>2<\/td><td>The length of the frame<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">3<\/td><td class=\"has-text-align-left\" data-align=\"left\">BMS terminal number<\/td><td>4<\/td><td>4 bytes ID<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">4<\/td><td class=\"has-text-align-left\" data-align=\"left\">Command word<\/td><td>1<\/td><td>Refer to the command word description,<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">5<\/td><td class=\"has-text-align-left\" data-align=\"left\">The frame source<\/td><td>1<\/td><td>BMS,1. Bluetooth,2.GPS,3. PC PC<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">6<\/td><td class=\"has-text-align-left\" data-align=\"left\">Transport type<\/td><td>1<\/td><td>1. Response frame 2.BMS active upload<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">7<\/mark><\/td><td class=\"has-text-align-left\" data-align=\"left\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">Frame information unit<\/mark><\/td><td><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">N<\/mark><\/td><td><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">The information domain BMS sets the data identifier code<\/mark><\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">8<\/td><td class=\"has-text-align-left\" data-align=\"left\">Record number<\/td><td>4<\/td><td>High 1 byte is random code meaningless (reserved for encryption), low 3 bytes is Record the serial number<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">9<\/td><td class=\"has-text-align-left\" data-align=\"left\">End of identity<\/td><td>1<\/td><td>0X68<\/td><\/tr><tr><td class=\"has-text-align-right\" data-align=\"right\">10<\/td><td class=\"has-text-align-left\" data-align=\"left\">The checksum<\/td><td>4<\/td><td>Accumulated checksum(high 2 bytes forCRC notyet enabledto fill 0, low 2 Byte for cumulative check)<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Frame structure.<\/figcaption><\/figure>\n\n\n\n<p>Each frame is basically bunch of bits, and when I say bunch in this case I mean hundreds.  By grouping bits we get bytes, combining bytes makes real chunks of data readable. Communication frame has structure that has beginning, body and ending. By reading combinations of bits bunched into bytes we get to find data identifiers within long line of zeros and nulls. <br><br>Data Identifiers allows us to pinpoint starting points of data like voltage of battery cell 1,2,.. , etc . Then we just follow logic that is defined for each identifier to convert data into needed format. More about this concrete communication format can be found in the <a rel=\"noreferrer noopener\" href=\"https:\/\/filedn.eu\/l5hSrgny5aTmlBwoFQogJlk\/res\/doc\/1621104621.pdf\" target=\"_blank\">BMS communication protocol<\/a> .<\/p>","protected":false},"excerpt":{"rendered":"<p>There goes app that meant for basic control and monitoring of values from battery management systems. Client at first only wanted to design UI and stated his programmer will do the rest. Which I delivered to the clients satisfaction.Project grew into full app anyway. App incorporates client&#8217;s basic logic written in C++ into it&#8217;s own [&hellip;]<\/p>","protected":false},"author":1,"featured_media":225,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[5],"tags":[9,12],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/filedn.eu\/l5hSrgny5aTmlBwoFQogJlk\/res\/pic\/BMS_Android\/BMS_ilustration.jpeg","_links":{"self":[{"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/posts\/210"}],"collection":[{"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/comments?post=210"}],"version-history":[{"count":15,"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/posts\/210\/revisions"}],"predecessor-version":[{"id":258,"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/posts\/210\/revisions\/258"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/media\/225"}],"wp:attachment":[{"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/media?parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/categories?post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smolgeek.com\/cs\/wp-json\/wp\/v2\/tags?post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}