Wired Living

Sunday, 15 April 2007

Bluetooth Proximity Prototype - XPL Application

With the success of the USBMicro Switch/PIR prototype - I thought I'd have a crack at also building an XPL Bluetooth proximity application. One which simply fires off triggers for any bluetooth device found in the area.

It's obviously a good way to work out who's at home, especially if it's mashed up with PIR detection - so thought it would be a good little experiment which I could also definately build into my HA project.

Being an old VB6 guy - I went on a google search mission to find an active-x object to do all the hard work. I already had a USB dongle I bought a year or so ago (another eBay cheapy)

I found a control built for transferring files over bluetooth called ActiveBlue2 - which unlike others, also allows visibility of unknown (unpaired) devices. There's a shareware version available which times out - but doesn't look like a trial key is required if you're simply searching for devices! Just means I can't actually release this app - so may have to look at alternatives so I can share the app/code (As the object license fee is around AU$300!). Feel free to drop me a line if you know of any free alternatives I can use (Active-X)


Anyway - It didn't take too long to build a quick app as a test which:
  • stores a list of visible devices in memory (simply used a list control)
  • polls the visible device list every 10 seconds and adds any new devices it finds to the list
  • removes devices that are no longer in range
  • fires off a xpl trigger message (used sensor.basic - device:input) for any new or removed item.

Works great! Only problem is my phone needs to be left in discoverable mode - which isn't ideal - as paired devices always show up as connected - even if they're not in range.

A possible workaround is to look at the last connected time and build in some configureable timeout functionality into the application. I'll get back to this if there's any interest (once I've finished the USBMicro XPL project)

Labels: , ,

Saturday, 14 April 2007

USBMicro - XPL Application (Input)

After a visit to the local Electronics store to pick up some bits and pieces (been a very long while since I've touched a soldering iron!) I setup a basic circuit to wire a switch & a PIR (a cheapo eBay purchase too!) to the USBMicro board.


I used XPL VB6 Framework demo app - and mashed it with the demo USBMicro input app - and before I knew it - I had it broadcasting status changes over my network!

The current app works by polling the device every 500ms and if any changes are detected, sends the status for all ports on the device.

Other functions to add:
  • Add code to only send status updates on the changed input - to reduce noise.
  • Stick in some checks (like to make sure the USBMicro device is attached first would be useful! :) - and perhaps re-check periodically
  • Allow the ability to set friendly names of each port in XPLHal (instead of device0>device16).
  • Respond to status requests (so XPLHal can get initial status on startup)

Since this USBMicro also supports reading of 1-wire sensors, I may have a crack at wiring one up to this too - so I don't need to use the temperature sensor kit and obviously build the functionality into the XPL app as well.

May also find some other useful applications for this. I'm open to any suggestions on ways of utilising this device too - so drop me a comment on here if you come up with any.

USBMicro's Capabilities:

  • 16 Digital inputs (ie. this project)
  • 16 Digital Outputs (could use to control relays)
  • Interface to SPI Devices
  • Interface LCD Controllers
  • Stepper Motor Control
  • 1 Wire Sensors (temprature)

Anyway, all I can say is I really enjoyed getting this up and running! Was a good mashup of electronics & coding - which I haven't done either of for quite a while. It has gotten me thinking about other devices I have around that I can integrate into my XPL network. Perhaps something with bluetooth....

Labels: , ,