{"id":3848,"date":"2024-02-23T07:32:52","date_gmt":"2024-02-23T15:32:52","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3848"},"modified":"2024-02-23T07:32:52","modified_gmt":"2024-02-23T15:32:52","slug":"project-28-sensors-mma7361-mk14","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3848","title":{"rendered":"Project #28 &#8211; Sensors &#8211; MMA7361 &#8211; Mk14"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3848-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Sensors #MMA7361 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04a.png\" alt=\"MMA7361\" width=\"720\" height=\"491\" class=\"alignnone size-full wp-image-3850\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04a-300x205.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04b.png\" alt=\"MMA7361\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3851\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04c.png\" alt=\"MMA7361\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3852\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/02\/DL2401Mk04c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>SparkFun Triple Axis Accelerometer Breakout &#8211; MMA7361<\/strong><\/p>\n<p>This is a breakout board for Freescale&#8217;s MMA7361L three-axis analog MEMS accelerometer. The sensor requires a very low amount of power and has a g-select input which switches the accelerometer between \u00b11.5g and \u00b16g measurement ranges. Other features include a sleep mode, signal conditioning, a 1-pole low pass filter, temperature compensation, self test, and 0g-detect which detects linear freefall. Zero-g offset and sensitivity are factory set and require no external devices.<\/p>\n<p>This breadboard friendly board breaks out every pin of the MMA7361L to a 9-pin, 0.1&#8243; pitch header. The sensor works on power between 2.2 and 3.6VDC (3.3 Volt optimal), and typically consumes just 400\u00b5A of current. All three axes have their own analog output.<\/p>\n<ul>\n<li>Two selectable measuring ranges (\u00b11.5g, \u00b16g)<\/li>\n<li>Breadboard friendly &#8211; 0.1&#8243; pitch header<\/li>\n<li><strong>Low current consumption:<\/strong> 400 \u00b5A<\/li>\n<li><strong>Sleep mode:<\/strong> 3 \u00b5A<\/li>\n<li><strong>Low voltage operation:<\/strong> 2.2 Volt &#8211; 3.6 Volt<\/li>\n<li>High sensitivity (800 mV\/g at 1.5g)<\/li>\n<li>Fast turn on time (0.5 ms enable response time)<\/li>\n<li>Self test for freefall detect diagnosis<\/li>\n<li>0g-Detect for freefall protection<\/li>\n<li>Signal conditioning with low pass filter<\/li>\n<li>Robust design, high shocks survivability<\/li>\n<\/ul>\n<p><strong>DL2401Mk04<\/strong><\/p>\n<p>1 x SparkFun Thing Plus &#8211; ESP32 WROOM<br \/>\n1 x DS3231 Precision RTC FeatherWing<br \/>\n1 x SparkFun Triple Axis Accelerometer Breakout &#8211; MMA7361<br \/>\n1 x Rocker Switch &#8211; SPST<br \/>\n1 x Resistor 10K Ohm<br \/>\n1 x CR1220 3V Lithium Coin Cell Battery<br \/>\n1 x 1 x Lithium Ion Battery &#8211; 1000mAh<br \/>\n1 x Terminal Block Breakout FeatherWing<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>SparkFun Thing Plus &#8211; ESP32 WROOM<\/strong><\/p>\n<p>LED &#8211; LED_BUILTIN<br \/>\nSDA &#8211; Digital 23<br \/>\nSCL &#8211; Digital 22<br \/>\nSW1 &#8211; Digital 21<br \/>\nXAC &#8211; Analog A0<br \/>\nYAC &#8211; Analog A1<br \/>\nZAC &#8211; Analog A2<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2401Mk04p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/****** Don Luc Electronics \u00a9 ******\r\nSoftware Version Information\r\nProject #28 - Sensors - MMA7361 - Mk14\r\n28-14\r\nDL2401Mk04p.ino\r\n1 x SparkFun Thing Plus - ESP32 WROOM\r\n1 x DS3231 Precision RTC FeatherWing\r\n1 x SparkFun Triple Axis Accelerometer Breakout - MMA7361\r\n1 x Rocker Switch - SPST\r\n1 x Resistor 10K Ohm\r\n1 x Lithium Ion Battery - 1000mAh\r\n1 x CR1220 3V Lithium Coin Cell Battery\r\n1 x Terminal Block Breakout FeatherWing\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ Bluetooth LE keyboard\r\n#include &lt;BleKeyboard.h&gt;\r\n\/\/ Two Wire Interface (TWI\/I2C)\r\n#include &lt;Wire.h&gt;\r\n\/\/ Serial Peripheral Interface\r\n#include &lt;SPI.h&gt;\r\n\/\/ DS3231 Precision RTC \r\n#include &lt;RTClib.h&gt;\r\n\r\n\/\/ Bluetooth LE Keyboard\r\nBleKeyboard bleKeyboard;\r\nString sKeyboard = &quot;&quot;;\r\n\/\/ Send Size\r\nbyte sendSize = 0;\r\n\r\n\/\/ DS3231 Precision RTC \r\nRTC_DS3231 rtc;\r\nString dateRTC = &quot;&quot;;\r\nString timeRTC = &quot;&quot;;\r\n\r\n\/\/ Accelerometer MMA7361\r\nint XAc = A0;\r\nint YAc = A1;\r\nint ZAc = A2;\r\n\/\/ Read\r\nint x = 0;\r\nint y = 0; \r\nint z = 0;\r\n\r\n\/\/ The number of the Rocker Switch pin\r\nint iSwitch = 21;\r\n\/\/ Variable for reading the button status\r\nint SwitchState = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;28-14&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Date and Time RTC\r\n  isRTC ();\r\n\r\n  \/\/ Accelerometer MMA7361\r\n  isMMA7361();\r\n\r\n  \/\/ Read the state of the Switch value:\r\n  SwitchState = digitalRead(iSwitch);\r\n\r\n  \/\/ Check if the button is pressed. If it is, the SwitchState is HIGH:\r\n  if (SwitchState == HIGH) {\r\n\r\n    \/\/ Bluetooth LE Keyboard\r\n    isBluetooth();\r\n\r\n  }\r\n\r\n  \/\/ Delay 1 Second\r\n  delay(1000);\r\n\r\n}\r\n<\/pre>\n<p><strong>getAccelerometer.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Accelerometer MMA7361\r\n\/\/ isMMA7361\r\nvoid isMMA7361(){\r\n\r\n  \/\/ Accelerometer Read\r\n  x = analogRead(XAc); \r\n  y = analogRead(YAc);\r\n  z = analogRead(ZAc);\r\n\r\n  sKeyboard = sKeyboard + String(x) + &quot;|&quot; + String(y) + &quot;|&quot; + String(z) + &quot;|*&quot;;\r\n  \r\n}\r\n<\/pre>\n<p><strong>getBleKeyboard.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Ble Keyboard\r\n\/\/ Bluetooth\r\n\/\/ isBluetooth\r\nvoid isBluetooth() {\r\n\r\n  \/\/ ESP32 BLE Keyboard\r\n  if(bleKeyboard.isConnected()) {\r\n\r\n    \/\/ Send Size Length\r\n    sendSize = sKeyboard.length();\r\n\r\n    \/\/ Send Size, charAt\r\n    for(byte i = 0; i &lt; sendSize+1; i++){\r\n\r\n       \/\/ Write\r\n       bleKeyboard.write(sKeyboard.charAt(i));\r\n       delay(50);\r\n    \r\n    }\r\n    bleKeyboard.write(KEY_RETURN);\r\n\r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>getRTC.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Date &amp; Time\r\n\/\/ DS3231 Precision RTC\r\nvoid isSetupRTC() {\r\n\r\n  \/\/ DS3231 Precision RTC\r\n  if (! rtc.begin()) {\r\n    \/\/Serial.println(&quot;Couldn&#039;t find RTC&quot;);\r\n    \/\/Serial.flush();\r\n    while (1) delay(10);\r\n  }\r\n\r\n  if (rtc.lostPower()) {\r\n    \/\/Serial.println(&quot;RTC lost power, let&#039;s set the time!&quot;);\r\n    \/\/ When time needs to be set on a new device, or after a power loss, the\r\n    \/\/ following line sets the RTC to the date &amp; time this sketch was compiled\r\n    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));\r\n    \/\/ This line sets the RTC with an explicit date &amp; time, for example to set\r\n    \/\/ January 21, 2014 at 3am you would call:\r\n    \/\/rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0));\r\n  }\r\n  \r\n}\r\n\/\/ Date and Time RTC\r\nvoid isRTC () {\r\n\r\n  \/\/ Date and Time\r\n  dateRTC = &quot;&quot;;\r\n  timeRTC = &quot;&quot;;\r\n  DateTime now = rtc.now();\r\n  \r\n  \/\/ Date\r\n  dateRTC = now.year(), DEC; \r\n  dateRTC = dateRTC + &quot;\/&quot;;\r\n  dateRTC = dateRTC + now.month(), DEC;\r\n  dateRTC = dateRTC + &quot;\/&quot;;\r\n  dateRTC = dateRTC + now.day(), DEC;\r\n\r\n  \/\/ Time\r\n  timeRTC = now.hour(), DEC;\r\n  timeRTC = timeRTC + &quot;:&quot;;\r\n  timeRTC = timeRTC + now.minute(), DEC;\r\n  timeRTC = timeRTC + &quot;:&quot;;\r\n  timeRTC = timeRTC + now.second(), DEC;\r\n\r\n  \/\/ bleKeyboard\r\n  sKeyboard = &quot;SEN|&quot; + sver + &quot;|&quot; + String(dateRTC) \r\n  + &quot;|&quot; + String(timeRTC) + &quot;|&quot;;\r\n\r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup()\r\n{\r\n  \r\n  \/\/ Give display time to power on\r\n  delay(100);\r\n\r\n  \/\/ Bluetooth LE keyboard\r\n  bleKeyboard.begin();\r\n  \r\n  \/\/ Wire - Inialize I2C Hardware\r\n  Wire.begin();\r\n\r\n  \/\/ Give display time to power on\r\n  delay(100);\r\n\r\n  \/\/ Date &amp; Time RTC\r\n  \/\/ DS3231 Precision RTC \r\n  isSetupRTC();\r\n\r\n  \/\/ Give display time to power on\r\n  delay(100);\r\n  \r\n  \/\/ Initialize the Switch pin as an input\r\n  pinMode(iSwitch, INPUT);\r\n\r\n  \/\/ Initialize digital pin LED_BUILTIN as an output\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n  \/\/ Turn the LED on HIGH\r\n  digitalWrite(LED_BUILTIN, HIGH);\r\n\r\n  \/\/ Delay 5 Second\r\n  delay( 5000 );\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Teacher, Instructor, E-Mentor, R&#038;D and Consulting<\/strong><\/p>\n<ul>\n<li>Programming Language<\/li>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Wireless (Radio Frequency, Bluetooth, WiFi, Etc&#8230;)<\/li>\n<li>Robotics<\/li>\n<li>Automation<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Machine Learning<\/li>\n<li>Artificial Intelligence (AI)<\/li>\n<li>RTOS<\/li>\n<li>eHealth Sensors, Biosensor, and Biometric<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<li>Consulting<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Luc Paquin \u2013 Curriculum Vitae &#8211; 2024<\/strong><br \/>\nhttps:\/\/www.donluc.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/@thesass2063<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #Sensors #MMA7361 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; SparkFun Triple Axis Accelerometer Breakout &#8211; MMA7361 This is a breakout board for Freescale&#8217;s MMA7361L three-axis analog MEMS accelerometer. The sensor requires a very low amount of power and has a g-select input which switches the accelerometer &#8230; <a title=\"Project #28 &#8211; Sensors &#8211; MMA7361 &#8211; Mk14\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3848\" aria-label=\"Read more about Project #28 &#8211; Sensors &#8211; MMA7361 &#8211; Mk14\">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":[294,47,50,49,38,80,59,115,5,287,58,82,10,43],"tags":[251,86,6,92,242,102,4,83,85,24,322,9,84,27,248,109,33,34,108],"class_list":["post-3848","post","type-post","status-publish","format-standard","hentry","category-sensors","category-adafruit","category-arduino","category-consultant","category-digitalelectronics","category-esp32","category-fritzing","category-e-mentor","category-microcontrollers","category-program","category-arduino-programming","category-program-esp32","category-projects","category-sparkfun","tag-accelerometer","tag-adafruit","tag-arduino","tag-battery","tag-bluetooth","tag-components","tag-consultant","tag-esp32","tag-fritzing","tag-microcontroller","tag-mma7361","tag-programming","tag-programming-esp32","tag-projects-2","tag-sensors","tag-sparkfun","tag-technology","tag-video-blog","tag-vlog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3848","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=3848"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3848\/revisions"}],"predecessor-version":[{"id":3944,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3848\/revisions\/3944"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}