{"id":1969,"date":"2019-09-14T07:41:12","date_gmt":"2019-09-14T14:41:12","guid":{"rendered":"http:\/\/www.donluc.com\/?p=1969"},"modified":"2019-09-14T07:41:12","modified_gmt":"2019-09-14T14:41:12","slug":"project-11-esp32-feather-adxl335-mk08","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=1969","title":{"rendered":"Project #11: ESP32 Feather &#8211; ADXL335 &#8211; Mk08"},"content":{"rendered":"<p><strong>ESP32 Feather &#8211; ADXL335<\/strong><\/p>\n<p>&#8212;&#8212;<\/p>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1969-1\" width=\"720\" height=\"406\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/dl1909mk05.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/dl1909mk05.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/dl1909mk05.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05a.png\" alt=\"ADXL335 Triple Axis Accelerometer\" width=\"720\" height=\"726\" class=\"alignnone size-full wp-image-1971\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05a-150x150.png 150w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05a-298x300.png 298w\" 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\/2019\/09\/DL1909Mk05b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05b.png\" alt=\"ADXL335 Triple Axis Accelerometer\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-1972\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05b-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\/2019\/09\/DL1909Mk05c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05c.png\" alt=\"ADXL335 Triple Axis Accelerometer\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-1973\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05c-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\/2019\/09\/DL1909Mk05d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05d.png\" alt=\"ADXL335 Triple Axis Accelerometer\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-1974\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/09\/DL1909Mk05d-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>ADXL335 Triple Axis Accelerometer<\/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.<\/p>\n<p><strong>DonLuc1909Mk05<\/strong><\/p>\n<p>1 x Adafruit HUZZAH32 ESP32 Feather<br \/>\n1 x Adafruit SHARP Memory Display<br \/>\n1 x Adafruit Adalogger FeatherWing &#8211; RTC + SD<br \/>\n1 x CR1220 12mm Lithium Battery<br \/>\n1 x 8Gb Micro SD Card<br \/>\n1 x RHT03 Humidity and Temperature Sensor<br \/>\n1 x GPS Receiver GP-20U<br \/>\n1 x ADXL335 Triple Axis Accelerometer<br \/>\n1 x LED Green<br \/>\n1 x Rocker Switches<br \/>\n1 x 100 Ohm<br \/>\n1 x 10K Ohm<br \/>\n14 x Jumper Wires 3&#8243; M\/M<br \/>\n6 x Jumper Wires 6&#8243; M\/M<br \/>\n5 x Wire<br \/>\n1 x Full-Size Breadboard<br \/>\n1 x Breadboard<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Adafruit HUZZAH32 ESP32 Feather<\/strong><\/p>\n<p>LG1 &#8211; Digital 21<br \/>\nRO1 &#8211; Digital 16<br \/>\nRHT &#8211; Digital 17<br \/>\nSCK &#8211; Digital 13<br \/>\nMOS &#8211; Digital 12<br \/>\nSSD &#8211; Digital 27<br \/>\nSDA &#8211; Digital 23<br \/>\nSCL &#8211; Digital 22<br \/>\nSD1 &#8211; Digital 33<br \/>\nSC2 &#8211; Digital 5<br \/>\nMO2 &#8211; Digital 18<br \/>\nMI2 &#8211; Digital 19<br \/>\nGPS &#8211; Digital 4<br \/>\nACX &#8211; Analog A8<br \/>\nACY &#8211; Analog A7<br \/>\nACZ &#8211; Analog A6<br \/>\nGND &#8211; GND<br \/>\nVIN &#8211; +3.3V<\/p>\n<p><strong>DL1909Mk05.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DL1909Mk05.ino\">\r\n\/\/ ***** Don Luc Electronics *****\r\n\/\/ Software Version Information\r\n\/\/ Project #11: HUZZAH32 ESP32 Feather - ADXL335 - Mk08\r\n\/\/ 09-05\r\n\/\/ DL1909Mk05p.ino 11-08\r\n\/\/ Adafruit HUZZAH32 ESP32 Feather Board\r\n\/\/ SHARP Display\r\n\/\/ LED Green\r\n\/\/ Adalogger FeatherWing - RTC + SD\r\n\/\/ EEPROM\r\n\/\/ RHT03 Humidity and Temperature Sensor\r\n\/\/ Rocker Switches\r\n\/\/ GPS Receiver\r\n\/\/ ADXL335 Triple Axis Accelerometer\r\n\r\n\/\/ include Library Code\r\n\/\/ SHARP Memory Display\r\n#include &lt;Adafruit_SharpMem.h&gt;\r\n#include &lt;Adafruit_GFX.h&gt;\r\n\/\/ Date and Time\r\n#include &quot;RTClib.h&quot;\r\n\/\/ EEPROM library to read EEPROM with unique ID for unit\r\n#include &quot;EEPROM.h&quot;\r\n\/\/ RHT Humidity and Temperature Sensor\r\n#include &lt;SparkFun_RHT03.h&gt;\r\n\/\/ SD Card\r\n#include &quot;FS.h&quot;\r\n#include &quot;SD.h&quot;\r\n#include &quot;SPI.h&quot;\r\n\/\/ GPS Receiver\r\n#include &lt;TinyGPS++.h&gt;\r\n#include &lt;HardwareSerial.h&gt;\r\n\/\/ ADXL335 Triple Axis Accelerometer\r\n#include &lt;ADXL335.h&gt;\r\n\r\n\/\/ SHARP Memory Display\r\n\/\/ any pins can be used\r\n#define SHARP_SCK  13\r\n#define SHARP_MOSI 12\r\n#define SHARP_SS   27\r\n\/\/ Set the size of the display here, e.g. 144x168!\r\nAdafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);\r\n\/\/ The currently-available SHARP Memory Display (144x168 pixels)\r\n\/\/ requires &gt; 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno\r\n\/\/ or other &lt;4K &quot;classic&quot; devices!\r\n#define BLACK 0\r\n#define WHITE 1\r\nint minorHalfSize; \/\/ 1\/2 of lesser of display width or height\r\n\r\n\/\/ LED Green\r\nint iLEDGreen =  21;                 \/\/ LED Green\r\n\r\n\/\/ PCF8523 Precision RTC \r\nRTC_PCF8523 rtc;\r\nString dateRTC = &quot;&quot;;\r\nString timeRTC = &quot;&quot;;\r\n\r\n\/\/ RHT Humidity and Temperature Sensor\r\nconst int RHT03_DATA_PIN = 17;          \/\/ RHT03 data pin Digital 17\r\nRHT03 rht;                              \/\/ This creates a RTH03 object, which we&#039;ll use to interact with the sensor\r\nfloat latestHumidity;\r\nfloat latestTempC;\r\nfloat latestTempF;\r\n\r\n\/\/ SD Card\r\nconst int chipSelect = 33;              \/\/ SD Card\r\nString zzzzzz = &quot;&quot;;\r\n\r\n\/\/ Rocker Switches\r\nint iRow1 = 16;                         \/\/ Rocker Switches Digital 16\r\nint iRow1State = 0;                     \/\/ Variable for reading the pushbutton status\r\n\r\n\/\/ ESP32 HardwareSerial\r\nHardwareSerial tGPS(2);\r\n\r\n\/\/ GPS Receiver\r\n#define gpsRXPIN 4\r\n#define gpsTXPIN 36                     \/\/ This one is unused and doesnt have a conection\r\n\/\/ The TinyGPS++ object\r\nTinyGPSPlus gps;\r\nfloat TargetLat;\r\nfloat TargetLon;\r\nint Status = 0;\r\n\r\n\/\/ ADXL335 Triple Axis Accelerometer\r\nconst int pin_x = A8;\r\nconst int pin_y = A7;\r\nconst int pin_z = A6;\r\nconst float aref = 3.3;\r\nADXL335 accel(pin_x, pin_y, pin_z, aref);\r\nString latestX = &quot;&quot;;\r\nString latestY = &quot;&quot;;\r\nString latestZ = &quot;&quot;;\r\n\r\n\/\/ The current address in the EEPROM (i.e. which byte\r\n\/\/ we&#039;re going to  read to next)\r\n#define EEPROM_SIZE 64\r\nString sver = &quot;9-5.p&quot;;\r\n\/\/ Unit ID information\r\nString uid = &quot;&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Receives NEMA data from GPS receiver\r\n  \/\/ This sketch displays information every time a new sentence is correctly encoded.\r\n  while ( tGPS.available() &gt; 0)\r\n    if (gps.encode( tGPS.read() ))\r\n    {\r\n     displayInfo();\r\n    }\r\n  \r\n  if (millis() &gt; 5000 &amp;&amp; gps.charsProcessed() &lt; 10)\r\n  {\r\n    while(true);\r\n  }\r\n\r\n  \/\/ Date and Time \r\n  isRTC();\r\n  \r\n  \/\/ RHT03 Humidity and Temperature Sensor\r\n  isRHT03();\r\n  \r\n  \/\/ SHARP Memory Display On\r\n  isDisplayOn();\r\n  \r\n  \/\/ Rocker Switched\r\n  \/\/ Read the state of the iRow1 value\r\n  iRow1State = digitalRead(iRow1);\r\n\r\n  \/\/ ADXL335 Triple Axis Accelerometer\r\n  getADXL335();\r\n\r\n  \/\/ Check if the pushbutton is pressed. If it is, the buttonState is HIGH:\r\n  if (iRow1State == HIGH) {\r\n\r\n    \/\/ iLEDGreen\r\n    digitalWrite(iLEDGreen,  HIGH );\r\n    \/\/ SD Card\r\n    isSD();\r\n\r\n  } else {\r\n\r\n    \/\/ iLEDGreen\r\n    digitalWrite(iLEDGreen,  LOW );\r\n  \r\n  }\r\n   \r\n  \/\/ Delay \r\n  delay( 1000 );\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\/\/ ADXL335 Triple Axis Accelerometer\r\nvoid getADXL335() \r\n{\r\n\r\n  \/\/ This is required to update the values\r\n  accel.update();\r\n\r\n  \/\/ This tells us how long the string is\r\n  int string_width;\r\n\r\n  float x;\r\n  float y;\r\n  float z;\r\n  \r\n  x = accel.getX();\r\n  y = accel.getY();\r\n  \/\/ If the project is laying flat and top up the z axis reads ~1G\r\n  z = accel.getZ();\r\n\r\n  latestX = formatFloat(x, 2, &amp;string_width);\r\n  latestY = formatFloat(y, 2, &amp;string_width); \r\n  latestZ = formatFloat(z, 2, &amp;string_width);\r\n  \r\n}\r\n\/\/ Format float library\r\nString formatFloat(double value, int places, int* string_width)\r\n{\r\n  \r\n  \/\/ If value is positive infinity\r\n  if (isinf(value) &gt; 0)\r\n  {\r\n    return &quot;+Inf&quot;;\r\n  }\r\n    \r\n  \/\/ Arduino does not seem to have negative infinity\r\n  \/\/ keeping this code block for reference\r\n  \/\/ if value is negative infinity\r\n  if(isinf(value) &lt; 0)\r\n  {\r\n    return &quot;-Inf&quot;;\r\n  }\r\n  \r\n  \/\/ If value is not a number\r\n  if(isnan(value) &gt; 0)\r\n  {\r\n    return &quot;NaN&quot;;\r\n  }\r\n  \r\n  \/\/ Always include a space for the dot\r\n  int num_width = 1;\r\n\r\n  \/\/ If the number of decimal places is less than 1\r\n  if (places &lt; 1)\r\n  {\r\n    \r\n    \/\/ Set places to 1\r\n    places = 1;\r\n    \r\n    \/\/ And truncate the value\r\n    value = (float)((int)value);\r\n    \r\n  }\r\n  \r\n  \/\/ Add the places to the right of the decimal\r\n  num_width += places;\r\n  \r\n  \/\/ If the value does not contain an integral part  \r\n  if (value &lt; 1.0 &amp;&amp; value &gt; -1.0)\r\n  {\r\n    \r\n    \/\/ Add one for the integral zero\r\n    num_width++;\r\n    \r\n  }\r\n  else\r\n  {\r\n\r\n    \/\/ Get the integral part and get the number of places to the left of decimal\r\n    num_width += ((int)log10(abs(value))) + 1;\r\n    \r\n  }\r\n  \r\n  \/\/ If the value in less than 0\r\n  if (value &lt; 0.0)\r\n  {\r\n    \r\n    \/\/ Add a space for the minus sign\r\n    num_width++;\r\n    \r\n  }\r\n  \r\n  \/\/ Make a string the size of the number plus 1 for string terminator\r\n  char s[num_width + 1]; \r\n  \r\n  \/\/ Put the string terminator at the end\r\n  s[num_width] = &#039;\\0&#039;;\r\n  \r\n  \/\/ Initalize the array to all zeros\r\n  for (int i = 0; i &lt; num_width; i++)\r\n  {\r\n    \r\n    s[i] = &#039;0&#039;;\r\n    \r\n  }\r\n  \r\n  \/\/ Characters that are not changed by the function below will be zeros\r\n  \/\/ set the out variable string width lets the caller know what we came up with\r\n  *string_width = num_width;\r\n  \r\n  \/\/ Use the avr-libc function dtosrtf to format the value\r\n  return String(dtostrf(value,num_width,places,s));  \r\n  \r\n}\r\n<\/pre>\n<p><strong>getDisplay.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getDisplay.ino\">\r\n\/\/ SHARP Memory Display On\r\nvoid isDisplayOn() {\r\n\r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    \/\/ text display date, time, LED on\r\n    display.setRotation(4);\r\n    display.setTextSize(2);\r\n    display.setTextColor(BLACK);\r\n    display.setCursor(0,1);\r\n    display.println( dateRTC );\r\n    display.setCursor(0,17);\r\n    display.println( timeRTC );   \r\n    \/\/display.setTextSize(2);    \r\n    display.setCursor(0,35);\r\n    display.print(&quot;Lon: &quot;);\r\n    display.println( TargetLon );\r\n    display.setCursor(0,55);\r\n    display.print(&quot;Lat: &quot;);\r\n    display.println( TargetLat );\r\n    display.setCursor(0,74);\r\n    display.print(&quot;Hum: &quot;);\r\n    display.print( latestHumidity );\r\n    display.println(&quot;%&quot;);\r\n    display.setCursor(0,94);\r\n    display.print(&quot;Cel: &quot;);\r\n    display.print( latestTempC );\r\n    display.println(&quot;*C&quot;);\r\n    display.setCursor(0,114);\r\n    display.print(&quot;X: &quot;);\r\n    display.println( latestX );\r\n    display.setCursor(0,134);\r\n    display.print(&quot;Y: &quot;);\r\n    display.println( latestY );\r\n    display.setCursor(0,154);\r\n    display.print(&quot;Z: &quot;);\r\n    display.println( latestZ );\r\n    display.refresh();\r\n\r\n}\r\n\/\/ SHARP Memory Display - UID\r\nvoid isDisplayUID() {\r\n\r\n    \/\/ text display EEPROM\r\n    display.setRotation(4);\r\n    display.setTextSize(2);\r\n    display.setTextColor(BLACK);\r\n    display.setCursor(0,20);\r\n    display.print( &quot;UID: &quot; );\r\n    display.println( uid );\r\n   \/\/ display.setTextSize();\r\n    display.setTextColor(BLACK);\r\n    display.setCursor(0,45);\r\n    display.print( &quot;VER: &quot;);\r\n    display.println( sver  );\r\n    display.refresh();\r\n    delay( 100 );\r\n    \r\n}\r\n<\/pre>\n<p><strong>getEEPROM.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getEEPROM.ino\">\r\n\/\/ EEPROM\r\nvoid GetUID()\r\n{\r\n  \r\n  \/\/ Get unit ID\r\n  uid = &quot;&quot;;\r\n  for (int x = 0; x &lt; 5; x++)\r\n  {\r\n    uid = uid + char(EEPROM.read(x));\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getGPS.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getGPS.ino\">\r\n\/\/ GPS Receiver\r\nvoid setupGPS() {\r\n\r\n  \/\/ Setup GPS\r\n  tGPS.begin(  9600 , SERIAL_8N1, gpsRXPIN, gpsTXPIN );\r\n  \r\n}\r\n\/\/ GPS Vector Pointer Target\r\nvoid displayInfo()\r\n{\r\n\r\n  \/\/ Location\r\n  if (gps.location.isValid())\r\n  {\r\n    \r\n    TargetLat = gps.location.lat();\r\n    TargetLon = gps.location.lng();\r\n    Status = 2;\r\n    \r\n  }\r\n  else\r\n  {\r\n\r\n    Status = 0;\r\n    \r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>getRHT.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getRHT.ino\">\r\n\/\/ RHT03 Humidity and Temperature Sensor\r\nvoid isRHT03(){\r\n\r\n  \/\/ Call rht.update() to get new humidity and temperature values from the sensor.\r\n  int updateRet = rht.update();\r\n\r\n  \/\/ The humidity(), tempC(), and tempF() functions can be called -- after \r\n  \/\/ a successful update() -- to get the last humidity and temperature value \r\n  latestHumidity = rht.humidity();\r\n  latestTempC = rht.tempC();\r\n  latestTempF = rht.tempF();\r\n  \r\n}\r\n<\/pre>\n<p><strong>getRTCpcf8523.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getRTCpcf8523.ino\">\r\n\/\/ PCF8523 Precision RTC \r\nvoid setupRTC() {\r\n\r\n  \/\/ pcf8523 Precision RTC   \r\n  if (! rtc.begin()) {\r\n    while (1);\r\n  }  \r\n  if (! rtc.initialized()) {\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(2018, 9, 29, 12, 17, 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  DateTime now = rtc.now();\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  \/\/ 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}\r\n<\/pre>\n<p><strong>getSD.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getSD.ino\">\r\n\/\/ SD Card\r\nvoid setupSD() {\r\n\r\n  \/\/ SD Card\r\n    pinMode( chipSelect , OUTPUT );\r\n    if(!SD.begin( chipSelect )){\r\n        ;  \r\n        return;\r\n    }\r\n    uint8_t cardType = SD.cardType();\r\n\r\n    if(cardType == CARD_NONE){\r\n        ; \r\n        return;\r\n    }\r\n\r\n    \/\/Serial.print(&quot;SD Card Type: &quot;);\r\n    if(cardType == CARD_MMC){\r\n        ; \r\n    } else if(cardType == CARD_SD){\r\n        ; \r\n    } else if(cardType == CARD_SDHC){\r\n        ; \r\n    } else {\r\n        ; \r\n    } \r\n\r\n    uint64_t cardSize = SD.cardSize() \/ (1024 * 1024);\r\n  \r\n}\r\n\/\/ SD Card\r\nvoid isSD() {\r\n\r\n  zzzzzz = &quot;&quot;;\r\n\r\n  zzzzzz = uid + &quot;|&quot; + sver + &quot;|&quot; + dateRTC + &quot;|&quot; + timeRTC + &quot;|&quot; + Status + &quot;|&quot; + TargetLon + &quot;|&quot; + TargetLat + &quot;|&quot; + latestHumidity + &quot;|&quot; + latestTempC + &quot;|&quot; + latestTempF + &quot;|&quot; + latestX + &quot;|&quot; + latestY + &quot;|&quot; + latestZ + &quot;|\\r&quot;;\r\n\r\n  char msg[zzzzzz.length() + 1];\r\n\r\n  zzzzzz.toCharArray(msg, zzzzzz.length() + 1);\r\n\r\n  appendFile(SD, &quot;\/espdata.txt&quot;, msg );\r\n  \r\n}\r\n\/\/ List Dir\r\nvoid listDir(fs::FS &amp;fs, const char * dirname, uint8_t levels){\r\n    dirname;\r\n    File root = fs.open(dirname);\r\n    if(!root){\r\n        return;\r\n    }\r\n    if(!root.isDirectory()){\r\n        return;\r\n    }\r\n\r\n    File file = root.openNextFile();\r\n    while(file){\r\n        if(file.isDirectory()){\r\n            file.name();\r\n            if(levels){\r\n                listDir(fs, file.name(), levels -1);\r\n            }\r\n        } else {\r\n            file.name();\r\n            file.size();\r\n        }\r\n        file = root.openNextFile();\r\n    }\r\n}\r\n\/\/ Write File\r\nvoid writeFile(fs::FS &amp;fs, const char * path, const char * message){\r\n    path;\r\n    File file = fs.open(path, FILE_WRITE);\r\n    if(!file){\r\n        return;\r\n    }\r\n    if(file.print(message)){\r\n        ;  \r\n    } else {\r\n        ;  \r\n    }\r\n    file.close();\r\n}\r\n\/\/ Append File\r\nvoid appendFile(fs::FS &amp;fs, const char * path, const char * message){\r\n    \/\/Serial.printf(&quot;Appending to file: %s\\n&quot;, path);\r\n    path;\r\n    File file = fs.open(path, FILE_APPEND);\r\n    if(!file){\r\n        return;\r\n    }\r\n    if(file.print(message)){\r\n        ;  \r\n    } else {\r\n        ;  \r\n    }\r\n    file.close();\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\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ EEPROM with unique ID\r\n  EEPROM.begin(EEPROM_SIZE);\r\n   \r\n  \/\/ Get Unit ID\r\n  GetUID();\r\n\r\n  \/\/ GPS Receiver\r\n  \/\/ Setup GPS\r\n  setupGPS();\r\n  \r\n  \/\/ SHARP Display start &amp; clear the display\r\n  display.begin();\r\n  display.clearDisplay();\r\n\r\n  isDisplayUID();\r\n\r\n  delay( 5000 );\r\n  \r\n  \/\/ Initialize the LED Green\r\n  pinMode(iLEDGreen, OUTPUT);\r\n\r\n  \/\/ PCF8523 Precision RTC \r\n  setupRTC();\r\n\r\n  \/\/ Date and Time RTC\r\n  isRTC();\r\n\r\n  \/\/ RHT03 Humidity and Temperature Sensor\r\n  \/\/ Call rht.begin() to initialize the sensor and our data pin\r\n  rht.begin(RHT03_DATA_PIN);\r\n\r\n  \/\/ SD Card\r\n  setupSD();\r\n\r\n  \/\/ Rocker Switches\r\n  pinMode(iRow1, INPUT);\r\n\r\n}\r\n<\/pre>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> http:\/\/neosteamlabs.com\/<br \/>\n<strong>Web:<\/strong> http:\/\/www.jlpconsultants.com\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Etsy:<\/strong> https:\/\/www.etsy.com\/shop\/NeoSteamLabs<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ESP32 Feather &#8211; ADXL335 &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; ADXL335 Triple Axis Accelerometer 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 &#8230; <a title=\"Project #11: ESP32 Feather &#8211; ADXL335 &#8211; Mk08\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=1969\" aria-label=\"Read more about Project #11: ESP32 Feather &#8211; ADXL335 &#8211; Mk08\">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":[81,47,38,80,59,5,82,10,43],"tags":[86,90,6,87,19,83,85,89,24,9,84,27,88],"class_list":["post-1969","post","type-post","status-publish","format-standard","hentry","category-esp32-project","category-adafruit","category-digitalelectronics","category-esp32","category-fritzing","category-microcontrollers","category-program-esp32","category-projects","category-sparkfun","tag-adafruit","tag-adxl335-triple-axis-accelerometer","tag-arduino","tag-display","tag-electronics","tag-esp32","tag-fritzing","tag-gps-receiver","tag-microcontroller","tag-programming","tag-programming-esp32","tag-projects-2","tag-rht03-humidity-and-temperature-sensor"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1969","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=1969"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1969\/revisions"}],"predecessor-version":[{"id":1975,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1969\/revisions\/1975"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}