{"id":1398,"date":"2018-08-21T04:43:18","date_gmt":"2018-08-21T03:43:18","guid":{"rendered":"https:\/\/ofalcao.pt\/blog\/?p=1398"},"modified":"2018-08-21T04:43:18","modified_gmt":"2018-08-21T03:43:18","slug":"just-a-bit-more-sense-now","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2018\/just-a-bit-more-sense-now","title":{"rendered":"just a bit more sense now"},"content":{"rendered":"<div class=\"seriesmeta\">This post is part 3 of 8 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/sniffing-the-lego-interactive-motor\" class=\"series-341\" title=\"Sniffing the LEGO Interactive Motor\">Sniffing the LEGO Interactive Motor<\/a><\/div><p>(And I really must be crazy to stay up late doing this)<\/p>\n<p>At 115200 there is also a pattern (and why did I start with 57600?)<\/p>\n<pre>00 00 00 00 00 00 00 54 22 00 10 20 B9 \r\nD8 00 00 00 00 00 00 00 00 27\r\nD8 00 00 00 00 00 00 00 00 27\r\nD8 00 00 00 00 00 00 00 00 27\r\nD8 00 00 00 00 00 00 00 00 27\r\n...<\/pre>\n<p>First position notification says &#8217;08 00 45 01 00 00 00 00&#8242; so the encoder is at zero.<\/p>\n<p>Sending 5x the command to turn 1 degree I get 3 position changes:<\/p>\n<pre>08 00 45 01 01 00 00 00 \r\n08 00 45 01 04 00 00 00 \r\n08 00 45 01 05 00 00 00<\/pre>\n<p>(1\u00ba, 4\u00ba and 5\u00ba)<\/p>\n<p>and a decent capture:<\/p>\n<pre>D8 00 00 00 00 00 00 00 00 27\r\nD8 00 01 00 00 00 00 00 00 26\r\nD8 00 02 00 00 00 00 00 00 25\r\nD8 00 02 00 00 00 00 00 00 25 \r\nD8 07 03 00 00 00 00 00 00 23\r\nD8 07 04 00 00 00 00 00 00 24\r\nD8 03 05 00 00 00 00 00 00 21\r\nD8 03 05 00 00 00 00 00 00 21\r\nD8 00 05 00 00 00 00 00 00 22\r\nD8 00 05 00 00 00 00 00 00 22\r\nD8 00 05 00 00 00 00 00 00 22<\/pre>\n<p>So clearly the 3rd byte is the position (but passing through 2\u00ba and 3\u00ba seems to have been ignored by the Hub) and the 2nd byte is related to the speed and direction of the rotation.<\/p>\n<p>Now the 1st and last byte: 27 is the ones&#8217; complement of D8<\/p>\n<p>And probably this isn&#8217;t the right algorithm but it works at 4 am: if we calculate &#8216;S&#8217; as the XOR of all payload bytes, the last byte is 27 &#8211; S.<\/p>\n<p>Now I &#8216;just&#8217; need to understand the first bytes received after power up:<\/p>\n<pre>00 00 00 00 00 00 00 54 22 00 10 20 B9<\/pre>\n<p>It must be the announcement that complements the AutoID&#8230;. but does it have some kind of meaning?<\/p>\n<p>Ideas?<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"seriesmeta\">This post is part 3  of 8 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/sniffing-the-lego-interactive-motor\" class=\"series-341\" title=\"Sniffing the LEGO Interactive Motor\">Sniffing the LEGO Interactive Motor<\/a><\/div><p>(And I really must be crazy to stay up late doing this) At 115200 there is also a pattern (and why did I start with 57600?) 00 00 00 00 00 00 00 54 22 00 10 20 B9 D8 00 00 00 00 00 00 00 00 27 D8 00 00 00 00 00 &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2018\/just-a-bit-more-sense-now\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;just a bit more sense now&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[1],"tags":[],"series":[341],"class_list":["post-1398","post","type-post","status-publish","format-standard","hentry","category-sem-categoria","series-sniffing-the-lego-interactive-motor"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Mhyv-my","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/comments?post=1398"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1398\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=1398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=1398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=1398"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=1398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}