Difference between revisions of "BluetoothLE WiFi and Raspian"

From csn
Jump to navigation Jump to search
Line 1: Line 1:
In this first activity we will show you how you can craft a Bluetooth LE beacon using the Raspberry Pi.
+
In this first activity, we will show you how you can craft a Bluetooth LE beacon using the Raspberry Pi.
  
 
Start by logging into your Raspberry Pi and then check that Bluez is installed:
 
Start by logging into your Raspberry Pi and then check that Bluez is installed:
  
 
  sudo apt install bluez
 
  sudo apt install bluez
 
  
 
We are going to use the Raspberry Pi to transmit an Eddystone beacon.  
 
We are going to use the Raspberry Pi to transmit an Eddystone beacon.  
Line 43: Line 42:
  
 
Also note that ".com/" is actually encoded as "00"
 
Also note that ".com/" is actually encoded as "00"
 +
 +
=== Scanning Bluetooth Le ===
 +
 +
Use Bluetooth Low Energy to scan the environment around you with:
 +
 +
hcitool -i hci0 lescan

Revision as of 06:56, 21 May 2020

In this first activity, we will show you how you can craft a Bluetooth LE beacon using the Raspberry Pi.

Start by logging into your Raspberry Pi and then check that Bluez is installed:

sudo apt install bluez

We are going to use the Raspberry Pi to transmit an Eddystone beacon.

Lets look at the available commands:

hciconfig -h

Lets bring up the Bluetooth device on our Raspberry Pi using below command:

sudo hciconfig hci0 up

Then, lets set the Bluetooth interface to advertise but not be connectable:

sudo hciconfig hci0 leadv 3

Now we will construct and send the Bluetooth LE beacon:

sudo hcitool -i hci0 cmd 0x08 0x0008 1c 02 01 06 03 03 aa fe 14 16 aa fe 10 00 03 6D 75 72 64 6F 63 68 2E 65 64 75 2E 61 75 00 00 00

This will create a Bluetooth low energy beacon that points to murdoch.edu.au

We will read this BTLE becon on our smartphone. Download and open the Bluetooth app linked to below based on your phone:

Pickup the Eddystone beacon and visit the URL.

Challenge

Go here https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html and then reverse engineer the string above. You know it points to murdoch.edu.au. Can you change the hcitool string to point to your own site, or your favourite website?

Can you point it to Little Salmon Bay on Rotnest (https://www.google.com/maps/place/Little+Salmon+Bay/@-32.0333166,115.5377011,14.65z/data=!4m5!3m4!1s0x2a2d5a5442996ffd:0x9032cfa0949b90f8!8m2!3d-32.0246369!4d115.5250543)

The maximum characters that can be transmitted are 16, so you will want to look at a URL shortener like:

*https://tinyurl.com/

Also note that ".com/" is actually encoded as "00"

Scanning Bluetooth Le

Use Bluetooth Low Energy to scan the environment around you with:

hcitool -i hci0 lescan