{"id":1575,"date":"2018-05-15T09:23:50","date_gmt":"2018-05-15T16:23:50","guid":{"rendered":"http:\/\/www.donluc.com\/?p=1575"},"modified":"2018-05-15T09:23:50","modified_gmt":"2018-05-15T16:23:50","slug":"project-6-microview-accelerometer-adxl335-mk06","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=1575","title":{"rendered":"Project #6: MicroView &#8211; Accelerometer ADXL335 &#8211; Mk06"},"content":{"rendered":"<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05b.png\" alt=\"\" width=\"720\" height=\"654\" class=\"alignnone size-full wp-image-1576\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05b-300x273.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05c.png\" alt=\"\" width=\"720\" height=\"449\" class=\"alignnone size-full wp-image-1577\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05c-300x187.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05d.png\" alt=\"\" width=\"720\" height=\"540\" class=\"alignnone size-full wp-image-1578\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05d-300x225.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1575-1\" width=\"720\" height=\"406\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/05\/DonLuc1805Mk05.mp4<\/a><\/video><\/div>\n<p><strong>Accelerometer<\/strong><\/p>\n<p>An accelerometer is a device that measures proper acceleration. Proper acceleration, being the acceleration (or rate of change of velocity) of a body in its own instantaneous rest frame, is not the same as coordinate acceleration, being the acceleration in a fixed coordinate system. For example, an accelerometer at rest on the surface of the Earth will measure an acceleration due to Earth&#8217;s gravity, straight upwards (by definition) of g = 9.81 m\/s2. By contrast, accelerometers in free fall (falling toward the center of the Earth at a rate of about 9.81 m\/s2) will measure zero.<\/p>\n<p><strong>Triple Axis Accelerometer Breakout &#8211; ADXL335<\/strong><\/p>\n<p>Breakout board for the 3 axis ADXL335 from Analog Devices. This is the latest in a long, proven line of analog sensors &#8211; the holy grail of accelerometers. The ADXL335 is a triple axis MEMS accelerometer with extremely low noise and power consumption &#8211; only 320uA! The sensor has a full sensing range of +\/-3g. There is no on-board regulation, provided power should be between 1.8 and 3.6VDC. Board comes fully assembled and tested with external components installed. The included 0.1uF capacitors set the bandwidth of each axis to 50Hz.<\/p>\n<p><strong>DonLuc1805Mk05<\/strong><\/p>\n<p>1 x MicroView<br \/>\n1 x MicroView &#8211; USB Programmer<br \/>\n1 x Accelerometer ADXL335<br \/>\n5 x Jumper Wires 3&#8243; M\/M<br \/>\n1 x Half-Size Breadboard<\/p>\n<p><strong>MicroView<\/strong><\/p>\n<p>Z-Axis &#8211; PIN 07 &#8211; Analog A0<br \/>\nY-Axis &#8211; PIN 06 &#8211; Analog A1<br \/>\nX-Axis &#8211; PIN 05 &#8211; Analog A2<br \/>\nVIN &#8211; PIN 16 &#8211; 3.3V<br \/>\nGND &#8211; PIN 08 &#8211; GND<\/p>\n<p><strong>DonLuc1805Mk05a.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DonLuc1805Mk05a.ino\">\r\n\/\/ ***** Don Luc *****\r\n\/\/ Software Version Information\r\n\/\/ 6.01\r\n\/\/ DonLuc1804Mk06 6.01\r\n\/\/ MicroView\r\n\/\/ Accelerometer ADXL335\r\n\r\n\/\/ include the library code:\r\n#include &lt;MicroView.h&gt;\r\n#include &lt;ADXL335.h&gt;\r\n\r\n\/\/ Accelerometer ADXL335\r\nconst int pin_x = A0;     \/\/ X-Axis\r\nconst int pin_y = A1;     \/\/ Y-Axis\r\nconst int pin_z = A2;     \/\/ Z-Axis\r\nconst int vin = 16;       \/\/ 3.3V\r\nconst int gnd = 8;        \/\/ GND\r\n\r\nADXL335 accel(pin_x, pin_y, pin_z, vin);\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Accelerometer ADXL335\r\n  isADXL335();\r\n\r\n  delay(500);\r\n  \r\n  uView.clear(PAGE);  \/\/ Erase the memory buffer, the OLED will be cleared\r\n  \r\n}\r\n<\/pre>\n<p><strong>getADXL335.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getADXL335.ino\">\r\n\/\/ Accelerometer ADXL335\r\nvoid isADXL335(){\r\n\r\n  \/\/ This is required to update the values\r\n  accel.update();\r\n\r\n  float rho;\r\n  float phi;\r\n  float theta;  \r\n  \r\n  rho = accel.getRho();\r\n  phi = accel.getPhi();\r\n  theta = accel.getTheta();\r\n\r\n  uView.setFontType(0);  \/\/ Set font type 0: Numbers and letters. 10 characters per line (6 lines)\r\n  \r\n  uView.setCursor(0,10); \/\/ X-Axis\r\n  uView.print( &quot;X: &quot; );\r\n  uView.print( rho );\r\n\r\n  uView.setCursor(0,20); \/\/ Y-Axis\r\n  uView.print( &quot;Y: &quot; );\r\n  uView.print( phi );\r\n\r\n  uView.setCursor(0,30); \/\/ Z-Axis\r\n  uView.print( &quot;Z: &quot; );\r\n  uView.print( theta );\r\n     \r\n  uView.display();       \/\/ Display\r\n  \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"setup.ino\">\r\nvoid setup() {\r\n\r\n  uView.begin();           \/\/ Begin of MicroView\r\n  uView.clear(ALL);        \/\/ Erase hardware memory inside the OLED controller\r\n  uView.display();         \/\/ Display the content in the buffer memory, by default it is the MicroView logo\r\n  \r\n  delay(1000);\r\n  \r\n  uView.clear(PAGE);       \/\/ Erase the memory buffer, the OLED will be cleared.\r\n   \r\n  uView.setFontType(1);    \/\/ Set font type 1: Numbers and letters. 7 characters per line (3 lines)\r\n  uView.setCursor(0,20);\r\n  uView.print(&quot;Don Luc&quot;);  \/\/ Don Luc\r\n  uView.display();         \/\/ Display\r\n  \r\n  delay(5000);\r\n\r\n  uView.clear(PAGE);       \/\/ Erase the memory buffer, the OLED will be cleared.\r\n\r\n  uView.setFontType(1);    \/\/ Set font type 1: Numbers and letters. 7 characters per line (3 lines)\r\n  uView.setCursor(0,20);\r\n  uView.print(&quot;ADXL335&quot;);  \/\/ ADXL335\r\n  uView.display();         \/\/ Display\r\n  \r\n  delay(5000);\r\n  \r\n  uView.clear(PAGE);       \/\/ Erase the memory buffer, the OLED will be cleared\r\n \r\n  \/\/ Accelerometer ADXL335\r\n  pinMode(gnd, OUTPUT);    \/\/ GND\r\n  pinMode(vin, OUTPUT);    \/\/ 3.3V\r\n  digitalWrite(gnd, LOW);\r\n  digitalWrite(vin, HIGH);\r\n  \r\n}\r\n<\/pre>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Accelerometer An accelerometer is a device that measures proper acceleration. Proper acceleration, being the acceleration (or rate of change of velocity) of a body in its own instantaneous rest frame, is not the same as coordinate acceleration, being the acceleration in a fixed coordinate system. For example, an accelerometer at rest on the surface of &#8230; <a title=\"Project #6: MicroView &#8211; Accelerometer ADXL335 &#8211; Mk06\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=1575\" aria-label=\"Read more about Project #6: MicroView &#8211; Accelerometer ADXL335 &#8211; Mk06\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70,50,38,59,5,58,10,43],"tags":[],"class_list":["post-1575","post","type-post","status-publish","format-standard","hentry","category-microview","category-arduino","category-digitalelectronics","category-fritzing","category-microcontrollers","category-arduino-programming","category-projects","category-sparkfun"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1575"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1575\/revisions"}],"predecessor-version":[{"id":1581,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1575\/revisions\/1581"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}