{"id":840,"date":"2014-12-01T22:10:26","date_gmt":"2014-12-01T22:10:26","guid":{"rendered":"http:\/\/ofalcao.pt\/blog\/?p=840"},"modified":"2016-06-14T15:29:24","modified_gmt":"2016-06-14T14:29:24","slug":"raspberry-pi-sbrick","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2014\/raspberry-pi-sbrick","title":{"rendered":"Raspberry Pi + SBrick"},"content":{"rendered":"<p>Finally got time to return to the Pi.<\/p>\n<p>Yes, the Raspberry Pi can talk to the SBrick. It&#8217;s only necessary to install Bluez 5.<\/p>\n<p>But as the standard Raspbian is based on Debian Wheezy, if you install bluez from the repositories<\/p>\n<pre>sudo apt-get install bluez<\/pre>\n<p>you will get Bluez 4 (today, 1 December 2014, it&#8217;s version 4.99). I can make a Low Energy Scan (lescan) and find the SBrick but my gatttool commands fail with<\/p>\n<pre>Host is down (112)<\/pre>\n<p>So we need Bluez 5. There are at least two ways:<\/p>\n<ul>\n<li>get Bluez 5 source code and compile as in <a href=\"http:\/\/www.elinux.org\/RPi_Bluetooth_LE\">RPi Bluetooth LE<\/a><\/li>\n<li>update Raspbian to Debian Jessiea as it already includes Bluez 5<\/li>\n<\/ul>\n<p>I&#8217;m lazy, I don&#8217;t like to compile anything. I&#8217;m also afraid that any update might brake compatibility and forces me to recompile again. And my laptop (Unbuntu) and my EV3 (ev3dev) are already running a version of Jessie so let&#8217;s update.<\/p>\n<p><strong>Warning:<\/strong> Raspbian update from Wheezy to Jessie takes almost a day &#8211; so compiling Bluez might appeal to those in a hurry.<\/p>\n<p>We need enough free space on the SD card. I used a 4 GB card and my first try failed miserable after a long night. So the second time I removed some things to assure an happy end.<\/p>\n<p>First I transfered <a href=\"http:\/\/downloads.raspberrypi.org\/raspbian_latest\">the most recent image available<\/a> (2014-09-09) to the 4 GB card and edited networking to get wi-fi (I only use SSH with the Raspberry, like I do with the LEGO Mindstorms EV3).<\/p>\n<p>After first boot with the fresh card run rasp-config to expand the file system with all free space available.<\/p>\n<pre>sudo rasp-config<\/pre>\n<p>after next boot remove some heavy things and clean:<\/p>\n<pre>sudo apt-get remove x11-common midori lxde\r\nrm \/opt\/vc\/src\/hello_pi\/hello_video\/test.h264\r\nrm -rf python_games\r\nsudo apt-get clean\r\ndf -h<\/pre>\n<p>there are now 2.0 GB available on the 4.0 GB card. That&#8217;s enough, let&#8217;s change the source of our packages:<\/p>\n<pre>sudo nano \/etc\/apt\/sources.list<\/pre>\n<p>replace &#8216;wheezy&#8217; with &#8216;jessie&#8217; and save.<\/p>\n<pre>sudo apt-get update\r\nsudo apt-get upgrade\r\nsudo reboot<\/pre>\n<pre>By now we have near 1.8G available.\r\n\r\nsudo dist-upgrade\r\nsudo reboot\r\n\r\n<\/pre>\n<p>Now we are already using a Debian Jessie version of Raspbian.<\/p>\n<pre>sudo apt-get install bluez<\/pre>\n<p>As of 1 December 2014, Debian Jessie for Raspberry Pi uses bluez 5.23-1. Now remove all garbage and check space again:<\/p>\n<pre>apt-get autoremove\r\n\r\ndf -h<\/pre>\n<p>807 MB avaliable, not bad.<\/p>\n<p>My bluetooth BT 4.0 USB dongle is recognized (it already was) but is not active by default so before using it<\/p>\n<pre>sudo hciconfig hci0 up<\/pre>\n<p>now gatttool commands work with the SBrick, and so all my scripts from Ubuntu and EV3.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Finally got time to return to the Pi. Yes, the Raspberry Pi can talk to the SBrick. It&#8217;s only necessary to install Bluez 5. But as the standard Raspbian is based on Debian Wheezy, if you install bluez from the repositories sudo apt-get install bluez you will get Bluez 4 (today, 1 December 2014, it&#8217;s &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2014\/raspberry-pi-sbrick\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;Raspberry Pi + SBrick&#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":[245,247],"series":[],"class_list":["post-840","post","type-post","status-publish","format-standard","hentry","category-sem-categoria","tag-jessie-pt","tag-wheezy-pt"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Mhyv-dy","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/840","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=840"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/840\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=840"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}