{"id":661,"date":"2014-09-17T13:04:03","date_gmt":"2014-09-17T12:04:03","guid":{"rendered":"http:\/\/ofalcao.pt\/blog\/?p=661"},"modified":"2014-09-17T13:04:03","modified_gmt":"2014-09-17T12:04:03","slug":"lego-ev3-ti-sensortag","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2014\/lego-ev3-ti-sensortag","title":{"rendered":"LEGO EV3 + TI SensorTag"},"content":{"rendered":"<p>Chegou hoje o SensorTag da Texas Instruments.<\/p>\n<p>\u00c9 um dispositivo BLE (Bluetooth 4.0 Low Energy) com v\u00e1rios sensores (temperatura, humidade, acelera\u00e7\u00e3o\/orienta\u00e7\u00e3o e press\u00e3o atmosf\u00e9rica, bem como 2 bot\u00f5es de press\u00e3o).<\/p>\n<p>Com o ev3dev foi fac\u00edlimo ler a temperatura ambiente, bastou consultar dois links:<\/p>\n<ul>\n<li><a href=\"http:\/\/mike.saunby.net\/2013\/04\/raspberry-pi-and-ti-cc2541-sensortag.html\">Raspberry Pi and TI CC2541 SensorTag<\/a><\/li>\n<li><a href=\"http:\/\/processors.wiki.ti.com\/index.php\/SensorTag_User_Guide\">SensorTag User Guide<\/a><\/li>\n<\/ul>\n<p>Partindo de um dongle BT4.0 funcional em hci0 (ver o meu artigo anterior,<a title=\"LEGO B3AC0N\" href=\"http:\/\/ofalcao.pt\/blog\/2014\/lego-b3ac0n\"> LEGO B3AC0N<\/a>)<\/p>\n<p>Carregar no bot\u00e3o de discovery do SensorTag e fazer um scan BLE:<\/p>\n<pre>root@ev3dev:~# hcitool -i hci0 lescan\nBC:6A:29:AB:83:4D SensorTag\nBC:6A:29:AB:83:4D (unknown)\nBC:6A:29:AB:83:4D SensorTag\nBC:6A:29:AB:83:4D (unknown)\nBC:6A:29:AB:83:4D SensorTag\n...\n^C<\/pre>\n<p>&nbsp;<\/p>\n<pre>root@ev3dev:~# gatttool -b BC:6A:29:AB:83:4D -I\n[BC:6A:29:AB:83:4D][LE]&gt; connect\nAttempting to connect to BC:6A:29:AB:83:4D\nConnection successful\n[BC:6A:29:AB:83:4D][LE]&gt; char-read-hnd 0x25\nCharacteristic value\/descriptor: 00 00 00 00\n[BC:6A:29:AB:83:4D][LE]&gt; char-write-cmd 0x29 01\n[BC:6A:29:AB:83:4D][LE]&gt; char-read-hnd 0x25\nCharacteristic value\/descriptor: ae fe 74 0c\n[BC:6A:29:AB:83:4D][LE]&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>Os quatro bytes do valor medido (ae fe 74 0c) correspondem a duas temperaturas: a do objecto em frente e a ambiente, no formato<\/p>\n<p style=\"text-align: center;\">ObjLSB ObjMSB AmbLSB AmbMSB<\/p>\n<p>Assim:<\/p>\n<p style=\"text-align: center;\">Temp Amb = 0c74 = 3188<\/p>\n<p>O valor real \u00e9 obtido dividindo por 120:<\/p>\n<p style=\"text-align: center;\">3188\/128 = 24.90625 = 25\u00baC<\/p>\n<p>\u00a0(Valor confirmado pela aplica\u00e7\u00e3o Android BLE SensorTag da TI)<\/p>\n<p>Nota: ocasionalmente a conex\u00e3o BLE falha. Nessas situa\u00e7\u00f5es pode-se reiniciar o dongle com os comandos:<\/p>\n<pre>hciconfig hci0 down<\/pre>\n<pre>hciconfig hci0 up<\/pre>\n<p>(em casos extremos ser\u00e1 necess\u00e1rio remover fisicamente o dongle e voltar a inseri-lo ou na sua impossibilidade o velho reboot resolve tudo)<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Chegou hoje o SensorTag da Texas Instruments. \u00c9 um dispositivo BLE (Bluetooth 4.0 Low Energy) com v\u00e1rios sensores (temperatura, humidade, acelera\u00e7\u00e3o\/orienta\u00e7\u00e3o e press\u00e3o atmosf\u00e9rica, bem como 2 bot\u00f5es de press\u00e3o). Com o ev3dev foi fac\u00edlimo ler a temperatura ambiente, bastou consultar dois links: Raspberry Pi and TI CC2541 SensorTag SensorTag User Guide Partindo de um &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2014\/lego-ev3-ti-sensortag\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;LEGO EV3 + TI SensorTag&#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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[13,18,19],"tags":[217,219,106],"series":[],"class_list":["post-661","post","type-post","status-publish","format-standard","hentry","category-ev3dev","category-lego","category-lego-mindstorms","tag-ble","tag-bluetooth","tag-smarttag"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Mhyv-aF","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/661","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=661"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/661\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=661"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=661"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=661"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}