- https://communities.intel.com/docs/DOC-23431?sr=stream&ru=354950
- http://rexstjohn.com/configure-intel-edison-for-bluetooth-le-smart-development/#more-2958
- https://github.com/sandeepmistry/bleno/issues/84
- http://rexstjohn.com/notes-for-getting-bleno-and-intel-edison-working-together/
- https://github.com/sandeepmistry/bleno
First of all, I flash Edison with the latest firmware; Intel Edison® Board Firmware Software Release 2.1 (edison-image-ww25.5-15.zip).
Or /etc/version says
weekly-159
Your Edison might behave differently if different version is running.
To make long story short,
Basic settings including wifi network
# configure-edison --setupInstall software using opkg
Edit /etc/opkg/base-feeds.conf file.# vi /etc/opkg/base-feeds.conf
Add following lines.
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
Install systemd-dev and bluez5-dev.
# opkg install systemd-dev
# opkg install bluez5-dev
Install software using npm
# npm -g install async# npm install noble
# npm install bleno
Enable Bluetooth device
Disable bluetooth daemon (bluetoothd). You need run it only once.# systemctl disable bluetooth
You have to run these commands every time after boot.
# rfkill unblock bluetooth
# hciconfig hci0 up
Run sample program (echo)
Start node process.# cd node_moduels/bleno/examples/echo
# node main.js
While a node process is running, open other terminal and down/up hci0 device.
# hciconfig hci0 down
# hciconfig hci0 up
Now, try to connect from other BLE supported device, such as a smartphone. There should be a BLE peripheral named 'echo'. I use an Android application, "BLE scanner". With this app, you can read and write data to/from BLE device, that is quite handy.
Problems
Network interface, usb0
After running configure-edison command, there are two network interfaces; usb0 and wlan0. But I could not connect to Edison using ssh via wifi because the routing table is looks like below.Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.2.253 0.0.0.0 UG 0 0 0 usb0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
# ifconfig usb0 down
It deletes default gateway too, so add it again.
# route add default gw default-gateway-IP-address
In my case,
# route add default gw 192.168.2.253
Or you can permanently change usb0's IP address by editing the following file.
# vi /etc/systemd/network/usb0.network
Installing Bleno
When installing Bleno, it installs bluetooth-hci-socket module too. But it requires libudev.h and there is no such file in Edison as default. Thus it failed to install Bleno.The header file is included in systemd-dev package. And so you need to install it before installing Bleno.
Running Bleno
Before disable bluetoothd, it advertises a name using a host name. If you name your Edison board "my_edison", you will see "my_edison" bluetooth device from other device. After disable bluetoothd (or kill bluetoothd process), the board still advertises using a bluetooth chip name? In my case, "BCM43340B0 37.4 MHz WLBGA_iTR Intel Edison-0122-N".I am not an expert of Bluetooth and so I do not know a proper solution. But I found the workaround of it. To let Bleno process advertise correctly, hci0 interface needs to be down and up again while Bleno process is running. And so Bleno process can advertise its own name.
0 件のコメント:
コメントを投稿