{"id":4283,"date":"2025-01-29T09:05:37","date_gmt":"2025-01-29T17:05:37","guid":{"rendered":"https:\/\/www.donluc.com\/?p=4283"},"modified":"2025-01-29T09:05:37","modified_gmt":"2025-01-29T17:05:37","slug":"project-25-movement-eeprom-mk09","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=4283","title":{"rendered":"Project #25 &#8211; Movement &#8211; EEPROM &#8211; Mk09"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-4283-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #EEPROM #HMC5883L #Compass #ADXL345 #Accelerometer #Movement #ESP32 #Bluetooth #Elecrow #DFRobot #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07a.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07a.jpg\" alt=\"EEPROM\" width=\"720\" height=\"642\" class=\"alignnone size-full wp-image-4285\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07a.jpg 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07a-300x268.jpg 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\/2025\/01\/DL2501Mk07b.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07b.jpg\" alt=\"EEPROM\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-4286\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07b.jpg 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07b-300x200.jpg 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\/2025\/01\/DL2501Mk07c.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07c.jpg\" alt=\"EEPROM\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-4287\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07c.jpg 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/01\/DL2501Mk07c-300x200.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>EEPROM<\/strong><\/p>\n<p>EEPROM (Electrically Erasable Programmable Read-only Memory) is a type of non-volatile memory. EEPROM is a type of non-volatile ROM that enables individual bytes of data to be erased and reprogrammed. That is why EEPROM chips are known as byte erasable chips. EEPROM is usually used to store small amounts of data in computing and other electronic devices. It is used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a separate chip device, to store relatively small amounts of data by allowing individual bytes to be erased and reprogrammed.<\/p>\n<p>The microcontroller on the Arduino boards have 512 bytes of EEPROM: memory whose values are kept when the board is turned off. Functions in the EEPROM class are automatically included with the platform for your board, meaning you do not need to install any external libraries. The supported microcontrollers on the various Arduino have different amounts of EEPROM: 1024 bytes on the ATmega328P, 512 bytes on the ATmega168 and ATmega8, 4 KB (4096 bytes) on the ATmega1280 and ATmega2560. The Arduino boards have an emulated EEPROM space of 1024 bytes. The EEPROM library on ESP32 provides a reliable way to store data persistently, so that it remains accessible even when the power supply is disconnected. Unlike RAM, the data we save with the EEPROM library does not get lost when power is cut. This feature makes it an ideal choice for retaining configurations, settings, and other important data in embedded devices like the ESP32.<\/p>\n<p><strong>DL2501Mk07<\/strong><\/p>\n<p>1 x DFRobot FireBeetle 2 ESP32-E<br \/>\n1 x Fermion: 2.0&#8243; 320&#215;240 IPS TFT LCD<br \/>\n1 x GDL Line 10 CM<br \/>\n1 x Crowtail &#8211; I2C Hub 2.0<br \/>\n1 x Crowtail &#8211; 3-Axis Digital Compass<br \/>\n1 x Crowtail &#8211; 3-Axis Digital Accelerometer<br \/>\n1 x Lithium Ion Battery &#8211; 1000mAh<br \/>\n1 x Switch<br \/>\n1 x Bluetooth Serial Terminal<br \/>\n1 x USB 3.1 Cable A to C<\/p>\n<p><strong>FireBeetle 2 ESP32-E<\/strong><\/p>\n<p>SCL &#8211; 22<br \/>\nSDA &#8211; 21<br \/>\nDC &#8211; D2<br \/>\nCS &#8211; D6<br \/>\nRST &#8211; D3<br \/>\nRX2 &#8211; Bluetooth<br \/>\nTX2 &#8211; Bluetooth<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DLE-EEPROM-UID-ESP32Mk001<\/strong><\/p>\n<p><strong>DLE-EEPROM-UID-ESP32Mk001.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\nDLE-EEPROM-UID-ESP32Mk001\r\nver: ESPMk001\r\nEEPROM with unique ID\r\n*\/\r\n\r\n\/\/ Include 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\r\n\/\/ The current address in the EEPROM (i.e. which byte\r\n\/\/ we&#039;re going to write to next)\r\n#define EEPROM_SIZE 64\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;ESPMk001&quot;;\r\n\/\/ Unit ID information\r\nString uid = &quot;DLE0001&quot;; \r\n\/\/ Read Unique ID\r\n\/\/ String ruid = &quot;&quot;;\r\n\r\nvoid loop() \r\n{\r\n\r\n   \/\/ &lt;== Write and Read EEPROM \r\n   isEEPROMw();\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\/\/ getEEPROM\r\n\/\/ Write and Read EEPROM with Unique ID for Unit\r\nvoid isEEPROMw() {\r\n  \r\n  \/\/ EEPROM\r\n  int incb = 0;\r\n  int v = 0;\r\n  String msg = &quot;&quot;;\r\n  String emp = &quot;&quot;;\r\n  String ruid = &quot;&quot;;\r\n  \r\n  \/\/ Set Unit ID\r\n  \/\/ The message starts with sid then is followed by 5 characters \r\n  \/\/ First clear a string buffer\r\n  emp = &quot;&quot;;\r\n  \/\/ Loop through the 7 ID characters and write their ASCII (byte) value to the EEPROM\r\n  for (int x = 0; x &lt; 7; x++)\r\n    {\r\n       \/\/ Get ASCII value of character\r\n       v = int(uid.charAt(x)); \/\/ + 5));\r\n       \/\/ Add the actual character to the buffer so we can send it back to the PC\r\n       emp = emp + uid.charAt(x + 5);\r\n       \/\/ Write the value to the EEPROM\r\n       EEPROM.write(x, v);\r\n       EEPROM.commit();\r\n    }\r\n\r\n   delay( 500 );\r\n\r\n   \/\/ Write EEPROM with Unique ID for Unit\r\n   Serial.println( &quot;Write ID Information&quot;);\r\n\r\n  \/\/ Read ID Information\r\n  \/\/ Unit ID\r\n  for (int y = 0; y &lt; 7; y++)\r\n  {\r\n    \r\n    ruid = ruid + char(EEPROM.read(y));\r\n    \r\n  }\r\n  \r\n  \/\/ Read ID Information\r\n  Serial.print( &quot;Read ID Information: &quot;);\r\n  Serial.println( ruid );\r\n  Serial.println( &quot;Ok!&quot; );\r\n  ruid = &quot;&quot;;\r\n\r\n  delay( 5000 );\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 with unique ID\r\n  EEPROM.begin(EEPROM_SIZE);\r\n\r\n  \/\/ Open the serial port at 9600 bps:\r\n  Serial.begin(9600);\r\n\r\n  \/\/ Serial\r\n  Serial.print( &quot;Software Version Information: &quot;);\r\n  Serial.println( sver );\r\n  Serial.print( &quot;Unit ID Information: &quot;);\r\n  Serial.println( uid );\r\n  \r\n  delay(5000);\r\n   \r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2501Mk07p<\/strong><\/p>\n<p><strong>DL2501Mk07p.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 #25 - Movement - EEPROM - Mk09\r\n25-09\r\nDL2501Mk07p.ino\r\nDL2501Mk07\r\n1 x DFRobot FireBeetle 2 ESP32-E\r\n1 x Fermion: 2.0&quot; 320x240 IPS TFT LCD\r\n1 x GDL Line 10 CM\r\n1 x Crowtail - I2C Hub 2.0\r\n1 x Crowtail - 3-Axis Digital Compass\r\n1 x Crowtail - 3-Axis Digital Accelerometer\r\n1 x Lithium Ion Battery - 1000mAh\r\n1 x Switch\r\n1 x Bluetooth Serial Terminal\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\/\/ Arduino\r\n#include &lt;Arduino.h&gt;\r\n\/\/ Wire\r\n#include &lt;Wire.h&gt;\r\n\/\/ DFRobot Display GDL API\r\n#include &lt;DFRobot_GDL.h&gt;\r\n\/\/ Bluetooth Serial\r\n#include &quot;BluetoothSerial.h&quot;\r\n#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)\r\n#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it\r\n#endif\r\n\/\/ Accelemeter ADXL345\r\n#include &lt;ADXL345.h&gt;\r\n\/\/ Compass HMC5883L\r\n#include &lt;HMC5883L.h&gt;\r\n\r\n\/\/ Compass HMC5883L\r\nHMC5883L compass;\r\n\/\/ Heading\r\nfloat heading;\r\n\/\/ Heading Degrees\r\nfloat headingDegrees;\r\n\r\n\/\/ Variable ADXL345 library\r\nADXL345 adxl;\r\n\/\/ Accelerometer ADXL345\r\n\/\/ x, y, z\r\nint x;\r\nint y;\r\nint z;\r\n\/\/ Standard Gravity\r\n\/\/ xyz\r\ndouble xyz[3];\r\ndouble ax;\r\ndouble ay;\r\ndouble az;\r\n\r\n\/\/ FullString\r\nString FullString = &quot;&quot;;\r\n\r\n\/\/ Bluetooth Serial\r\nBluetoothSerial SerialBT;\r\n\r\n\/\/ Defined ESP32\r\n#define TFT_DC  D2\r\n#define TFT_CS  D6\r\n#define TFT_RST D3\r\n\r\n\/*dc=*\/ \/*cs=*\/ \/*rst=*\/\r\n\/\/ DFRobot Display 240x320\r\nDFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);\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;25-09&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Accelemeter ADXL345\r\n  isADXL345();\r\n\r\n  \/\/ Compass HMC5883L\r\n  isHMC5883L();\r\n\r\n  \/\/ isEEPROM\r\n  isEEPROM();\r\n\r\n  \/\/ Accelemeter ADXL345 Compass HMC5883L Display\r\n  isDisplayADXL345HMC5883L();\r\n\r\n  \/\/ Delay 0.5 Second\r\n  delay( 500 );\r\n\r\n}\r\n<\/pre>\n<p><strong>getAccelemeterADXL345.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Accelemeter ADXL345\r\n\/\/ Setup Accelemeter ADXL345\r\nvoid isSetupADXL345(){\r\n\r\n  \/\/ Power On\r\n  adxl.powerOn();\r\n\r\n  \/\/ Set activity inactivity thresholds (0-255)\r\n  \/\/ 62.5mg per increment\r\n  adxl.setActivityThreshold(75);\r\n  \/\/ 62.5mg per increment\r\n  adxl.setInactivityThreshold(75);\r\n  \/\/ How many seconds of no activity is inactive?\r\n  adxl.setTimeInactivity(10);\r\n \r\n  \/\/look of activity movement on this axes - 1 == on; 0 == off \r\n  adxl.setActivityX(1);\r\n  adxl.setActivityY(1);\r\n  adxl.setActivityZ(1);\r\n \r\n  \/\/look of inactivity movement on this axes - 1 == on; 0 == off\r\n  adxl.setInactivityX(1);\r\n  adxl.setInactivityY(1);\r\n  adxl.setInactivityZ(1);\r\n \r\n  \/\/ Look of tap movement on this axes - 1 == on; 0 == off\r\n  adxl.setTapDetectionOnX(0);\r\n  adxl.setTapDetectionOnY(0);\r\n  adxl.setTapDetectionOnZ(1);\r\n \r\n  \/\/ Set values for what is a tap, and what is a double tap (0-255)\r\n  \/\/ 62.5mg per increment\r\n  adxl.setTapThreshold(50);\r\n  \/\/ 625us per increment\r\n  adxl.setTapDuration(15);\r\n  \/\/ 1.25ms per increment\r\n  adxl.setDoubleTapLatency(80);\r\n  \/\/ 1.25ms per increment\r\n  adxl.setDoubleTapWindow(200);\r\n \r\n  \/\/ set values for what is considered freefall (0-255)\r\n  \/\/ (5 - 9) recommended - 62.5mg per increment\r\n  adxl.setFreeFallThreshold(7);\r\n  \/\/ (20 - 70) recommended - 5ms per increment\r\n  adxl.setFreeFallDuration(45);\r\n \r\n  \/\/ Setting all interrupts to take place on int pin 1\r\n  \/\/ I had issues with int pin 2, was unable to reset it\r\n  adxl.setInterruptMapping( ADXL345_INT_SINGLE_TAP_BIT,   ADXL345_INT1_PIN );\r\n  adxl.setInterruptMapping( ADXL345_INT_DOUBLE_TAP_BIT,   ADXL345_INT1_PIN );\r\n  adxl.setInterruptMapping( ADXL345_INT_FREE_FALL_BIT,    ADXL345_INT1_PIN );\r\n  adxl.setInterruptMapping( ADXL345_INT_ACTIVITY_BIT,     ADXL345_INT1_PIN );\r\n  adxl.setInterruptMapping( ADXL345_INT_INACTIVITY_BIT,   ADXL345_INT1_PIN );\r\n \r\n  \/\/ Register interrupt actions - 1 == on; 0 == off  \r\n  adxl.setInterrupt( ADXL345_INT_SINGLE_TAP_BIT, 1);\r\n  adxl.setInterrupt( ADXL345_INT_DOUBLE_TAP_BIT, 1);\r\n  adxl.setInterrupt( ADXL345_INT_FREE_FALL_BIT,  1);\r\n  adxl.setInterrupt( ADXL345_INT_ACTIVITY_BIT,   1);\r\n  adxl.setInterrupt( ADXL345_INT_INACTIVITY_BIT, 1);\r\n\r\n}\r\n\/\/ Accelemeter ADXL345\r\nvoid isADXL345(){\r\n\r\n  \/\/ Read the accelerometer values and store them in variables  x,y,z\r\n  adxl.readXYZ(&amp;x, &amp;y, &amp;z);\r\n\r\n  \/\/ Output\r\n  \/\/ FullString\r\n  \/\/ ************\r\n  FullString = &quot;************\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n    \r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n       \r\n  }\r\n  \r\n  \/\/ FullString\r\n  FullString = &quot;Values of X , Y , Z: &quot; + String(x) + &quot; , &quot; + \r\n  String(y) + &quot; , &quot; + String(z) + + &quot;\\r\\n&quot;;\r\n\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n\r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\r\n  \r\n  \/\/ Standard Gravity\r\n  \/\/ Acceleration\r\n  adxl.getAcceleration(xyz);\r\n\r\n  \/\/ Output\r\n  ax = xyz[0];\r\n  ay = xyz[1];\r\n  az = xyz[2];\r\n  \r\n  \/\/ FullString\r\n  \/\/ ************\r\n  FullString = &quot;************\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n    \r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n       \r\n  }\r\n\r\n  \/\/ FullString\r\n  \/\/ xg\r\n  FullString = &quot;X = &quot; + String(ax) + &quot; g&quot; + &quot;\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n\r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\r\n  \/\/ yg\r\n  FullString = &quot;y = &quot; + String(ay) + &quot; g&quot; + &quot;\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n\r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\r\n  \/\/ zg\r\n  FullString = &quot;z = &quot; + String(az) + &quot; g&quot; + &quot;\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n\r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>getCompassHMC5883L.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ HMC5883L Triple Axis Digital Compass\r\n\/\/ Setup HMC5883L\r\nvoid isSetupHMC5883L(){\r\n\r\n  \/\/ Initialize Initialize HMC5883L\r\n  compass.begin();\r\n\r\n  \/\/ Set measurement range\r\n  compass.setRange(HMC5883L_RANGE_1_3GA);\r\n\r\n  \/\/ Set measurement mode\r\n  compass.setMeasurementMode(HMC5883L_CONTINOUS);\r\n\r\n  \/\/ Set data rate\r\n  compass.setDataRate(HMC5883L_DATARATE_30HZ);\r\n\r\n  \/\/ Set number of samples averaged\r\n  compass.setSamples(HMC5883L_SAMPLES_8);\r\n\r\n  \/\/ Set calibration offset\r\n  compass.setOffset(0, 0);\r\n  \r\n}\r\n\/\/ Compass HMC5883L\r\nvoid isHMC5883L(){\r\n\r\n  \/\/ Vector norm\r\n  Vector norm = compass.readNormalize();\r\n\r\n  \/\/ Calculate heading\r\n  heading = atan2(norm.YAxis, norm.XAxis);\r\n\r\n  \/\/ Set declination angle on your location and fix heading\r\n  \/\/ You can find your declination on: http:\/\/magnetic-declination.com\/\r\n  \/\/ (+) Positive or (-) for negative\r\n  \/\/ Latitude: 32\u00b0 39&#039; 7.9&quot; N\r\n  \/\/ Longitude: 115\u00b0 28&#039; 6.2&quot; W\r\n  \/\/ Magnetic Declination: +10\u00b0 35&#039;\r\n  \/\/ Declination is POSITIVE (EAST)\r\n  \/\/ Inclination: 58\u00b0 4&#039;\r\n  \/\/ Magnetic field strength: 45759.1 nT\r\n  \/\/ Formula: (deg + (min \/ 60.0)) \/ (180 \/ M_PI);\r\n  float declinationAngle = (10.0 + (35.0 \/ 60.0)) \/ (180 \/ M_PI);\r\n  heading += declinationAngle;\r\n\r\n  \/\/ Correct for heading &lt; 0deg and heading &gt; 360deg\r\n  if (heading &lt; 0)\r\n  {\r\n    heading += 2 * PI;\r\n  }\r\n\r\n  if (heading &gt; 2 * PI)\r\n  {\r\n    heading -= 2 * PI;\r\n  }\r\n\r\n  \/\/ Convert to degrees\r\n  headingDegrees = heading * 180\/M_PI; \r\n\r\n  \/\/ Output\r\n  \/\/ FullString\r\n  \/\/ ************\r\n  FullString = &quot;************\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n    \r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\r\n\r\n  \/\/ FullString\r\n  \/\/ Heading\r\n  FullString = &quot;Heading = &quot; + String( heading ) + &quot;\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n\r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\r\n\r\n  \/\/ FullString\r\n  \/\/ Degress\r\n  FullString = &quot;Degress = &quot; + String( headingDegrees ) + &quot;\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n\r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\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\/\/ DFRobot Display 240x320\r\n\/\/ DFRobot Display 240x320 - UID\r\nvoid isDisplayUID(){\r\n\r\n  \/\/ DFRobot Display 240x320\r\n  \/\/ Text Display\r\n  \/\/ Text Wrap\r\n  screen.setTextWrap(false);\r\n  \/\/ Rotation\r\n  screen.setRotation(3);\r\n  \/\/ Fill Screen =&gt; black\r\n  screen.fillScreen(0x0000);\r\n  \/\/ Text Color =&gt; white\r\n  screen.setTextColor(0xffff);\r\n  \/\/ Font =&gt; Free Sans Bold 12pt\r\n  screen.setFont(&amp;FreeSansBold12pt7b);\r\n  \/\/ TextSize =&gt; 1.5\r\n  screen.setTextSize(1.5);\r\n  \/\/ Don Luc Electronics\r\n  screen.setCursor(0, 30);\r\n  screen.println(&quot;Don Luc Electronics&quot;);\r\n  \/\/ EEPROM\r\n  screen.setCursor(0, 60);\r\n  screen.println(&quot;EEPROM&quot;);\r\n  \/\/ Version\r\n  screen.setCursor(0, 90);\r\n  screen.println(&quot;Version&quot;);\r\n  screen.setCursor(0, 120);\r\n  screen.println( sver );\r\n  \/\/ EEPROM\r\n  screen.setCursor(0, 150);\r\n  screen.println(&quot;EEPROM&quot;);\r\n  screen.setCursor(0, 180);\r\n  screen.println( uid );\r\n\r\n}\r\n\/\/ Accelemeter ADXL345\r\nvoid isDisplayADXL345HMC5883L(){\r\n\r\n  \/\/ DFRobot Display 240x320\r\n  \/\/ Text Display\r\n  \/\/ Text Wrap\r\n  screen.setTextWrap(false);\r\n  \/\/ Rotation\r\n  screen.setRotation(3);\r\n  \/\/ Fill Screen =&gt; white\r\n  screen.fillScreen(0xffff);\r\n  \/\/ Text Color =&gt; blue\r\n  screen.setTextColor(0x001F);\r\n  \/\/ Font =&gt; Free Sans Bold 12pt\r\n  screen.setFont(&amp;FreeSansBold12pt7b);\r\n  \/\/ TextSize =&gt; 1.5\r\n  screen.setTextSize(1.5);\r\n  \/\/ Accelemeter ADXL345\r\n  screen.setCursor(0, 30);\r\n  screen.println(&quot;Accelemeter ADXL345&quot;);\r\n  \/\/ Accelemeter ADXL345 X\r\n  screen.setCursor(0, 60);\r\n  screen.println(&quot;X: &quot;);\r\n  screen.setCursor(40, 60);\r\n  screen.println( x );\r\n  \/\/ Accelemeter ADXL345 Y\r\n  screen.setCursor(0, 90);\r\n  screen.println( &quot;Y: &quot; );\r\n  screen.setCursor(40, 90);\r\n  screen.println( y );\r\n  \/\/ Accelemeter ADXL345 Z\r\n  screen.setCursor(0, 120);\r\n  screen.println( &quot;Z: &quot; );\r\n  screen.setCursor(40, 120);\r\n  screen.println( z );\r\n  \/\/ Compass HMC5883L\r\n  screen.setCursor(0, 150);\r\n  screen.println( &quot;Compass HMC5883L&quot; );\r\n  \/\/ Heading\r\n  screen.setCursor(0, 180);\r\n  screen.println( &quot;Heading = &quot; );\r\n  screen.setCursor(130, 180);\r\n  screen.println( heading );\r\n  \/\/ Degress\r\n  screen.setCursor(0, 210);\r\n  screen.println( &quot;Degress = &quot; );\r\n  screen.setCursor(130, 210);\r\n  screen.println( headingDegrees );\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\/\/ isEEPROM\r\nvoid isEEPROM(){\r\n\r\n  \/\/ FullString\r\n  \/\/ ************\r\n  FullString = &quot;************\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n    \r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\r\n\r\n  \/\/ FullString\r\n  \/\/ EEPROM\r\n  FullString = &quot;EEPROM = &quot; + String( uid ) + &quot;\\r\\n&quot;;\r\n  \/\/ FullString Bluetooth Serial + Serial\r\n  for(int i = 0; i &lt; FullString.length(); i++)\r\n  {\r\n\r\n    \/\/ Bluetooth Serial\r\n    SerialBT.write(FullString.c_str()[i]);\r\n    \/\/ Serial\r\n    Serial.write(FullString.c_str()[i]);\r\n    \r\n  }\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  \/\/ Serial Begin\r\n  Serial.begin(115200);\r\n  Serial.println(&quot;Starting BLE work!&quot;);\r\n\r\n  \/\/ Bluetooth Serial\r\n  SerialBT.begin(&quot;DL2501Mk07&quot;);\r\n  Serial.println(&quot;Bluetooth Started! Ready to pair...&quot;);\r\n\r\n  \/\/ Delay\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  \/\/ Delay\r\n  delay(100);\r\n\r\n  \/\/ DFRobot Display 240x320\r\n  screen.begin();\r\n\r\n  \/\/ Delay\r\n  delay(100);\r\n\r\n  \/\/ Setup Accelemeter ADXL345\r\n  isSetupADXL345();\r\n\r\n  \/\/ Setup HMC5883L\r\n  isSetupHMC5883L();\r\n\r\n  \/\/ DFRobot Display 240x320 - UID\r\n  \/\/ Don Luc Electronics\r\n  \/\/ Version\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>Electronics, IoT, Teacher, Instructor, R&#038;D and Consultant<\/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; 2025<\/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>Patreon:<\/strong> https:\/\/patreon.com\/DonLucElectronics59<br \/>\n<strong>DFRobot:<\/strong> https:\/\/learn.dfrobot.com\/user-10186.html<br \/>\n<strong>Hackster.io:<\/strong> https:\/\/www.hackster.io\/neosteam-labs<br \/>\n<strong>Elecrow:<\/strong> https:\/\/www.elecrow.com\/share\/sharepj\/center\/no\/760816d385ebb1edc0732fd873bfbf13<br \/>\n<strong>TikTok:<\/strong> https:\/\/www.tiktok.com\/@luc.paquin8<br \/>\n<strong>Twitch:<\/strong> https:\/\/www.twitch.tv\/lucpaquin<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 #EEPROM #HMC5883L #Compass #ADXL345 #Accelerometer #Movement #ESP32 #Bluetooth #Elecrow #DFRobot #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; EEPROM EEPROM (Electrically Erasable Programmable Read-only Memory) is a type of non-volatile memory. EEPROM is a type of non-volatile ROM that enables individual bytes of data to be erased &#8230; <a title=\"Project #25 &#8211; Movement &#8211; EEPROM &#8211; Mk09\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=4283\" aria-label=\"Read more about Project #25 &#8211; Movement &#8211; EEPROM &#8211; Mk09\">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":[240,50,49,317,38,368,80,59,115,5,138,287,58,82,10],"tags":[251,6,92,242,102,4,320,87,331,369,19,83,85,246,24,249,9,84,27,33,34,108],"class_list":["post-4283","post","type-post","status-publish","format-standard","hentry","category-movement","category-arduino","category-consultant","category-dfrobot","category-digitalelectronics","category-elecrow","category-esp32","category-fritzing","category-e-mentor","category-microcontrollers","category-patreon","category-program","category-arduino-programming","category-program-esp32","category-projects","tag-accelerometer","tag-arduino","tag-battery","tag-bluetooth","tag-components","tag-consultant","tag-dfrobot","tag-display","tag-eeprom","tag-elecrow","tag-electronics","tag-esp32","tag-fritzing","tag-magnetometer","tag-microcontroller","tag-movement","tag-programming","tag-programming-esp32","tag-projects-2","tag-technology","tag-video-blog","tag-vlog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/4283","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=4283"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/4283\/revisions"}],"predecessor-version":[{"id":4288,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/4283\/revisions\/4288"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}