You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/walkthrough/phase-4/bluetooth-tethering-edison.md
+45-16Lines changed: 45 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,8 @@ power on
44
44
45
45
discoverable on
46
46
47
+
scan on
48
+
47
49
agent on
48
50
49
51
default-agent
@@ -55,7 +57,7 @@ The adapter is now discoverable for three minutes. Search for bluetooth devices
55
57
56
58
For iPhone
57
59
********************************
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:
59
61
```
60
62
pair AA:BB:CC:DD:EE:FF
61
63
```
@@ -67,9 +69,7 @@ you will see on the edison
67
69
68
70
You must type in **yes** not just **y** to pair
69
71
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.
73
73
74
74
Execute the paired-devices command to list the paired devices -
75
75
@@ -78,7 +78,7 @@ paired-devices
78
78
Device AA:BB:CC:DD:EE:FF Samsung S7
79
79
```
80
80
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).
82
82
83
83
Now trust the mobile device
84
84
@@ -87,20 +87,49 @@ Now trust the mobile device
87
87
Quit bluetoothctl with 'quit'.
88
88
89
89
******************************
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)
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
+
98
117
```
99
-
sudo bt-pan client AA:BB:CC:DD:EE:FF
118
+
bnep0 Link encap:Ethernet HWaddr 98:4f:ee:03:a6:91
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:
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.
104
132
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.
106
134
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