title: How can I use Bluetooth 4.0 LE to detect/measure proximity to a PC (Windows 8.1)?
body: <p>I have a crazy dream that one day I'll be able to way into my rec room and my lighting system will turn on based on my proximity to the seating area. I've played with home automation (SmartThings most recently, the proximity sensor is unreliable and has no way to measure room area proximity), motion sensors, etc... but none of them actually do what I want, and that is detect if I'm in a room for real, not if I'm waving my arms in front of a sensor.</p>
  
  <p>One idea I had was to measure the SNR between WIFI devices. I was thinking of playing around with some wifi survey tools and see what I can measure in my home. The problem I think will be sensitivity and range. Wifi's range is typically intended to try and cover a home, so if I go that route, I'm worried it'll be a waste as I'll only be able to measure when I arrive home, not if I'm in a specific room.</p>
  
  <p>The other approach I'd like to try is Bluetooth 4.0 LE. The Bluetooth GATT specification includes a <a href="https://developer.bluetooth.org/gatt/profiles/Pages/ProfileViewer.aspx?u=org.bluetooth.profile.proximity.xml" rel="nofollow">Proximity Profile</a>, but the problem with profiles is it's something that a Bluetooth enabled device would share with another device it's peered to. e.g. You have a proximity sensor in your pocket and it shares proximity info with a PC or another device.</p>
  
  <p>In my case I'm hoping to try using my iPhone as the marker, and my HTPC as the measuring system. The HTPC can continuously measure the RSSI or SNR of any paired Bluetooth devices without having to actually exchange profile data with the device.</p>
  
  <p>I could do something like write a Windows app/service that registers or watches for a paired Bluetooth device to connect. (such as when I get home and my iPhone auto-pairs with my PC, just like when you get in your car and it pair with your stereo) From there it would measure the SNR as a source of distance information. If the SNR is high enough (least noise, strongest signal) it could automate doing something. I was thinking sending a HTTPS call to my Smartthings hub to turn on my lighting system.</p>
  
  <p>When the SNR drops too low (lower signal strength), it would again send a call to turn off the lighting system.</p>
  
  <p>This method could work with any device that bluetooth pairs. The concept would work with pretty much any platform, not just Windows. Like in a Raspberry Pi with Bluetooth.</p>
  
  <p>Does anyone know if this is possible or am I crazy? I was going to grab the Visual Studio C# 2013 Express IDE when I get home and see what the Windows 8.1 APIs let me get access to.</p>
  
  <p>Also, Bluetooth 4.0 LE should be nicer to use. I was hoping that a heavy, full Bluetooth connection wouldn't be needed as I simply want to detect the device within a small range. (25' of free air)</p>
  
  <p>Thanks.</p>