{"id":2798,"date":"2021-08-17T12:34:49","date_gmt":"2021-08-17T19:34:49","guid":{"rendered":"https:\/\/www.donluc.com\/?p=2798"},"modified":"2021-08-17T12:34:49","modified_gmt":"2021-08-17T19:34:49","slug":"project-19-time-adalogger-featherwing-rtc-sd-mk05","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=2798","title":{"rendered":"Project #19: Time &#8211; Adalogger FeatherWing &#8211; RTC + SD &#8211; Mk05"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2798-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06a.png\" alt=\"Adalogger FeatherWing\" width=\"720\" height=\"548\" class=\"alignnone size-full wp-image-2800\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06a-300x228.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\/2021\/08\/DL2108Mk06b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06b.png\" alt=\"Adalogger FeatherWing\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2801\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06b-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\/2021\/08\/DL2108Mk06c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06c.png\" alt=\"Adalogger FeatherWing\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2802\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06c-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\/2021\/08\/DL2108Mk06d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06d.png\" alt=\"Adalogger FeatherWing\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2803\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/08\/DL2108Mk06d-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Adalogger FeatherWing &#8211; RTC + SD<\/strong><\/p>\n<p>A Feather board without ambition is a Feather board without FeatherWings. This is the Adalogger FeatherWing: it adds both a battery-backed Real Time Clock and MicroSD card storage to any Feather main board. This FeatherWing will make it real easy to add datalogging to any of our existing Feathers. You get both an I2C Real Time Clock (PCF8523) with 32KHz crystal and battery backup, and a MicroSD socket that connects to the SPI port pins.<\/p>\n<p><strong>MicroSD Card<\/strong><\/p>\n<p>If you have a project with any audio, video, graphics, data logging, etc in it, you&#8217;ll find that having a removable storage option is essential. Most microcontrollers have extremely limited built-in storage. If you&#8217;re doing any sort of data logging, graphics or audio, you&#8217;ll need at least a megabyte of storage, and 64M is probably the minimum.<\/p>\n<p>MicroSD cards are &#8216;raw&#8217; storage. They&#8217;re just sectors in a flash chip, there&#8217;s no structure that you have to use. That means you could format an SD card to be a Linux filesystem, a FAT (DOS) filesystem or a Mac filesystem. You could also not have any filesystem at all. However, 99% of computers, cameras, MP3 players, GPS loggers, etc require FAT16 or FAT32 for the filesystem. The tradeoff here is that for smaller microcontrollers the addition of the complex file format handling can take a lot of flash storage and RAM.<\/p>\n<p><strong>DL2108Mk06<\/strong><\/p>\n<p>1 x SparkFun Thing Plus &#8211; ESP32 WROOM<br \/>\n1 x Adafruit SHARP Memory Display<br \/>\n1 x Adalogger FeatherWing &#8211; RTC + SD<br \/>\n1 x CR1220 3V Lithium Coin Cell Battery<br \/>\n1 x 32Gb microSD Card<br \/>\n1 x LED Green<br \/>\n1 x Rocker Switch &#8211; SPST (Round)<br \/>\n1 x Terminal Block Breakout FeatherWing<br \/>\n1 x Lithium Ion Battery &#8211; 850mAh<br \/>\n1 x GPS Receiver &#8211; GP-20U7<br \/>\n1 x Rotary Switch &#8211; 10 Position<br \/>\n1 x SparkFun Rotary Switch \u2013 10 Position<br \/>\n1 x Black Knob<br \/>\n1 x Breadboard Solderable<br \/>\n12 x 1K Ohm<br \/>\n1 x Half-Size Breadboard<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>SparkFun Thing Plus &#8211; ESP32 WROOM<\/strong><\/p>\n<p>SCK &#8211; Digital 13<br \/>\nMSI &#8211; Digital 12<br \/>\nSS0 &#8211; Digital 27<br \/>\nGRX &#8211; Digital 16<br \/>\nGTX &#8211; Digital 17<br \/>\nSDA &#8211; Digital 23<br \/>\nSDL &#8211; Digital 22<br \/>\nSCK &#8211; Digital 5<br \/>\nMSO &#8211; Digital 19<br \/>\nMSI &#8211; Digital 18<br \/>\nSS1 &#8211; Digital 33<br \/>\nLEG &#8211; Digital 21<br \/>\nSW0 &#8211; Digital 32<br \/>\nROT &#8211; Analog A0<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DL2108Mk06p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/* \r\n***** Don Luc Electronics \u00a9 *****\r\nSoftware Version Information\r\nProject #19: Time - Adalogger FeatherWing - RTC + SD - Mk05\r\n08-06\r\nDL2108Mk06p.ino\r\n1 x SparkFun Thing Plus - ESP32 WROOM\r\n1 x Adafruit SHARP Memory Display\r\n1 x Adalogger FeatherWing - RTC + SD\r\n1 x CR1220 3V Lithium Coin Cell Battery\r\n1 x 32Gb microSD Card\r\n1 x LED Green\r\n1 x Rocker Switch - SPST (Round)\r\n1 x Terminal Block Breakout FeatherWing\r\n1 x Lithium Ion Battery - 850mAh\r\n1 x GPS Receiver - GP-20U7\r\n1 x Rotary Switch - 10 Position\r\n1 x SparkFun Rotary Switch \u2013 10 Position\r\n1 x Black Knob\r\n1 x Breadboard Solderable\r\n12 x 1K Ohm\r\n1 x Half-Size Breadboard\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ EEPROM Library to Read and Write EEPROM with Unique ID for Unit\r\n#include &quot;EEPROM.h&quot;\r\n\/\/ Wire\r\n\/\/ #include &lt;Wire.h&gt;\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 RTC\r\n#include &quot;RTClib.h&quot;\r\n\/\/ GPS Receiver\r\n#include &lt;TinyGPS++.h&gt;\r\n\/\/ ESP32 Hardware Serial\r\n#include &lt;HardwareSerial.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\r\n\/\/ SHARP Memory Display\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\n\r\n\/\/ Date and Time\r\n\/\/ PCF8523 Precision RTC \r\nRTC_PCF8523 rtc;\r\n\/\/ Date\r\nString dateRTC = &quot;&quot;;\r\n\/\/ Time\r\nString timeRTC = &quot;&quot;;\r\n\r\n\/\/ ESP32 HardwareSerial\r\nHardwareSerial tGPS(2);\r\n\r\n\/\/ GPS Receiver\r\n#define gpsRXPIN 16\r\n\/\/ This one is unused and doesnt have a conection\r\n#define gpsTXPIN 17\r\n\/\/ The TinyGPS++ object\r\nTinyGPSPlus gps;\r\n\/\/ Latitude\r\nfloat TargetLat;\r\n\/\/ Longitude\r\nfloat TargetLon;\r\n\/\/ GPS Date, Time, Speed, Altitude\r\n\/\/ GPS Date\r\nString TargetDat;\r\n\/\/ GPS Time\r\nString TargetTim;\r\n\/\/ GPS Speeds M\/S\r\nString TargetSMS;\r\n\/\/ GPS Speeds Km\/h\r\nString TargetSKH;\r\n\/\/ GPS Altitude Meters\r\nString TargetALT;\r\n\/\/ GPS Status\r\nString GPSSt = &quot;&quot;;\r\n\r\n\/\/ Rotary Switch - 10 Position\r\n\/\/ Number 1 =&gt; 10\r\nint iRotNum = A0;\r\n\/\/ iRotVal - Value \r\nint iRotVal = 0;\r\n\/\/ Number\r\nint z = 0;\r\n\r\n\/\/ MicroSD Card\r\nconst int chipSelect = 33;\r\nString zzzzzz = &quot;&quot;;\r\n\r\n\/\/ LED Green\r\nint iLEDGreen = 21;\r\n\r\n\/\/ Rocker Switch - SPST (Round)\r\nint iSS1 = 32;\r\n\/\/ State\r\nint iSS1State = 0;\r\n\r\n\/\/ Software Version Information\r\n\/\/ EEPROM Unique ID Information\r\n#define EEPROM_SIZE 64\r\nString uid = &quot;&quot;;\r\n\/\/ Version\r\nString sver = &quot;19-05&quot;;\r\n\r\nvoid loop()\r\n{\r\n     \r\n  \/\/ Dates and Time\r\n  isRTC();\r\n\r\n  \/\/ isGPS\r\n  isGPS();\r\n\r\n  \/\/ Rotary Switch\r\n  isRot();\r\n\r\n  \/\/ Slide Switch\r\n  \/\/ Read the state of the iSS1 value\r\n  iSS1State = digitalRead(iSS1);\r\n  \r\n  \/\/ If it is the Slide Switch State is HIGH\r\n  if (iSS1State == HIGH) {\r\n\r\n    \/\/ iLEDGreen HIGH\r\n    digitalWrite(iLEDGreen,  HIGH );\r\n    \r\n    \/\/ MicroSD Card\r\n    isSD();\r\n\r\n  } else {\r\n\r\n    \/\/ iLEDGreen LOW\r\n    digitalWrite(iLEDGreen,  LOW );\r\n  \r\n  }\r\n\r\n  delay( 1000 );\r\n \r\n}\r\n<\/pre>\n<p><strong>getDisplay.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ SHARP Memory Display\r\n\/\/ SHARP Memory Display - UID\r\nvoid isDisplayUID() {\r\n\r\n    \/\/ Text Display \r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    display.setRotation(4);\r\n    display.setTextSize(3);\r\n    display.setTextColor(BLACK);\r\n    \/\/ Don Luc Electronics\r\n    display.setCursor(0,10);\r\n    display.println( &quot;Don Luc&quot; );\r\n    display.setTextSize(2);\r\n    display.setCursor(0,40);\r\n    display.println( &quot;Electronics&quot; );\r\n    \/\/ Version\r\n    \/\/display.setTextSize(3);\r\n    display.setCursor(0,70);\r\n    display.println( &quot;Version&quot; );\r\n    \/\/display.setTextSize(2);\r\n    display.setCursor(0,95);   \r\n    display.println( sver );\r\n    \/\/ EEPROM\r\n    display.setCursor(0,120);\r\n    display.println( &quot;EEPROM&quot; );\r\n    display.setCursor(0,140);   \r\n    display.println( uid );\r\n    \/\/ Refresh\r\n    display.refresh();\r\n    delay( 100 );\r\n    \r\n}\r\n\/\/ Display Date\r\nvoid isDisplayDate() {\r\n\r\n    \/\/ Text Display Date\r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    display.setRotation(4);\r\n    display.setTextSize(2);\r\n    display.setTextColor(BLACK);\r\n    \/\/ Date\r\n    display.setCursor(0,5);\r\n    display.println( &quot;Date&quot; );\r\n    display.setCursor(0,30);\r\n    display.println( dateRTC );\r\n    \/\/ Time\r\n    display.setCursor(0,55);\r\n    display.println( &quot;Time&quot; );\r\n    display.setCursor(0,75);\r\n    display.println( timeRTC );\r\n    \/\/ Refresh\r\n    display.refresh();\r\n    delay( 100 );\r\n\r\n}\r\n\/\/ Display GPS\r\nvoid isDisplayGPS() {\r\n\r\n    \/\/ Text Display Date\r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    display.setRotation(4);\r\n    display.setTextSize(2);\r\n    display.setTextColor(BLACK);\r\n    \/\/ GPS Status\r\n    display.setCursor(0,5);\r\n    display.print( &quot;GPS: &quot; );\r\n    display.println( GPSSt );\r\n    \/\/ Target Latitude\r\n    display.setCursor(0,25);\r\n    display.println( &quot;Latitude&quot; );\r\n    display.setCursor(0,45);\r\n    display.println( TargetLat );\r\n    \/\/ Target Longitude\r\n    display.setCursor(0,65);\r\n    display.println( &quot;Longitude&quot; );\r\n    display.setCursor(0,90);\r\n    display.println( TargetLon );\r\n    \/\/ Refresh\r\n    display.refresh();\r\n    delay( 100 );\r\n\r\n}\r\n\/\/ GPS Date, Time, Speed, Altitude\r\nvoid isDisplayGPSDate() {\r\n\r\n    \/\/ Text Display Date\r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    display.setRotation(4);\r\n    display.setTextSize(2);\r\n    display.setTextColor(BLACK);\r\n    \/\/ GPS\r\n    display.setCursor(0,5);\r\n    display.println( &quot;GPS&quot; );\r\n    \/\/ Date\r\n    display.setCursor(0,30);\r\n    display.println( TargetDat );\r\n    \/\/ Time\r\n    display.setCursor(0,55);\r\n    display.println( TargetTim );\r\n    \/\/ Speed\r\n    display.setCursor(0,75);\r\n    display.print( &quot;M\/S: &quot; );\r\n    display.println( TargetSMS );\r\n    display.setCursor(0,95);\r\n    display.print( &quot;Km\/h: &quot; );\r\n    display.println( TargetSKH );\r\n    display.setCursor(0,115);\r\n    display.print( &quot;Alt: &quot; );\r\n    display.println( TargetALT );\r\n    \/\/ Refresh\r\n    display.refresh();\r\n    delay( 100 );\r\n\r\n}\r\n\/\/ Display Z\r\nvoid isDisplayZ() {\r\n    \/\/ Text Display Z\r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    display.setRotation(4);\r\n    display.setTextSize(3);\r\n    display.setTextColor(BLACK);\r\n    \/\/ Z\r\n    display.setCursor(0,10);\r\n    display.print( &quot;Z: &quot; );\r\n    display.println( z );\r\n    \/\/ Refresh\r\n    display.refresh();\r\n    delay( 100 );\r\n}\r\n<\/pre>\n<p><strong>getEEPROM.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ EEPROM\r\n\/\/ isUID EEPROM Unique ID\r\nvoid isUID()\r\n{\r\n  \r\n  \/\/ Is 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=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ GPS Receiver\r\n\/\/ Setup GPS\r\nvoid setupGPS() {\r\n\r\n  \/\/ Setup GPS\r\n  tGPS.begin(  9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN );\r\n  \r\n}\r\n\/\/ isGPS\r\nvoid isGPS(){\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    \r\n    if (gps.encode( tGPS.read() ))\r\n    {\r\n     \r\n       \/\/ GPS Vector Pointer Target\r\n       displayInfo();\r\n       \/\/ GPS Date, Time, Speed, Altitude\r\n       displayDTS();\r\n       \r\n    }\r\n  \r\n  if (millis() &gt; 5000 &amp;&amp; gps.charsProcessed() &lt; 10)\r\n  {\r\n   \r\n     while(true);\r\n    \r\n  }\r\n\r\n}\r\n\/\/ GPS Vector Pointer Target\r\nvoid displayInfo(){\r\n\r\n  \/\/ Location\r\n  if (gps.location.isValid())\r\n  {\r\n    \r\n     \/\/ Latitude\r\n     TargetLat = gps.location.lat();\r\n     \/\/ Longitude\r\n     TargetLon = gps.location.lng();\r\n     \/\/ GPS Status 2\r\n     GPSSt = &quot;Yes&quot;;\r\n    \r\n  }\r\n  else\r\n  {\r\n\r\n     \/\/ GPS Status 0\r\n     GPSSt = &quot;No&quot;;\r\n    \r\n  }\r\n\r\n}\r\n\/\/ GPS Date, Time, Speed, Altitude\r\nvoid displayDTS(){\r\n\r\n  \/\/ Date\r\n  TargetDat = &quot;&quot;; \r\n  if (gps.date.isValid())\r\n  {\r\n    \r\n     \/\/ Date\r\n     \/\/ Year\r\n     TargetDat += String(gps.date.year(), DEC);\r\n     TargetDat += &quot;\/&quot;;\r\n     \/\/ Month\r\n     TargetDat += String(gps.date.month(), DEC);\r\n     TargetDat += &quot;\/&quot;;\r\n     \/\/ Day\r\n     TargetDat += String(gps.date.day(), DEC);\r\n    \r\n  }\r\n\r\n  \/\/ Time\r\n  TargetTim = &quot;&quot;;\r\n  if (gps.time.isValid())\r\n  {\r\n    \r\n     \/\/ Time\r\n     \/\/ Hour\r\n     TargetTim += String(gps.time.hour(), DEC);\r\n     TargetTim += &quot;:&quot;;\r\n     \/\/ Minute\r\n     TargetTim += String(gps.time.minute(), DEC);\r\n     TargetTim += &quot;:&quot;;\r\n     \/\/ Secound\r\n     TargetTim += String(gps.time.second(), DEC);\r\n    \r\n  }\r\n\r\n  \/\/ Speed\r\n  TargetSMS = &quot;&quot;;\r\n  TargetSKH = &quot;&quot;;\r\n  if (gps.speed.isValid())\r\n  {\r\n    \r\n     \/\/ Speed\r\n     \/\/ M\/S\r\n     int x = gps.speed.mps();\r\n     TargetSMS = String( x, DEC);\r\n     \/\/ Km\/h\r\n     int y = gps.speed.kmph();\r\n     TargetSKH = String( y, DEC);\r\n\r\n  }\r\n\r\n  \/\/ Altitude\r\n  TargetALT = &quot;&quot;;\r\n  if (gps.altitude.isValid())\r\n  {\r\n    \r\n     \/\/ Altitude\r\n     \/\/ Meters\r\n     int z = gps.altitude.meters();\r\n     TargetALT = String( z, DEC);\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\/\/ PCF8523 Precision RTC\r\nvoid setupRTC() {\r\n\r\n  \/\/ Date &amp; Time\r\n  \/\/ pcf8523 Precision RTC   \r\n  if (! rtc.begin()) {\r\n    while (1);\r\n  }  \r\n  \r\n  if (! rtc.initialized()) {\r\n    \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(2014, 1, 21, 3, 0, 0));\r\n    \/\/ rtc.adjust(DateTime(2021, 8, 16, 12, 27, 0));\r\n    \r\n  }\r\n  \r\n}\r\n\/\/ Date and Time RTC PCF8523\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  \/\/ Year\r\n  dateRTC = now.year(), DEC; \r\n  dateRTC = dateRTC + &quot;\/&quot;;\r\n  \/\/ Month\r\n  dateRTC = dateRTC + now.month(), DEC;\r\n  dateRTC = dateRTC + &quot;\/&quot;;\r\n  \/\/ Day\r\n  dateRTC = dateRTC + now.day(), DEC;\r\n  \r\n  \/\/ Time\r\n  \/\/ Hour\r\n  timeRTC = now.hour(), DEC;\r\n  timeRTC = timeRTC + &quot;:&quot;;\r\n  \/\/ Minute\r\n  timeRTC = timeRTC + now.minute(), DEC;\r\n  timeRTC = timeRTC + &quot;:&quot;;\r\n  \/\/ Second\r\n  timeRTC = timeRTC + now.second(), DEC;\r\n  \r\n}\r\n<\/pre>\n<p><strong>getRot.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Rotary Switch\r\n\/\/ isRot - iRotVal - Value\r\nvoid isRot() {\r\n  \r\n  \/\/ Rotary Switch\r\n  z = analogRead( iRotNum );\r\n  \r\n  \/\/ Rotary Switch - 10 Position\r\n  \/\/ Number 1 =&gt; 10\r\n  if ( z &gt;= 3500 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 10;\r\n    \r\n  } else if ( z &gt;= 3000 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 9;\r\n    \r\n  } else if ( z &gt;= 2600 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 8;\r\n    \r\n  } else if ( z &gt;= 2300 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 7;\r\n    \r\n  } else if ( z &gt;= 1900 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 6;\r\n    \r\n  } else if ( z &gt;= 1500 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 5;\r\n    \r\n  } else if ( z &gt;= 1200 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 4;\r\n    \r\n  } else if ( z &gt;= 800 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 3;\r\n    \r\n  } else if ( z &gt;= 400 ) {\r\n\r\n    \/\/ Z\r\n    iRotVal = 2;\r\n    \r\n  } else {\r\n\r\n    \/\/ Z\r\n    iRotVal = 1;\r\n    \r\n  }\r\n\r\n  \/\/ Range Value\r\n  switch ( iRotVal ) {\r\n    case 1:\r\n\r\n      \/\/ Display Date, Time\r\n      isDisplayDate();\r\n       \r\n      break;\r\n    case 2:\r\n\r\n      \/\/ Display GPS\r\n      isDisplayGPS();\r\n         \r\n      break;\r\n    case 3:\r\n\r\n      \/\/ GPS Date, Time, Speed, Altitude\r\n      \/\/isDisplayGPSDate();\r\n      \r\n      break;  \r\n    case 4:\r\n      \r\n      \/\/ GPS Display Date, Time, Speed\r\n      isDisplayGPSDate();\r\n      \r\n      break;\r\n    case 5:\r\n      \r\n      \/\/ Z\r\n      isDisplayZ();\r\n      \r\n      break;\r\n    case 6:\r\n      \r\n      \/\/ Z\r\n      isDisplayZ();\r\n      \r\n      break;       \r\n    case 7:\r\n\r\n      \/\/ Z\r\n      isDisplayZ();\r\n      \r\n      break; \r\n    case 8:\r\n         \r\n      \/\/ Z\r\n      isDisplayZ();\r\n      \r\n      break; \r\n    case 9:\r\n      \r\n      \/\/ Z\r\n      isDisplayZ();\r\n      \r\n      break;\r\n    case 10:\r\n\r\n      \/\/ Z\r\n      isDisplayZ();\r\n      \r\n      break;\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getSD.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ MicroSD Card\r\n\/\/ MicroSD Setup\r\nvoid setupSD() {\r\n\r\n    \/\/ MicroSD Card\r\n    pinMode( chipSelect , OUTPUT );\r\n    if(!SD.begin( chipSelect )){\r\n        ;  \r\n        return;\r\n    }\r\n    \r\n    uint8_t cardType = SD.cardType();\r\n\r\n    \/\/ CARD NONE\r\n    if(cardType == CARD_NONE){\r\n        ; \r\n        return;\r\n    }\r\n\r\n    \/\/ SD Card Type\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    \/\/ Size\r\n    uint64_t cardSize = SD.cardSize() \/ (1024 * 1024);\r\n \r\n}\r\n\/\/ MicroSD Card\r\nvoid isSD() {\r\n\r\n  zzzzzz = &quot;&quot;;\r\n\r\n  \/\/ EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M\/S|GPS Speed Km\/h|GPS Altitude|\\r\r\n  zzzzzz = uid + &quot;|&quot; + sver + &quot;|&quot; + dateRTC + &quot;|&quot; + timeRTC + &quot;|&quot; + GPSSt + &quot;|&quot; + TargetLat + &quot;|&quot; + TargetLon + &quot;|&quot; + TargetDat + &quot;|&quot; + TargetTim + &quot;|&quot; + TargetSMS + &quot;|&quot; + TargetSKH + &quot;|&quot; + TargetALT + &quot;|\\r&quot;;\r\n\r\n  \/\/ msg + 1\r\n  char msg[zzzzzz.length() + 1];\r\n\r\n  zzzzzz.toCharArray(msg, zzzzzz.length() + 1);\r\n\r\n  \/\/ Append File\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    \r\n    \/\/ List Dir\r\n    dirname;\r\n    \r\n    File root = fs.open(dirname);\r\n    \r\n    if(!root){\r\n        return;\r\n    }\r\n    \r\n    if(!root.isDirectory()){\r\n        return;\r\n    }\r\n\r\n    File file = root.openNextFile();\r\n    \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}\r\n\/\/ Write File\r\nvoid writeFile(fs::FS &amp;fs, const char * path, const char * message){\r\n    \r\n    \/\/ Write File\r\n    path;\r\n    \r\n    File file = fs.open(path, FILE_WRITE);\r\n    \r\n    if(!file){\r\n        return;\r\n    }\r\n    \r\n    if(file.print(message)){\r\n        ;  \r\n    } else {\r\n        ;  \r\n    }\r\n    \r\n    file.close();\r\n    \r\n}\r\n\/\/ Append File\r\nvoid appendFile(fs::FS &amp;fs, const char * path, const char * message){\r\n    \r\n    \/\/ Append File\r\n    path;\r\n    \r\n    File file = fs.open(path, FILE_APPEND);\r\n    \r\n    if(!file){\r\n        return;\r\n    }\r\n    \r\n    if(file.print(message)){\r\n        ;  \r\n    } else {\r\n        ;  \r\n    }\r\n    \r\n    file.close();\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  \/\/ EEPROM Size\r\n  EEPROM.begin(EEPROM_SIZE);\r\n  \r\n  \/\/ EEPROM Unique ID\r\n  isUID();\r\n  \r\n  \/\/ GPS Receiver\r\n  \/\/ Setup GPS\r\n  setupGPS();\r\n\r\n  \/\/ Set up I2C bus\r\n  \/\/ Wire.begin();\r\n\r\n  \/\/ SHARP Display Start &amp; Clear the Display\r\n  display.begin();\r\n  \/\/ Clear Display\r\n  display.clearDisplay();\r\n\r\n  \/\/ Date &amp; Time RTC\r\n  \/\/ PCF8523 Precision RTC\r\n  isDisplayUID();\r\n  \r\n  \/\/ Setup RTC\r\n  setupRTC();\r\n\r\n  \/\/MicroSD Card\r\n  setupSD();\r\n\r\n  \/\/ Initialize the LED Green\r\n  pinMode(iLEDGreen, OUTPUT);\r\n\r\n  \/\/ Slide Switch\r\n  pinMode(iSS1, INPUT);\r\n\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>Technology Experience<\/strong><\/p>\n<ul>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Robotics<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<li>Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc&#8230;)<\/li>\n<li>Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc&#8230;)<\/li>\n<li>Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc&#8230;)<\/li>\n<li>Social Media Programming &#038; Integration (Facebook, Twitter, YouTube, Pinterest, etc&#8230;)<\/li>\n<li>Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc&#8230;)<\/li>\n<li>Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc&#8230;)<\/li>\n<li>eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc&#8230;)<\/li>\n<\/ul>\n<p><strong>Instructor<\/strong><\/p>\n<ul>\n<li>PIC Microcontrollers<\/li>\n<li>Arduino<\/li>\n<li>Raspberry Pi<\/li>\n<li>Espressif<\/li>\n<li>Robotics<\/li>\n<li>DOS, Windows, OSX, Linux, iOS, Android, Multi-OS<\/li>\n<li>Linux-Apache-PHP-MySQL<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>J. Luc Paquin \u2013 Curriculum Vitae &#8211; 2021 English &#038; Espa\u00f1ol<\/strong><br \/>\nhttps:\/\/www.jlpconsultants.com\/CV\/LucPaquinCVEngMk2021c.pdf<br \/>\nhttps:\/\/www.jlpconsultants.com\/CV\/LucPaquinCVEspMk2021c.pdf<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.jlpconsultants.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.donluc.com\/DLE\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.donluc.com\/DLHackster\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.hackster.io\/neosteam-labs<br \/>\n<strong>Web:<\/strong> https:\/\/zoom.us\/<br \/>\n<strong>Patreon:<\/strong> https:\/\/www.patreon.com\/DonLucElectronics<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<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 #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Adalogger FeatherWing &#8211; RTC + SD A Feather board without ambition is a Feather board without FeatherWings. This is the Adalogger FeatherWing: it adds both a battery-backed Real Time Clock and MicroSD &#8230; <a title=\"Project #19: Time &#8211; Adalogger FeatherWing &#8211; RTC + SD &#8211; Mk05\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=2798\" aria-label=\"Read more about Project #19: Time &#8211; Adalogger FeatherWing &#8211; RTC + SD &#8211; Mk05\">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":[166,47,49,38,80,59,5,138,82,10,43],"tags":[86,170,6,92,102,4,87,19,83,85,89,24,9,84,27,109,33,34],"class_list":["post-2798","post","type-post","status-publish","format-standard","hentry","category-time","category-adafruit","category-consultant","category-digitalelectronics","category-esp32","category-fritzing","category-microcontrollers","category-patreon","category-program-esp32","category-projects","category-sparkfun","tag-adafruit","tag-adalogger-featherwing","tag-arduino","tag-battery","tag-components","tag-consultant","tag-display","tag-electronics","tag-esp32","tag-fritzing","tag-gps-receiver","tag-microcontroller","tag-programming","tag-programming-esp32","tag-projects-2","tag-sparkfun","tag-technology","tag-video-blog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2798","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=2798"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2798\/revisions"}],"predecessor-version":[{"id":2804,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2798\/revisions\/2804"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}