What is it?
Use a USB Bluetooth dongle to set up Bluetooth capabilities on the Raspberry Pi, scan for devices, send files or messages and check who is in the building. Not all dongles work and this is the first hurdle, check that you have a compatible one at this site. I tried the setup and it originally didn't work, may be that my power supply was not high enough to power the keyboard, mouse, and the Bluetooth. In the end I flashed a fresh copy of the OS 'Wheezy' onto a new SD card and also used a remote desktop connection to the Pi. Success!
1. Getting Set up
Load the LX Terminal:
sudo apt-get update
sudo apt-get upgrade
Then install the modules for the hardware and Python Libraries:
sudo apt-get install bluez
sudo apt-get install python-bluez
At this point I would insert your Bluetooth Dongle and restart the Raspberry Pi with sudo reboot. When reloaded you can then check that the Dongle has been recognised. You can use lsusb to see if it is plugged into the USB and hcitool dev to identify the dongle and return its address.
2. Finding Devices
Turn on the Bluetooth on another device, or phone, laptop, iPad etc and ensure that it is in discovery mode.
This simple Python code will look for available Bluetooth devices and return the address of the device. This can be used later to send communication and create some useful hacks.
print("Searching for device...")
nearby_devices = bluetooth.discover_devices(lookup_names = True)
print("found %d devices" % len(nearby_devices))
for addr, name in nearby_devices:
print(" %s - %s" % (addr, name))
3. Discover a List of Bluetooth Services
Once you have found the MAC address of the device you can then scan the device to see what Bluetooth services are available, such as Audio Gateway, SMS access or Phone book access. This is a temperamental process and I found different devices had various properties and would not work in sleep mode or needed to connect first. The program does return a list of protocols, the name of the service, the service class and most importantly the port number that the service is available on.
from bluetooth import *
device_address = "68:58:78:3A:BB:7F" # enter address of device
#finds a list of MAC addresses for devices
devices = bluetooth.discover_devices()
for mac in devices:
#find services on the phone
services = find_service(address=device_address)
for i in services:
print i, '\n'
- Raspberry Pi
- Hologram Machine
- Google Vision: Camera Tell
- Yoda Tweets
- Pi Phone
- Darth Beats
- Twitter Keyword Finder
- Crimbo Lights Hack
- Xmas Elf
- Halloween 2016
- Halloween Hack 2015
- Socrative Zombie
- Voice Translation
- The Blue-Who Finder
- GPIO, Twitter
- Pi Chat Bot >
- PiGlow & Email
- Pibrella Alarm System
- SMS with Python >
- Contact Me