Skip to content

Commit edc30da

Browse files
Update bluetooth-tethering-edison.md
1 parent d2fd170 commit edc30da

File tree

1 file changed

+45
-16
lines changed

1 file changed

+45
-16
lines changed

docs/docs/walkthrough/phase-4/bluetooth-tethering-edison.md

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ power on
4444
4545
discoverable on
4646
47+
scan on
48+
4749
agent on
4850
4951
default-agent
@@ -55,7 +57,7 @@ The adapter is now discoverable for three minutes. Search for bluetooth devices
5557

5658
For iPhone
5759
********************************
58-
you must use the edison to initiate pairing
60+
Your iPhone must be on the Settings/Bluetooth screen, and then you must use the Edison to initiate pairing:
5961
```
6062
pair AA:BB:CC:DD:EE:FF
6163
```
@@ -67,9 +69,7 @@ you will see on the edison
6769

6870
You must type in **yes** not just **y** to pair
6971

70-
After, the phone may ask you to enter a PIN. If so, enter '0000' and when bluetoothctl asks for a PIN, enter the same code again. Either way, bluetoothctl should inform you that pairing was successful. It will then ask you to authorize the connection - enter 'yes'.
71-
72-
Then on your phone you can hit the pair button that popped up.
72+
On your phone, tap the pair button that popped up.
7373

7474
Execute the paired-devices command to list the paired devices -
7575

@@ -78,7 +78,7 @@ paired-devices
7878
Device AA:BB:CC:DD:EE:FF Samsung S7
7979
```
8080

81-
Your paired phone should be listed (in this example, a Samsung Galaxy S7). Copy the bluetooth address listed for it; we will need to provide this later.
81+
Your paired phone should be listed (in this example, a Samsung Galaxy S7).
8282

8383
Now trust the mobile device
8484

@@ -87,20 +87,49 @@ Now trust the mobile device
8787
Quit bluetoothctl with 'quit'.
8888

8989
******************************
90-
**For Testing**
91-
Option 1 - If you are still on your home wifi you can test to see if you can pair by running (this only works with the Android)
92-
```
93-
sudo killall bluetoothd; sudo /usr/local/bin/bluetoothd --experimental &
9490

95-
sudo hciconfig hci0 name $HOSTNAME
96-
```
97-
then
91+
*Testing*
92+
93+
Before testing your connection, first restart the Bluetooth daemon:
94+
95+
`sudo killall bluetoothd`
96+
97+
wait a moment, hit enter, and you should get a message like `[1] Done sudo /usr/local/bin/bluetoothd --experimental`. After that, or after a few more seconds, run:
98+
99+
`sudo /usr/local/bin/bluetoothd --experimental &`
100+
101+
and then
102+
103+
`sudo hciconfig hci0 name $HOSTNAME`
104+
105+
Make sure your phone's hotspot is enabled (but don't let anything connect via wifi).
106+
107+
Now, try to establish a Bluetooth Network connection with your phone:
108+
109+
`sudo bt-pan client AA:BB:CC:DD:EE:FF`
110+
111+
You should see an indicator on your phone (a blue bar on iPhone) that your Bluetooth network connection has established. Next you'll need to get an IP address:
112+
113+
`sudo dhclient bnep0`
114+
115+
If that succeeds, you should be able to run `ifconfig bnep0` and see something like:
116+
98117
```
99-
sudo bt-pan client AA:BB:CC:DD:EE:FF
118+
bnep0 Link encap:Ethernet HWaddr 98:4f:ee:03:a6:91
119+
inet addr:172.20.10.4 Bcast:172.20.10.15 Mask:255.255.255.240
100120
```
101-
Option 2 - If you have a serial console connection to your Edison and are using wpa_supplicant, you can comment out your home wifi in `nano /etc/wpa_supplicant/wpa_supplicant.conf`, then reboot. (takes about 1 min after reboot for the Bluetooth Network to connect)
121+
(for iPhone, the inet addr will always start with 172.20.10. - Android will likely be different)
122+
123+
To disconnect the connection, you can run:
124+
125+
`sudo bt-pan client -d AA:BB:CC:DD:EE:FF`
126+
127+
Next, to test that Bluetooth starts up automatically, you can shut down your wifi for 2-3 minutes by running:
128+
129+
`iwconfig wlan0 txpower off; sleep 120; iwconfig wlan0 txpower auto`
102130

103-
Option 3 - Take a walk, and as soon as you are out of range of your wifi, you should see that a device is connected to your personal network. Shortly after that you will see things update on nightscout.
131+
About 1 min later, your bluetooth network should connect. If it doesn't, you should be able to wait 3 minutes and reconnect. If that doesn't work, you'll either need to reboot it or use a serial console connection to your Edison to troubleshoot further.
104132

105-
This has been tested with a Samsung Galaxy S7, and a iPhone 6s and has proven reliable for some people - but not all. Further testing is needed. So let it be known if you are able to get this to work or if you have problems.
133+
About a minute after wifi comes back on, your Edison should automatically disconnect the Bluetooth connection.
106134

135+
Finally, it's time to take a walk. About a minute after walking out of range of your wifi, you should see that a device is connected to your phone via Bluetooth. Shortly after that you should see things update on Nightscout. About a minute afer you come home, it should reconnect to wifi and automatically disconnect Bluetooth.

0 commit comments

Comments
 (0)