i’m Watch Accelerometer

I tried to get the part number for the accelerometer from im Watch developer support and they refused to give it to me. The response was you don’t need need that information just use the supplied sensor library. I tried to tell them the library would only collect data at 10 Hz and I require 200 Hz. It also wastes time by always sampling the magnetometer and the accelerometer even if you only need the accelerometer data.

After trying for a few days to get the information from developer support I decided to figure it out for myself.

I wrote a little i2c scanner and enumerated the devices on the bus. I found a device at 0x19 and 0x1e. now to figure out what they are. I disassembled the the sensor library supplied by imdeveleoper.it and found the hex constant 0x19 in the initAccel function. So far so good.

I then stepped up my scanner to read all of the registers from 0 to 127. The first register was at 0x7 and the second was at 0xF and then a bunch more upto 0x2F. I had expected some kind of who am I at 0x0. No such luck. I re-read the registers a few times looking for the changing values. The values at 0x28 to 0x2d changed with the orientation of the device. Good I’ve found the accelerator, but which one ?

I started going through accelerometer datasheets and found that the st micro parts had a who_am_i variable at 0xF. I finally found a match, 0x33 in the LIS3DSH datasheet. The changing values also correspond to the locations of the x, y and z values  so I’m pretty sure I’ve found the correct part. EDIT: i’m Watch support finally got back to me and it is actually the LSM303DLHC. The magnetometer and thermometer are both integrated.

So now I get to re-write the imWatch sensor library. The good news is that the accelerometer has a FIFO, can sample at 5KHz and has a temperature sensor. After I’ve re-written the sensor lib I’m going to see what’s hiding in the magnetometer.

 

i’m Watch Sensors

After almost a year the IMWatch developer site has finally released a library to access the sensors. They even released an example application but no documentation ???

Fortunately there are some tools to decompile java apps.

Below are the prototypes for the two undocumented functions the you’ll need to use to get access to the sensors.

public SensorServiceInstance(int updateInterval)
public SimpleShakeDetector(Context context, OnShakeListener listener, int updateInterval)

The important argument here is the updateInterval. It’s an int but what does it represent. A few tests show it’s the number of milliseconds between samples. Reading the decompiled code implies that this value must be greater than zero but has no other limits.

The application I’m writing needs to have a 200Hz update rate so I tried setting this value to 5 ms. This doesn’t get the required update rate. It seems the practical lower limit to updateInterval is 100ms which doesn’t even match the game update interval for the Android standard sensors updates. 10 Hz isn’t even the lowest rate I can use for my application.

Digging deeper into the sources looks like they have included a native i2c library to access the sensors. I might be able to use that to get direct access and increase the update rate. Stay posted for a blog post on where I get with that.

The full decompile source is available here.

Once again IMWatch has underwhelmed with no documentation and a marginally functional sensor library.  Another release, another fail.