title: Cannot connect to BLE device on Raspberry Pi
body: <p>I'm trying to connect to a BLE device (Heart rate sensor, Polar H7), on a Raspberry Pi 2. I use the last version of bluez (5.35) found here: <a href="http://www.bluez.org/download/" rel="noreferrer">http://www.bluez.org/download/</a>
  But when I'm trying to connect using <code>gatttool</code>, I always have "connection refused" error.</p>
  
  <p>Here is what I do :</p>
  
  <pre><code>pi@raspberrypi ~ $ sudo su
  root@raspberrypi:/home/pi# hciconfig dev
  hci0:   Type: BR/EDR  Bus: USB
          BD Address: 5C:F3:70:69:54:3D  ACL MTU: 1021:8 SCO MTU: 64:1
          DOWN
          RX bytes:616 acl:0 sco:0 events:34 errors:0
          TX bytes:380 acl:0 sco:0 commands:34 errors:0
  
  root@raspberrypi:/home/pi# hciconfig dev up
  root@raspberrypi:/home/pi# hcitool lescan
  LE Scan ...
  00:22:D0:6D:E0:E6 (unknown)
  00:22:D0:6D:E0:E6 Polar H7 6DE0E61C
  ^Croot@raspberrypi:/home/pi# hcitool lecc 00:22:D0:6D:E0:E6
  Connection handle 64
  root@raspberrypi:/home/pi# gatttool -b 00:22:D0:6D:E0:E6 -I
  [00:22:D0:6D:E0:E6][LE]&gt; connect
  Attempting to connect to 00:22:D0:6D:E0:E6
  Error connect: Connection refused (111)
  [00:22:D0:6D:E0:E6][LE]&gt; 
  </code></pre>
  
  <p>I tried to follow this topic: <a href="https://stackoverflow.com/questions/24853597/ble-gatttool-cannot-connect-even-though-device-is-discoverable-with-hcitool-lesc">BLE gatttool cannot connect even though device is discoverable with hcitool lescan</a>
  but it did not work for me.</p>