by Pinky Magbanua
The WiTilt v2.5 is a 2.4GHz Wireless 3-axis Tilt Sensor from Sparkfun. It employs a FreeScale MMA7260Q triple-axis accelerometer and a class 1 Bluetooth link from BlueRadios. The particular unit that I got is an RP-SMA version, which has a female connector for an RP-SMA antenna. This unit costs $99.95. It may be a good enough value considering the plug-and-play nature of this board. Pros and Cons will be discussed later in the report.
The Triple Axis Accelerometer
Here is a link to Tom Igoe's original sensor report summary.
This is a surface mount integrated circuit accelerometer that runs on low voltage (2.2V - 3.6V). It measures a change in capacitance through 2 g-cell beams that serve as back to back capacitors reacting to a movable beam located in between them. The illustration below demonstrates this mechanism.
This change in capacitance is then converted into voltage outputs which reflect movement changes along the X, Y, Z axes. This accelerometer also features a 4-level sensitivity scale (1.5g, 2g, 4g, 6g), with 1.5g setting being the most sensitive. It measures both (+) and (-) acceleration. It has 16 pins, only 8 of which are connected with functions.
The Bluetooth module
The bluetooth module included in the sparkfun board is a BlueRadios serial radio modem with an RP-SMA antenna reverse female connector for external antenna options to increase transmission range. Sparkfun does not specify exactly which BlueRadio bluetooth model they used in this breakout board. Although on the package, it reads C30 AH. Assuming that most, if not all, BlueRadios bluetooth modules have the same setup / pin connections, see above for datasheet.
It allows for long distance communication due to its high sensitivity, UART, and PCM interfaces available to various applications. It runs on a 3.3V power supply, with an operating temperature range is at - 40~+70°C . Without an antenna, it operates through a +200 meter (660 feet) distance, with software adjustable transmitter power.
The WiTilt v2.5, with RP-SMA
As mentioned above, this is Sparkfun's 'plug-and-play' version of a wireless accelerometer. Aside from Freescale's triple axis accelerometer and BlueRadios' bluetooth module, the board also contains a PIC 16LF88-SSOP. The hardware layout is as follows:
WiTilt Hardware Layout
1. Power Switch
2. Debug / RF switch - switches PIC UART between bluetooth and hardline serial connections.
3. Debug Header
4. uC reset button
5. Power connector (4 to 6 V)
6. Status LED
7. Bluetooth connection indicator LED
8. Bluetooth pulse, mode indicator LED
9. Reverse-polarized SMA antenna connector
This whole circuit has been pre-programmed for output values to be read quite easily with the use of Terminal or Zterm in MAC, or hyperterm in PC. The WiTilt comes with an inherent configuration menu which allows you to control data flow with the Bluetooth interface. As soon as bluetooth connection is established, the following menu comes up:
WiTilt Configuration Menu
Working with the menu is a pretty straightforward experience. Each option gives you specific instructions to manipulate the setup.
NOTES ON STARTING BLUETOOTH CONNECTION WITH WITILT
During my interlude with this device, I realized that a degree of problem solving needs to be done. It is not as simple as opening terminal and, 'voila,' you have connection. These are the steps that I religiously follow to get connected quickly (Not fail-proof, though):
1. In MAC OSX 10.4, setup bluetooth connection (passkey input involved). Remember that in 10.3, the bluetooth setup interface is different as it doesn't allow you passkey options. OSX 10.3 only accepts numerical passkey input. Therefore, you can not type 'default' as passkey, unlike in 10.4. If you have 10.3, you will need to find someone with 10.4 just to get through. Then, in Terminal, manipulate the 'passkey' (turn it into numbers) using the AT command setup. Refer to BlueRAdios AT Command datasheet.
2. For preliminary testing, I suggest using Terminal or Zterm in MAC. I hadn't tried opening this from a PC, but I think there shouldn't be any problem (?) using this with Hyperterm.
2. Before opening Terminal, make sure that no other program (Processing or MAX) is open. Turn ON WiTilt.
3. Open Terminal. Type the following command: ls /dev/tty.* -- This should show you which serial ports are available.
4. Then, 'screen' the bluetooth port, using the following command: screen /dev/tty.BlueRadios-COM0-1 9600 where '9600' is the baud rate.
5. You should then see the configurate menu above.
6. To disconnect from Terminal, use: 'Command' + 'a', followed by 'Command' + '\'
7. If you have any problems establishing connection, I suggest the following steps in order of execution: disconnect bluetooth, restart computer, delete bluetooth pairing from the setup, re-establish pairing, then re-open Terminal and, finally, try reconnecting.
WORKING WITH MAX/MSP
A. Reading the WiTilt Values
- In case you are wondering why I am not using processing, it is because I simply can not get the WiTilt to connect with Processing. Reason: Beats me. I have done various computer restarts, Witilt resets, Witilt-MAC re-'pairing,' but with no positive results.
Using the WiTilt to work with MAX/MSP is not an easy task, either. First of all, the output coming from the WiTilt is in ASCII. MAX serial, by default, presents each incoming byte as a single value, so it comes out one byte at a time in a LINEFEED fashion,
Instead of, 'Z=587.' This is because of how the WiTilt was programmed by the wise guys. Now, if you were to build your own circuit, you could program the PIC chip differently: serout2...[adcVar], instead of serout2...[DEC adcVar]. Then, I assume, the values would be more readable in MAX.
- To reprogram the PIC chip on the WiTilt, you will need to spend extra bucks to purchase the Adapter Board for SFE ICSP connections. I have not tried to this just yet.
Going back to using WiTilt with MAX, I am still in the process of tweaking my own patch that will straighten out the linefed values, put them together horizontally and finally reading them as numerical values instead of 'characters.' Meanwhile, Woon Seung Yeo from Stanford has figured this out, by creating W2O to configure the WiTilt to work with a group of MAX objects called , 'Open Sound Control' created by Chandrasekhar "Sekhar" Ramakrishnan. This system is what I am currently using in MAX to move forward with this project.
B. Using MAX to view the Sensor's Behavior Over Time
Using the multislider object, I was able to graph the sensor's value changes over Time.
MAX Graph. The Weighted averaging formula is based on Tom Igoe's Code.
The MAX patch I created to produce the 'averaged' graph includes a code that calculates the average of every 10 bytes received. It also analyzes the difference between current and previous value and smoothens the average by adding a 'weight' factor. I think this may have been an overkill averaging scheme as it produced somewhat 'choppy' values. However, the averaging still helps in trimming down data and makes the values easier to work with.
MY O.T. APPLICATION
THE EVALUATION TOOL
Concept: A Standardized Assessment of the Quality of Upper Extremity Movement Post-Stroke
The Device: An arm sleeve containing a battery-operated WiTilt linked to a MAX patch displaying visual and auditory interpretation of movement.
What It Measures: This tool is designed to produce visual and auditory feedback to changes in shoulder and elbow acceleration.
Why Create the Tool? Range of motion is vital part of clinical assessment. However, despite having a good degree of movement range, the extremity may achieve the range with inferior quality of movement. In kinesthetics, the skill of movement control is determined by the ability to move 'slowly' throughout the range, or the ability to 'stop' movement at midrange. By measuring acceleration, this device will, therefore, reflect quality of movement.