{"id":3977,"date":"2024-06-24T08:53:27","date_gmt":"2024-06-24T15:53:27","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3977"},"modified":"2024-06-24T08:53:27","modified_gmt":"2024-06-24T15:53:27","slug":"project-29-dfrobot-hmc5883l-mk17","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3977","title":{"rendered":"Project #29 &#8211; DFRobot &#8211; HMC5883L &#8211; Mk17"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3977-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #DFRobot #HMC5883L #ADXL335 #GPS #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #SparkFun #ESP32 #IoT #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\/06\/DL2406Mk04a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04a.png\" alt=\"HMC5883L\" width=\"720\" height=\"533\" class=\"alignnone size-full wp-image-3979\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04a-300x222.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\/06\/DL2406Mk04b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04b.png\" alt=\"HMC5883L\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3980\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04b-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\/06\/DL2406Mk04c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04c.png\" alt=\"HMC5883L\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3981\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/06\/DL2406Mk04c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>SparkFun Triple Axis Magnetometer Breakout &#8211; HMC5883L<\/strong><\/p>\n<p>This is a breakout board for Honeywell&#8217;s HMC5883L, a 3-axis digital compass. Communication with the HMC5883L is simple and all done through an I2C interface. There is no on-board regulator, so a regulated voltage of 2.16-3.6VDC should be supplied. The breakout board includes the HMC5883L sensor and all filtering capacitors as shown. The power and 2-wire interface pins are all broken out to a 0.1 inch pitch header.<\/p>\n<p><strong>DL2406Mk04<\/strong><\/p>\n<p>1 x DFRobot FireBeetle 2 ESP32-E<br \/>\n1 x Adafruit SHARP Memory Display<br \/>\n1 x Adafruit MicroSD card breakout board+<br \/>\n1 x MicroSD 16 GB<br \/>\n1 x SparkFun Triple Axis Accelerometer ADXL335<br \/>\n1 x SparkFun Triple Axis Magnetometer HMC5883L<br \/>\n1 x GPS Receiver &#8211; GP-20U7<br \/>\n2 x Switch<br \/>\n1 x 1K Ohm<br \/>\n1 x 1 x Lithium Ion Battery &#8211; 1000mAh<br \/>\n1 x Green LED<br \/>\n1 x USB 3.1 Cable A to C<\/p>\n<p><strong>DFRobot FireBeetle 2 ESP32-E<\/strong><\/p>\n<p>LED &#8211; 2<br \/>\nDSCK &#8211; 4<br \/>\nDMOSI &#8211; 16<br \/>\nDSS &#8211; 17<br \/>\nSCK &#8211; 22<br \/>\nMOSI &#8211; 23<br \/>\nMISO &#8211; 19<br \/>\nCS &#8211; 13<br \/>\nGPR &#8211; 26<br \/>\nGPT &#8211; 25<br \/>\nSCL &#8211; 21<br \/>\nSDA &#8211; 22<br \/>\nLED &#8211; 14<br \/>\nSWI &#8211; 3<br \/>\nXAC &#8211; A0<br \/>\nYAC &#8211; A1<br \/>\nZAC &#8211; A2<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2406Mk04p.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 #29 - DFRobot - HMC5883L - Mk17\r\n29-17\r\nDL2406Mk04p.ino\r\nDL2406Mk04\r\n1 x DFRobot FireBeetle 2 ESP32-E\r\n1 x Adafruit SHARP Memory Display\r\n1 x Adafruit MicroSD card breakout board+\r\n1 x MicroSD 16 GB\r\n1 x SparkFun Triple Axis Magnetometer HMC5883L\r\n1 x SparkFun Triple Axis Accelerometer ADXL335\r\n1 x GPS Receiver - GP-20U7\r\n2 x Switch\r\n1 x 1K Ohm\r\n1 x 1 x Lithium Ion Battery - 1000mAh\r\n1 x Green LED\r\n1 x USB 3.1 Cable A to C\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ EEPROM Library to Read and Write EEPROM\r\n\/\/ with Unique ID for Unit\r\n#include &quot;EEPROM.h&quot;\r\n\/\/ Wire\r\n#include &lt;Wire.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\/\/ SHARP Memory Display\r\n#include &lt;Adafruit_SharpMem.h&gt;\r\n#include &lt;Adafruit_GFX.h&gt;\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\/\/ Triple Axis Magnetometer\r\n#include &lt;HMC5883L.h&gt;\r\n\r\n\/\/ Triple Axis Magnetometer\r\nHMC5883L compass;\r\n\/\/ Triple Axis Magnetometer\r\nint mX = 0;\r\nint mY = 0;\r\nint mZ = 0;\r\n\r\n\/\/ Accelerometer ADXL335\r\nint iX = A0;\r\nint iY = A1;\r\nint iZ = A2;\r\n\/\/ Accelerometer\r\nint X = 0;\r\nint Y = 0;\r\nint Z = 0;\r\n\r\n\/\/ ESP32 HardwareSerial\r\nHardwareSerial tGPS(2);\r\n\r\n\/\/ GPS Receiver\r\n#define gpsRXPIN 26\r\n\/\/ This one is unused and doesnt have a conection\r\n#define gpsTXPIN 25\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\/\/ MicroSD Card\r\nconst int chipSelect = 13;\r\nString zzzzzz = &quot;&quot;;\r\n\r\n\/\/ SHARP Memory Display\r\n#define SHARP_SCK  4\r\n#define SHARP_MOSI 16\r\n#define SHARP_SS   17\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\/\/ LED Green\r\nint iLEDGreen = 2;\r\n\r\n\/\/ Define LED\r\nint iLED = 14;\r\n\r\n\/\/ Switch\r\nint iSwitch = 3;\r\n\/\/ Variable for reading the Switch status\r\nint iSwitchState = 0;\r\n\r\n\/\/ EEPROM Unique ID Information\r\n#define EEPROM_SIZE 64\r\nString uid = &quot;&quot;;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;29-17&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ isGPS\r\n  isGPS();\r\n\r\n  \/\/ Accelerometer ADXL335\r\n  isADXL335();\r\n\r\n  \/\/ Magnetometer\r\n  isMagnetometer();\r\n\r\n  \/\/ Read the state of the Switch value\r\n  iSwitchState = digitalRead(iSwitch);\r\n  \r\n  \/\/ The Switch is HIGH:\r\n  if (iSwitchState == HIGH) {\r\n\r\n    \/\/ Display Accelerometer ADXL335\r\n    isDisplayADXL335();\r\n  \r\n  } else {\r\n\r\n    \/\/ Display GPS\r\n    isDisplayGPS();\r\n    \r\n  }  \r\n\r\n  \/\/ MicroSD Card\r\n  isSD();\r\n\r\n  \/\/ iLED HIGH\r\n  digitalWrite(iLED, HIGH );\r\n\r\n  \/\/ Delay 5 Second\r\n  delay(5000);\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 ADXL335\r\n\/\/ ADXL335\r\nvoid isADXL335() {\r\n\r\n  \/\/ Accelerometer ADXL335\r\n  \/\/ Accelerometer X, Y, Z\r\n  \/\/ X\r\n  X = analogRead(iX);\r\n  \/\/ Y\r\n  Y = analogRead(iY);\r\n  \/\/ Z\r\n  Z = analogRead(iZ);\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 Accelerometer ADXL335\r\nvoid isDisplayADXL335() {\r\n\r\n    \/\/ Text Display\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    \/\/ Accelerometer X\r\n    display.setCursor(0,5);\r\n    display.print( &quot;AX: &quot; );\r\n    display.println( X );\r\n    \/\/ Accelerometer Y\r\n    display.setCursor(0,30);\r\n    display.print( &quot;AY: &quot; );\r\n    display.println( Y );\r\n    \/\/ Accelerometer Z\r\n    display.setCursor(0,55);\r\n    display.print( &quot;AZ: &quot; );\r\n    display.println( Z );\r\n    \/\/ Magnetometer X\r\n    display.setCursor(0,80);\r\n    display.print( &quot;MX: &quot; );\r\n    display.println( mX );\r\n    \/\/ Magnetometer Y\r\n    display.setCursor(0,105);\r\n    display.print( &quot;MY: &quot; );\r\n    display.println( mY );\r\n    \/\/ Magnetometer Z\r\n    display.setCursor(0,130);\r\n    display.print( &quot;MZ: &quot; );\r\n    display.println( mZ );\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    \/\/ Latitude\r\n    display.setCursor(0,5);\r\n    display.print( &quot;Lat: &quot; );\r\n    display.println( TargetLat );\r\n    \/\/ Longitude\r\n    display.setCursor(0,30);\r\n    display.print( &quot;Lon: &quot; );\r\n    display.println( TargetLon );\r\n    \/\/ GPS Date\r\n    display.setCursor(0,55);\r\n    display.println( TargetDat );\r\n    \/\/ GPS Time\r\n    display.setCursor(0,80);\r\n    display.println( TargetTim );\r\n    \/\/ GPS Speed M\/S\r\n    display.setCursor(0,105);\r\n    display.print( TargetSMS );\r\n    display.println( &quot; M\/S&quot; );\r\n    \/\/ GPS Altitude Meters\r\n    display.setCursor(0,130);\r\n    display.print( TargetALT );\r\n    display.println( &quot; M&quot; );\r\n    \/\/ Refresh\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=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ EEPROM\r\n\/\/ isUID EEPROM Unique ID\r\nvoid isUID() {\r\n  \r\n  \/\/ Is Unit ID\r\n  uid = &quot;&quot;;\r\n  for (int x = 0; x &lt; 7; 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 isSetupGPS() {\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>getMagnetometer.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Magnetometer\r\n\/\/ Setup Magnetometer\r\nvoid isSetupMagnetometer(){\r\n\r\n  \/\/ Magnetometer Serial\r\n  \/\/ Initialize HMC5883L\r\n  while (!compass.begin())\r\n  {\r\n    delay(500);\r\n  }\r\n\r\n  \/\/ Set measurement range\r\n  \/\/ +\/- 1.30 Ga: HMC5883L_RANGE_1_3GA (default)\r\n  compass.setRange(HMC5883L_RANGE_1_3GA);\r\n\r\n  \/\/ Set measurement mode\r\n  \/\/ Continuous-Measurement: HMC5883L_CONTINOUS (default)\r\n  compass.setMeasurementMode(HMC5883L_CONTINOUS);\r\n \r\n  \/\/ Set data rate\r\n  \/\/ 15.00Hz: HMC5883L_DATARATE_15HZ (default)\r\n  compass.setDataRate(HMC5883L_DATARATE_15HZ);\r\n\r\n  \/\/ Set number of samples averaged\r\n  \/\/ 1 sample:  HMC5883L_SAMPLES_1 (default)\r\n  compass.setSamples(HMC5883L_SAMPLES_1);\r\n  \r\n}\r\n\/\/ Magnetometer\r\nvoid isMagnetometer(){\r\n\r\n  \/\/ Magnetometer Vector Norm\r\n  Vector norm = compass.readNormalize();\r\n  \/\/ Vector X, Y, Z\r\n  \/\/ Magnetometer X Normalize\r\n  mX = norm.XAxis;\r\n  \/\/ Magnetometer Y Normalize\r\n  mY = norm.YAxis;\r\n  \/\/ Magnetometer Z Normalize\r\n  mZ = norm.ZAxis;\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 isSetupSD() {\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  \/\/ DFR|EEPROM Unique ID|Version|Date|Time|\r\n  \/\/Accelerometer X|Accelerometer Y|Accelerometer Z\r\n  \/\/Magnetometer X|Magnetometer Y|Magnetometer Z\r\n  \/\/|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M\/S|GPS Altitude|*\\r\r\n  zzzzzz = &quot;DFR|&quot; + uid + &quot;|&quot; + sver + &quot;|&quot;\r\n  + String(X) + &quot;|&quot; + String(Y) + &quot;|&quot; + String(Z) + &quot;|&quot;\r\n  + String(mX) + &quot;|&quot; + String(mY) + &quot;|&quot; + String(mZ) + &quot;|&quot;\r\n  + String(GPSSt) + &quot;|&quot; + String(TargetLat) + &quot;|&quot; \r\n  + String(TargetLon) + &quot;|&quot; + String(TargetDat) + &quot;|&quot; + String(TargetTim) + &quot;|&quot; \r\n  + String(TargetSMS) + &quot;|&quot; + String(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;\/dfrdata.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  \/\/ Give display time to power on\r\n  delay(100);\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  \/\/ Give display\r\n  delay(100);\r\n\r\n  \/\/ Set up I2C bus\r\n  Wire.begin();\r\n\r\n  \/\/ Give display\r\n  delay(100);\r\n\r\n  \/\/MicroSD Card\r\n  isSetupSD();\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  \/\/ Delay\r\n  delay( 100 );\r\n\r\n  \/\/ GPS Receiver\r\n  \/\/ Setup GPS\r\n  isSetupGPS();\r\n\r\n  \/\/ Delay\r\n  delay( 100 );\r\n\r\n  \/\/ Setup Triple Axis Magnetometer\r\n  isSetupMagnetometer();\r\n\r\n  \/\/ Delay\r\n  delay( 100 );\r\n\r\n  \/\/ Initialize digital pin iLED as an output\r\n  pinMode(iLED, OUTPUT);\r\n\r\n  \/\/ Outputting high, the LED turns on\r\n  digitalWrite(iLED, HIGH);\r\n\r\n  \/\/ Initialize the LED Green\r\n  pinMode(iLEDGreen, OUTPUT);\r\n\r\n  \/\/ iLEDGreen HIGH\r\n  digitalWrite(iLEDGreen, HIGH );\r\n\r\n  \/\/ Initialize the Switch\r\n  pinMode(iSwitch, INPUT);\r\n\r\n  \/\/ Don Luc Electronics\r\n  \/\/ Version\r\n  \/\/ EEPROM\r\n  isDisplayUID();\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>Sensors, 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\/<br \/>\n<strong>LinkedIn:<\/strong> https:\/\/www.linkedin.com\/in\/jlucpaquin\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #DFRobot #HMC5883L #ADXL335 #GPS #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #SparkFun #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; SparkFun Triple Axis Magnetometer Breakout &#8211; HMC5883L This is a breakout board for Honeywell&#8217;s HMC5883L, a 3-axis digital compass. Communication with the HMC5883L is simple and all done through &#8230; <a title=\"Project #29 &#8211; DFRobot &#8211; HMC5883L &#8211; Mk17\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3977\" aria-label=\"Read more about Project #29 &#8211; DFRobot &#8211; HMC5883L &#8211; Mk17\">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":[318,47,50,49,317,38,80,59,115,5,287,58,10,43],"tags":[251,86,6,92,102,4,320,87,19,83,85,338,246,24,9,84,27,109,33,34,108],"class_list":["post-3977","post","type-post","status-publish","format-standard","hentry","category-ddfrobot","category-adafruit","category-arduino","category-consultant","category-dfrobot","category-digitalelectronics","category-esp32","category-fritzing","category-e-mentor","category-microcontrollers","category-program","category-arduino-programming","category-projects","category-sparkfun","tag-accelerometer","tag-adafruit","tag-arduino","tag-battery","tag-components","tag-consultant","tag-dfrobot","tag-display","tag-electronics","tag-esp32","tag-fritzing","tag-hmc5883l","tag-magnetometer","tag-microcontroller","tag-programming","tag-programming-esp32","tag-projects-2","tag-sparkfun","tag-technology","tag-video-blog","tag-vlog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3977","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=3977"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3977\/revisions"}],"predecessor-version":[{"id":3982,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3977\/revisions\/3982"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}