|Documentation :||Hardware | Software | Tutorials||Wardrobe :||Jackets | Applications|
|Papers :||Notes | Proposals | Research||Administration :||Stock | Minutes | Progress|
The accelerometer interface board has been designed to act as an intelligent sensor in relation to the event driven device architecture of the new cyber-jacket. The device incorporates an ADXL202-JQC dual-axis accelerometer chip by Analog Devices which is interfaced to a PIC16F84 chip that decodes its output and communicates with the host computer via a shared TTL channel on the system bus.
At present the accelerometer chip gives DCM (Duty Cycle Modulated) output at a rate of 2 KHz (T = 0.5 ms). This can be altered by changing the value of the resistor RSET (currently = 62.5K, please see data-sheet for alternative values).
The device communicates with the host using a pseudo RS-232 protocol (TTL) on the system bus. Since the device has been designed to operate in conjunction with other sensors on the shared bus, contention issues are partially solved through the use of a status line on the system bus (wire 1). When a device wishes to send data it first checks this status line, if it is high (idle state) then it pulls the line low and transmits otherwise it polls the status line until it becomes high.
The firmware on the accelerometer's PIC is currently quite basic, it accepts requests from the host in the form:
where "$S" is a 'send data request' from the host to a device;
"A" represents the major device identifier i.e. A = Accelerometer, G = GPS etc.
"X" represents the minor device identifer [1..4].
"P" represents the type of request / command, in the case of the accelerometer and GPS devices, "P" commands the device to give its 'present' status / value.
The accelerometer's PIC will then sample the ADXL202 chip and return a string of the form:
where "$R" is the 'reply' specifier;
"A" is the major device identifier;
"Z" represents the minor device identifer [1..4].
"X" is an unsigned byte that proportionally represents the acceleration in the x-axis (further computation required);
"Y" is an unsigned byte that proportionally represents the acceleration in the y-axis (further computation required);
"T" is an unsigned byte that proportionally indicates the clock duration of the DCM output from the ADXL chip and is required for subsequent calculations as follows:
x-axis acceleration (Ax) = ( ( ( X / T ) - 0.5 ) / 0.125 )
Pitch = ( sin-1( Ax ) * 180.0 / PI )
y-axis acceleration (Ay) = ( ( ( Y / T ) - 0.5 ) / 0.125 )
Roll = ( sin-1( Ay) * 180.0 / PI )
These calculations can be found in C-code here.
There is currently no filtering in the accelerometers PIC code but this is just a software tweak that can be performed later! It is intended that the device will receive filter masks from the host and then continually analyse the ADXL data stream until the data conforms to the mask at which point it will automatically notify the host and hence conforms to the proposed event driven architecture.
Please refer to schematic above.
The device has been calibrated in firmware using hard-coded offset values. Please refer to PIC code for alterations.
ASM Code for PIC
The latest firmware for the accelerometer's PIC can be found here; This must be compiled using MPLAB (installed on Prawn).
C Code for Demo Application
This is a quick demo application that I knocked together to send requests to the accelerometer device and interpret its replies. It has been developed for the Linux / Unix platform (i.e. /dev/ttySx) and can be downloaded here >> don't forget to link with the maths library (-lm).