Hi Gabriele,
Concerning the shift in values, can you elaborate a little on your experiment setup, and the results you obtained? The manner you are reading the byte one at a time till you detect a full packet, would be a correct approach. We use the same approach in our provided Shimmer Android Instrument Driver which can be found here http://www.shimmer-research.com/download/softwares. Best regards, JC _____ From: [email protected] [mailto:[email protected]] On Behalf Of Gabriele Spina Sent: 10 October 2012 14:23 To: [email protected] Cc: Frank Roberts Subject: [Shimmer-users] Shimmer + Android (Blue tooth) Dear all, I have written some code in Java for Android as part of a larger framework that can read streaming Shimmer data over Bluetooth. To test it's accuracy we connected two Shimmer devices, one that streams over Bluetooth and another that stores data on the Shimmer itself. When we compared results there appears to be a slight shift in the values (I only tested with accelerometer data). I would like to know if there is an explanation for this besides sensor displacement. Another question I had relates to the sampling rates of the sensors and the transmission rate of the Bluetooth radio. When I sample the sensors at 250 Hz will I then also receive the packets at this frequency? I read one byte at a time from the Bluetooth socket and when I have received a full packet I decode it as follows: public float[] decodeSensorData(byte[] data, int size) { float[] values = new float[(mNumChannels+1)]; if (data[0] == PACKET_START) { for (int j = 0, k = 0; j < mNumChannels; j++, k += 2) { values[j] = getChannel(data[4+k], data[3+k]); } values[mNumChannels] = getChannel(data[2], data[1]); return values; } else { Log.d("Shimmer", "Package error"); return null; } } private float getChannel(byte high, byte low) { float temp = 0; temp = (short)(high << 8) | (low & 0xFF); if (((short)temp & 0x8000) > 0) { temp = (long)temp & 0xFFFF; } return temp; } I then send the data to native library for further processing. I would like to thank you in advance, Gabriele
_______________________________________________ Shimmer-users mailing list [email protected] https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users
