BlueTooth Accelerometer (SparkFun)

From OpenCircuits
Jump to navigation Jump to search

Purchase
Sparkfun WiTilt v2

Specs:
Requires 4 AAA's (or other battery configurations). Seems to be sensitive to 20-30 ft. You can log in to the accelerometer and adjust its properties, such as timing, axis, output format, (includes binary) and calibration.


How to use it (Mac OS X):
To interface with the object on Mac OS X, go to System Preferences, then Bluetooth, and Set up a New Device. Turn on power to the accelerometer and hit the hardware reset button. Follow the set up wizard, name the device (remember the name) but don't do the key-pair exchange, just leave it unsecured. Specify it as a serial device in the wizard. Once the device is added (shows up as BlueRadios in the menu), open a terminal window. cd to /dev/ and you should see a device with the name of the bluetooth device you just created. Then do 'cat /dev/MyBTAccelerometer' and turn the hardware switch to on (if not already on). Now hit the reset button. You should see a menu spit out to the console. To talk to the device, just open another terminal window and do something like 'cat 1 > /dev/MyBTAcceleromter' if 1 is the option from the menu you're choosing.


How to use it (Java):
You can just open a buffered reader/writer to the device and treat it like any other input/output object.


Notes:

  • You can hit the hardware 'reset' any time to have the menu return. Your previously saved settings are not affected.
  • If your software program does not read from the device at a rate that is equal to or higher than the rate the device is outputting, it will get backed up. Basically you'll get readings from time that has already past, as you need keep up with the output frequency.
  • If your device gets backed up: hit reset, then cat the device. You will see previous readings output for a bit then the new menu will show up.
  • If you interface with the device using cat, be careful to turn off the accelerometer before hitting ^C to end the 'cat /dev/MyBTAccelerometer' as it can lock up access to device.