{"id":65,"date":"2013-02-21T15:32:50","date_gmt":"2013-02-21T22:32:50","guid":{"rendered":"http:\/\/ainslies.net\/?p=65"},"modified":"2013-02-28T17:24:21","modified_gmt":"2013-03-01T00:24:21","slug":"im-watch-accelerometer","status":"publish","type":"post","link":"https:\/\/ainslies.net\/?p=65","title":{"rendered":"i&#8217;m Watch Accelerometer"},"content":{"rendered":"<p>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&#8217;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.<\/p>\n<p>After trying for a few days to get the information from developer support I decided to figure it out for myself.<\/p>\n<p>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.<\/p>\n<p>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&#8217;ve found the accelerator, but which one ?<\/p>\n<p>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 <a href=\"http:\/\/www.st.com\/st-web-ui\/static\/active\/en\/resource\/technical\/document\/datasheet\/DM00040962.pdf\">LIS3DSH<\/a> datasheet. The changing values also correspond to the locations of the x, y and z values \u00a0so I&#8217;m pretty sure I&#8217;ve found the correct part.\u00a0EDIT: i&#8217;m Watch support finally got back to me and it is actually the\u00a0<a href=\"http:\/\/www.st.com\/st-web-ui\/static\/active\/en\/resource\/technical\/document\/datasheet\/DM00027543.pdf\">LSM303DLHC<\/a>. The magnetometer and thermometer are both integrated.<\/p>\n<p>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&#8217;ve re-written the sensor lib I&#8217;m going to see what&#8217;s hiding in the magnetometer.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;t need need that information just use the supplied sensor library. I tried &hellip; <a href=\"https:\/\/ainslies.net\/?p=65\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-android-devices","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65"}],"version-history":[{"count":8,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/65\/revisions\/71"}],"wp:attachment":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}