I spent about 10 hours figuring out how to do this and put together a simple 30 second guide to setting up an iBeacon (which runs automatically on boot) on Raspberry Pi (although this should work for other Linux systems as well)
Here goes:
nano /etc/init.d/ibeacon
Paste the contents of this:
Code: Select all
#!/bin/bash
### BEGIN INIT INFO
# Provides: ibeacon
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 5
# Default-Stop:
# Description: ibeacon
### END INIT INFO
case "$1" in
'start')
bluetoothadapter="hci0"
ogf="0x08"
ocf="0x0008"
ibeaconprefix="1e 02 01 1a 1a ff 4c 00 02 15"
uuid="5A 4B CF CE 17 4E 4B AC A8 14 09 2E 77 F6 B7 E5"
major="00 08"
minor="00 05"
power="C8 00"
/bin/echo "Starting iBeacon..."
sleep 5
/bin/hciconfig "$bluetoothadapter" up
/bin/hciconfig "$bluetoothadapter" noleadv
/bin/hciconfig "$bluetoothadapter" noscan
/bin/hciconfig "$bluetoothadapter" pscan
/bin/hciconfig "$bluetoothadapter" leadv 3
/usr/bin/hcitool -i "$bluetoothadapter" cmd $ogf $ocf $ibeaconprefix $uuid $major $minor $power
;;
'stop')
/bin/echo "Stopping iBeacon..."
/bin/hciconfig "$bluetoothadapter" noleadv
/bin/hciconfig "$bluetoothadapter" down
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
chmod 755 /etc/init.d/ibeacon
update-rc.d ibeacon defaults
Reboot the Raspberry Pi and you should have a broadcasting iBeacon within about 30 seconds of it booting up.
I use an iPhone app called Dartle to see if its broadcasting.
iPhone app Pilot for Domoticz can make use of iBeacons.
Please note that changing the UUID in my experience seems to result in the iPhone not detecting the iBeacon, only certain UUID's appear to be accepted. To make it unique you can change the minor and major numbers.
