<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Busy hands | Disquiet mind</title>
  <link>https://chebe.dreamwidth.org/</link>
  <description>Busy hands | Disquiet mind - Dreamwidth Studios</description>
  <lastBuildDate>Wed, 19 Mar 2025 12:36:48 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>chebe</lj:journal>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/12863143/105601</url>
    <title>Busy hands | Disquiet mind</title>
    <link>https://chebe.dreamwidth.org/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>https://chebe.dreamwidth.org/160808.html</guid>
  <pubDate>Wed, 19 Mar 2025 12:36:48 GMT</pubDate>
  <title>MPU-6050 Arduino libraries code archaeology</title>
  <link>https://chebe.dreamwidth.org/160808.html</link>
  <description>Compare and contrast getting normalized accelerometer values, where the raw value is -13248.00. (A.k.a. Please, make it make sense.)&lt;br /&gt;&lt;br /&gt;Library 1; jarzebski&apos;s Arduino-MPU6050 - &lt;a href=&quot;https://github.com/jarzebski/Arduino-MPU6050/&quot;&gt;https://github.com/jarzebski/Arduino-MPU6050/&lt;/a&gt;&lt;br /&gt;Library 2; Adafruit&apos;s Adafruit_MPU6050 - &lt;a href=&quot;https://github.com/adafruit/Adafruit_MPU6050&quot;&gt;https://github.com/adafruit/Adafruit_MPU6050&lt;/a&gt;&lt;br /&gt;Library 3; i2cdevlib/ElectronicCats&apos; mpu6050 - &lt;a href=&quot;https://github.com/ElectronicCats/mpu6050&quot;&gt;https://github.com/ElectronicCats/mpu6050&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Library 1;&lt;/h3&gt;&lt;br /&gt;&lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___1&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://chebe.dreamwidth.org/160808.html#cutid1&quot;&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___1&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Formula for normalized acceleration value at MPU6050_RANGE_2G;&lt;br /&gt;raw * rangePerDigit  * gravityConst&lt;br /&gt;(raw * (1.0/16384)) * gravityConst&lt;br /&gt;== (raw / 16384) * gravityConst&lt;br /&gt;(-13248.00 * .000061) * 9.80665 = -7.92502845&lt;br /&gt;== (-13248.00 / 16384) * 9.80665 = -7.92959589&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Library 2;&lt;/h3&gt;&lt;br /&gt;&lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___2&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://chebe.dreamwidth.org/160808.html#cutid2&quot;&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___2&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Formula for normalized acceleration value at MPU6050_RANGE_2_G;&lt;br /&gt;(raw / accel_scale) * gravityConst&lt;br /&gt;(-13248.00 / 16384) * 9.80665 = -7.92959589&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Library 3;&lt;/h3&gt;&lt;br /&gt;&lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___3&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://chebe.dreamwidth.org/160808.html#cutid3&quot;&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___3&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;No normalized functions in MPU6050.cpp. Can use MotionApps files, but they go through Quaternions.&lt;br /&gt;&lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___4&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://chebe.dreamwidth.org/160808.html#cutid4&quot;&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___4&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Formula for normalized acceleration value at MPU6050_ACCEL_FS_2;&lt;br /&gt;// jarzebski way;&lt;br /&gt;raw * accelerationResolution * gravityConst&lt;br /&gt;-13248.00 * 0.000122 * 9.80665 = -15.850057&lt;br /&gt;&lt;br /&gt;// adafruit way;&lt;br /&gt;// (raw * (1.0/16384)) * gravityConst&lt;br /&gt;// (raw * (2.0/16384)) * gravityConst&lt;br /&gt;(-13248.00 / (2.0*16384)) * 9.80665 = -15.85919&lt;br /&gt;((-13248.00*2.0) / 16384) * 9.80665 = -15.85919&lt;br /&gt;&lt;br /&gt;Result is twice that of the others. &lt;code&gt;accelerationResolution&lt;/code&gt; itself seems to be twice the others, so half it? Not sure if this is a mistake, or I&apos;m missing something about MPU6050_ACCEL_FS_2 vs MPU6050_RANGE_2_G.&lt;br /&gt;raw * (accelerationResolution/2) * gravityConst&lt;br /&gt;-13248.00 * (accelerationResolution/2) * 9.80665 = -7.9250&lt;br /&gt;&lt;br /&gt;&lt;code&gt;accelerationResolution&lt;/code&gt; and &lt;code&gt;get_acce_resolution()&lt;/code&gt; only exist in the ElectronicCats version, they&apos;re not accessible in the &lt;a href=&quot;https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050&quot;&gt;i2cdevlibs&lt;/a&gt; version. That version seems to &lt;strong&gt;really&lt;/strong&gt; want you to use the Quaternion path. But you can always use the range values from the other versions yourself on the raw values.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=chebe&amp;ditemid=160808&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://chebe.dreamwidth.org/160808.html</comments>
  <category>accelerometer</category>
  <category>maths</category>
  <category>code</category>
  <category>arduino</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
</channel>
</rss>
