RPi Bluetooth

From Datateknik
(Difference between revisions)
Jump to: navigation, search
(Setting an IPv6 address)
(Setting an IPv6 address)
Line 25: Line 25:
 
* This is a strange page
 
* This is a strange page
 
*: https://devzone.nordicsemi.com/f/nordic-q-a/14292/iot-sdk-rpi3---using-jessie-with-bluetooth_6lowpan
 
*: https://devzone.nordicsemi.com/f/nordic-q-a/14292/iot-sdk-rpi3---using-jessie-with-bluetooth_6lowpan
 +
** that says:
 +
**: root@raspberry:/home/pi#
 +
**: root@raspberry:/home/pi# lsmod | grep 6lo
 +
**: root@raspberry:/home/pi# modprobe bluetooth_6lowpan
 +
**: root@raspberry:/home/pi# echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
 +
**: root@raspberry:/home/pi# modprobe bluetooth_6lowpan
 +
**: root@raspberry:/home/pi# lsmod | grep 6lo
 +
**: bluetooth_6lowpan      24576  0
 +
**: 6lowpan                36864  8 nhc_udp,nhc_routing,nhc_mobility,bluetooth_6lowpan,nhc_fragment,nhc_dest,nhc_hop,nhc_ipv6
 +
**: bluetooth            552960  32 btrtl,bluetooth_6lowpan,btintel,bnep,btbcm,rfcomm,btusb
 +
**: root@raspberry:/home/pi#
  
 
==Programming in python==
 
==Programming in python==

Revision as of 09:34, 15 May 2018

hello

Contents

Bluetooth

Scanning BLE

Scanning BLE is from https://elinux.org/RPi_Bluetooth_LE

device testing

  1. Check what devices you've got
    lsusb
  2. Basic installation checks: The Pi 3's built-in Bluetooth adapter is called hci0. You can check it is operating correctly with the command:
    hciconfig
  3. If you are on a laptop two(2) hci devices will show up, the first one is buggy
    hciconfig hci0 down
  4. Now you can try scanning for BLE devices
    hcitool lescan

Python programs

  1. do stuff
    sudo apt-get install python-pip
    sudo apt-get install libglib2.0-dev
    sudo pip install bluepy
    blescan

Setting an IPv6 address

following the lowpan 802.15.4 blog

  • add
    apt-get install libnl-3-dev
  • This is a strange page
    https://devzone.nordicsemi.com/f/nordic-q-a/14292/iot-sdk-rpi3---using-jessie-with-bluetooth_6lowpan
    • that says:
      root@raspberry:/home/pi#
      root@raspberry:/home/pi# lsmod | grep 6lo
      root@raspberry:/home/pi# modprobe bluetooth_6lowpan
      root@raspberry:/home/pi# echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
      root@raspberry:/home/pi# modprobe bluetooth_6lowpan
      root@raspberry:/home/pi# lsmod | grep 6lo
      bluetooth_6lowpan 24576 0
      6lowpan 36864 8 nhc_udp,nhc_routing,nhc_mobility,bluetooth_6lowpan,nhc_fragment,nhc_dest,nhc_hop,nhc_ipv6
      bluetooth 552960 32 btrtl,bluetooth_6lowpan,btintel,bnep,btbcm,rfcomm,btusb
      root@raspberry:/home/pi#

Programming in python

från tysk sida

https://forum.fhem.de/index.php?topic=68019.15


Hi und danke erstmal,

bin jetzt soweit mit fast allen befehlen durch 

Code: [Auswählen]
pi@raspberrypi:~ $ ls -l /dev/ser*
lrwxrwxrwx 1 root root 7 Feb 28 23:59 /dev/serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 Feb 28 23:59 /dev/serial1 -> ttyS0

das sieht schon mal gut aus, lt. deinem Howto
allerdings bekomme ich dennoch kein Device : 

Code: [Auswählen]
pi@raspberrypi:~ $ hcitool dev
Devices:
pi@raspberrypi:~ $ hcitool scan
Device is not available: No such device
pi@raspberrypi:~ $ 

glaub bin zu müde oder zu blind.
habt Ihr eine Idee ??

danke


pi@raspberrypi:~ $  systemctl status bluetooth
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
   Active: active (running) since Do 2017-03-09 22:05:23 CET; 22s ago
     Docs: man:bluetoothd(8)
 Main PID: 794 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─794 /usr/lib/bluetooth/bluetoothd
pi@raspberrypi:~ $ sudo service bluetooth status
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
   Active: active (running) since Do 2017-03-09 22:05:23 CET; 27s ago
     Docs: man:bluetoothd(8)
 Main PID: 794 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─794 /usr/lib/bluetooth/bluetoothd

pi@raspberrypi:~ $ sudo hciconfig dev
Can't get device info: No such device

pi@raspberrypi:~ $ sudo bluetoothctl
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
No default controller available
[bluetooth]# exit
Agent unregistered


pi@raspberrypi:~ $ dmesg | grep Blue
[   22.873317] Bluetooth: Core ver 2.22
[   22.873369] Bluetooth: HCI device and connection manager initialized
[   22.873381] Bluetooth: HCI socket layer initialized
[   22.873389] Bluetooth: L2CAP socket layer initialized
[   22.873408] Bluetooth: SCO socket layer initialized
[  103.040851] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  103.040860] Bluetooth: BNEP filters: protocol multicast
[  103.040871] Bluetooth: BNEP socket layer initialized






so alles was mit Bluetooth zu tun hat gelöscht und folgendes getan

Code: [Auswählen]
sudo apt-get install raspberrypi-sys-mods

sudo apt-get --reinstall install pi-bluetooth

sudo shutdown -r now


dann 

Code: [Auswählen]
sudo systemctl start hciuart.service
pi@raspberrypi:~ $ systemctl status hciuart.service
● hciuart.service - Configure Bluetooth Modems connected by UART
   Loaded: loaded (/lib/systemd/system/hciuart.service; disabled)
   Active: active (running) since Fr 2017-03-10 00:17:11 CET; 5s ago
  Process: 951 ExecStart=/usr/bin/btuart (code=exited, status=0/SUCCESS)
 Main PID: 962 (hciattach)
   CGroup: /system.slice/hciuart.service
           └─962 /usr/bin/hciattach /dev/serial1 bcm43xx 460800 noflow -



und siehe da!!!

Code: [Auswählen]
pi@raspberrypi:~ $ hcitool dev
Devices:
	hci0	B8:27:EB:90:BC:6D

es geht!!

danke an alle!
Personal tools
Namespaces

Variants
Actions
Navigation
Tools