Introduction: Raspberry Pi Bluetooth In/Out Board or "Who's Home"
I wanted to create an electronic In/Out Board. The type you may have to record who is present or not in a company or home. It is usually placed by the front entrance so anyone can see who is in or out.
I also wanted another project for my Raspberry Pi, so that is why I am using it, but it makes a really good lower power choice of computer to drive this application. There are many extensions to this basic instructable, because of the Pi, like run a web server to show who is in and out via a web page, or run a local LCD display.
There is one major assumption here, that everyone carries a mobile phone and they are willing to keep bluetooth on (is that two assumptions? :-/). Their bluetooth must be on but it is NOT necessary to be 'discoverable' for this to work. Each person must only make there device discoverable for a short time so you can determine their bluetooth address. Once that is found, this device will just query the presence of that known bluetooth device.
I call it my "Who's Home" device.
Step 1: Raspberry Pi Setup
Let's get started.
You will need:
A Raspberry Pi computer, I tested with the 512 MB model, with internet connection.
An SD card loaded with the latest Raspbian “wheezy” software. See http://www.raspberrypi.org/downloads for how to get that setup.
A supported bluetooth USB dongle. See http://elinux.org/RPi_VerifiedPeripherals#USB_Bluetooth_adapters
Some way to access a terminal on the Pi. I used ssh, or just use the normal desktop and open Terminal.
Step 2: Install Bluetooth Software
At the terminal type the command
sudo apt-get install bluez
this will take a little while to install the bluetooth drivers and software.
Also needed is the the pybluez interface from Python to bluetooth.
sudo apt-get install python-bluez
If you have not already, insert your bluetooth dongle into a USB port on the pi.
At the terminal you can use hcitool to check your device, e.g. type
Step 3: Get Bluetooth Device Addresses
You can use the inquiry.py script from the pybluez website to query the nearby discoverable devices.
At the pi terminal:
You will need the long address, numbers separated by :'s for the next step.
Step 4: Run the Basic In/Out Board
You can get my basic In/Out Board python script using this command:
Insert your device addresses and person names into the script. Repeat the 'if' block for each person.
Run it with:
Note that the devices no longer need to be discoverable for bluetooth.lookup_name to work.
Play and make it better!
We have a be nice policy.
Please be positive and constructive.