{"id":3924,"date":"2024-05-18T08:58:05","date_gmt":"2024-05-18T15:58:05","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3924"},"modified":"2024-05-18T08:58:05","modified_gmt":"2024-05-18T15:58:05","slug":"project-29-dfrobot-ble-sensor-beacon-mk12","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3924","title":{"rendered":"Project #29 &#8211; DFRobot &#8211; BLE Sensor Beacon &#8211; Mk12"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3924-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #DFRobot #BLESensorBeacon #AmbientLight #SoilMoisture #SHT40 #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Adafruit #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\/05\/DL2405Mk02a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02a.png\" alt=\"BLE Sensor Beacon\" width=\"720\" height=\"500\" class=\"alignnone size-full wp-image-3926\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02a-300x208.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\/05\/DL2405Mk02b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02b.png\" alt=\"BLE Sensor Beacon\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3927\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02b-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\/05\/DL2405Mk02c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02c.png\" alt=\"BLE Sensor Beacon\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3928\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/05\/DL2405Mk02c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Fermion: BLE Sensor Beacon<\/strong><\/p>\n<p><strong>Fermion:<\/strong> BLE Sensor Beacon, a wireless beacon that broadcasts sensor data via Bluetooth, with built-in 11-bit ADC acquisition and I2C write\/read functionality, can be connected to digital or analogue sensors for data acquisition and broadcasting. Sensor data broadcasted by the beacon can be accessed within the beacon&#8217;s broadcast range using mobile phones, ESP32 and other devices that support BLE reception.<\/p>\n<p><strong>Fermion:<\/strong> BLE sensor beacons integrate low-power Bluetooth 5.3 technology with self-configurable data formats, such as iBeacon, Eddystone, user-defined, and more. The data format of the beacon broadcast, the content of the broadcast, the broadcast interval and so on can be configured through the graphical interface, without the need for any code programming to complete a Bluetooth beacon. After the configuration is completed, the device power supply is running as a Bluetooth beacon, which will automatically collect sensor data and broadcast to the outside world according to the configuration information. It is suitable for IoT sensor nodes, such as smart farms, offices, factories, warehouses and other scenarios in the data collection node.<\/p>\n<p><strong>DL2405Mk02<\/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 Adafruit DS3231 Precision RTC FeatherWing &#8211; RTC<br \/>\n1 x Battery CR1220<br \/>\n1 x Gravity: Analog Soil Moisture Sensor<br \/>\n1 x Gravity: Analog Ambient Light Sensor<br \/>\n1 x Fermion: SHT40 Temperature &#038; Humidity Sensor<br \/>\n3 x Fermion: BLE Sensor Beacon<br \/>\n3 x CR2032 Coin Cell Battery<br \/>\n1 x 1 x Lithium Ion Battery &#8211; 1000mAh<br \/>\n1 x Green LED<br \/>\n1 x Slide Switch<br \/>\n1 x SparkFun Serial Basic Breakout &#8211; CH340G<br \/>\n1 x SparkFun Cerberus USB Cable<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; 12<br \/>\nDMOSI &#8211; 4<br \/>\nDSS &#8211; 16<br \/>\nSCK &#8211; 22<br \/>\nMOSI &#8211; 23<br \/>\nMISO &#8211; 19<br \/>\nCS &#8211; 13<br \/>\nSCL &#8211; 21<br \/>\nSDA &#8211; 22<br \/>\nLED &#8211; 14<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2405Mk02p.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 - BLE Sensor Beacon - Mk12\r\n29-12\r\nDL2404Mk02p.ino\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 Adafruit DS3231 Precision RTC FeatherWing - RTC\r\n1 x Battery CR1220\r\n1 x Gravity: Analog Soil Moisture Sensor\r\n1 x Gravity: Analog Ambient Light Sensor\r\n1 x Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n3 x Fermion: BLE Sensor Beacon\r\n3 x CR2032 Coin Cell Battery\r\n1 x 1 x Lithium Ion Battery - 1000mAh\r\n1 x Green LED\r\n1 x SparkFun Serial Basic Breakout - CH340G\r\n1 x SparkFun Cerberus USB Cable\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\/\/ Arduino\r\n#include &lt;Arduino.h&gt;\r\n\/\/ BLE Device\r\n#include &lt;BLEDevice.h&gt;\r\n\/\/ BLE Utils\r\n#include &lt;BLEUtils.h&gt;\r\n\/\/ BLEScan\r\n#include &lt;BLEScan.h&gt;\r\n\/\/ BLE Advertised Device\r\n#include &lt;BLEAdvertisedDevice.h&gt;\r\n\/\/ BLE Eddystone URL\r\n#include &lt;BLEEddystoneURL.h&gt;\r\n\/\/ BLE Eddystone TLM\r\n#include &lt;BLEEddystoneTLM.h&gt;\r\n\/\/ BLE Beacon\r\n#include &lt;BLEBeacon.h&gt;\r\n\/\/ DS3231 RTC Date and Time\r\n#include &lt;RTClib.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\r\n\/\/ ENDIAN_CHANGE\r\n#define ENDIAN_CHANGE_U16(x) ((((x)&amp;0xFF00) &gt;&gt; 8) + (((x)&amp;0xFF) &lt;&lt; 8))\r\n\r\n\/\/ DS3231 RTC Date and Time\r\nRTC_DS3231 rtc;\r\nString sDate;\r\nString sTime;\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  12\r\n#define SHARP_MOSI 4\r\n#define SHARP_SS   16\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\/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n\/\/ Temperature\r\nfloat TemperatureData;\r\nfloat Temperature;\r\n\/\/ Humidity\r\nfloat HumidityData;\r\nfloat Humidity;\r\n\/\/ Gravity: Analog Ambient Light Sensor\r\nfloat Sensor_Data;\r\n\/\/ SData =&gt; 1~6000 Lux\r\nfloat SData;\r\n\/\/ Gravity: Analog Soil Moisture Sensor\r\nfloat SensorSM;\r\nfloat SDataSM;\r\n\/\/ In seconds\r\nint scanTime = 5;\r\n\/\/ BLE Scan\r\nBLEScan *pBLEScan;\r\n\r\n\/\/ My Advertised Device Callbacks\r\nclass MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks\r\n{\r\n\r\n    \/\/ onResult\r\n    void onResult(BLEAdvertisedDevice advertisedDevice)\r\n    {\r\n      \/\/ Advertised Device\r\n      if (advertisedDevice.haveName())\r\n      {\r\n        \/\/ Name: Fermion: Sensor Beacon\r\n        if(String(advertisedDevice.getName().c_str()) == &quot;SHT40&quot;){\r\n          \r\n          \/\/ strManufacturerData\r\n          std::string strManufacturerData = advertisedDevice.getManufacturerData();\r\n          uint8_t cManufacturerData[100];\r\n          strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0);\r\n          \r\n          \/\/ strManufacturerData.length\r\n          for (int i = 0; i &lt; strManufacturerData.length(); i++)\r\n          {\r\n\r\n             \/\/ cManufacturerData[i]\r\n             cManufacturerData[i];\r\n             \r\n          }\r\n\r\n          \/\/ TemperatureData\r\n          TemperatureData = int(cManufacturerData[2]&lt;&lt;8 | cManufacturerData[3]);\r\n          \/\/ HumidityData\r\n          HumidityData = int(cManufacturerData[5]&lt;&lt;8 | cManufacturerData[6]);\r\n   \r\n        }\r\n        \/\/ Name: Fermion: Sensor Beacon\r\n        if(String(advertisedDevice.getName().c_str()) == &quot;Fermion: Sensor Beacon&quot;){\r\n          \r\n          \/\/ strManufacturerData\r\n          std::string strManufacturerData = advertisedDevice.getManufacturerData();\r\n          uint8_t cManufacturerData[100];\r\n          strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0);\r\n          \r\n          \/\/ strManufacturerData.length\r\n          for (int i = 0; i &lt; strManufacturerData.length(); i++)\r\n          {\r\n\r\n             \/\/ cManufacturerData[i]\r\n             cManufacturerData[i];\r\n             \r\n          }\r\n\r\n          \/\/ Sensor_Data\r\n          Sensor_Data = int(cManufacturerData[2]&lt;&lt;8 | cManufacturerData[3]);\r\n   \r\n        }\r\n        \/\/ Name: Fermion: Sensor Beacon\r\n        if(String(advertisedDevice.getName().c_str()) == &quot;Soil Moisture&quot;){\r\n          \r\n          \/\/ strManufacturerData\r\n          std::string strManufacturerData = advertisedDevice.getManufacturerData();\r\n          uint8_t cManufacturerData[100];\r\n          strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0);\r\n          \r\n          \/\/ strManufacturerData.length\r\n          for (int i = 0; i &lt; strManufacturerData.length(); i++)\r\n          {\r\n\r\n             \/\/ cManufacturerData[i]\r\n             cManufacturerData[i];\r\n             \r\n          }\r\n\r\n          \/\/ SensorSM\r\n          SensorSM = int(cManufacturerData[2]&lt;&lt;8 | cManufacturerData[3]);\r\n   \r\n        }                              \r\n      }\r\n    }\r\n};\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-12&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ DS3231 RTC Date and Time\r\n  isRTC();\r\n  \r\n  \/\/ ScanResults\r\n  isBLEScanResults();\r\n\r\n  \/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n  isSHT40();\r\n\r\n  \/\/ Gravity: Analog Ambient Light Sensor\r\n  isAmbientLight();\r\n\r\n  \/\/ Soil Moisture\r\n  isSoilMoisture();\r\n\r\n  \/\/ Delay 4 Second\r\n  delay(4000);\r\n\r\n  \/\/ Display Date, Time, Temperature, Humidity\r\n  isDisplayDTTH();\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 1 Second\r\n  delay(1000);\r\n\r\n}\r\n<\/pre>\n<p><strong>getAmbientLight.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Gravity: Analog Ambient Light Sensor\r\n\/\/ Ambient Light\r\nvoid isAmbientLight(){\r\n\r\n  \/\/ Analog Ambient Light Sensor\r\n  \/\/ SData =&gt; 1~6000 Lux\r\n  SData = map(Sensor_Data, 1, 3000, 1, 6000);\r\n\r\n}\r\n<\/pre>\n<p><strong>getBLEScan.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ getBLEScan\r\n\/\/ Setup BLE Scan\r\nvoid isSetupBLEScan(){\r\n\r\n  \/\/ BLE Device\r\n  BLEDevice::init(&quot;&quot;);\r\n  \/\/ Create new scan\r\n  pBLEScan = BLEDevice::getScan();\r\n  \/\/ Set Advertised Device Callbacks\r\n  pBLEScan-&gt;setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());\r\n  \/\/ Active scan uses more power, but get results faster\r\n  pBLEScan-&gt;setActiveScan(true);\r\n  \/\/ Set Interval\r\n  pBLEScan-&gt;setInterval(100);\r\n  \/\/ Less or equal setInterval value\r\n  pBLEScan-&gt;setWindow(99);\r\n  \r\n}\r\n\/\/ BLE Scan Results\r\nvoid isBLEScanResults(){\r\n\r\n  \/\/ Put your main code here, to run repeatedly:\r\n  BLEScanResults foundDevices = pBLEScan-&gt;start(scanTime, false);\r\n  \/\/ Delete results fromBLEScan buffer to release memory\r\n  pBLEScan-&gt;clearResults();\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, Time, Temperature, Humidity, Ambient Light, Soil Moisture\r\nvoid isDisplayDTTH() {\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( sDate );\r\n    \/\/ Time\r\n    display.setCursor(0,30);\r\n    display.println( sTime );\r\n    \/\/ Temperature\r\n    display.setCursor(0,55);\r\n    display.print( Temperature );\r\n    display.println( &quot;C&quot; );\r\n    \/\/ Humidity\r\n    display.setCursor(0,80);\r\n    display.print( Humidity );\r\n    display.println( &quot;%&quot; );\r\n    \/\/ Lux\r\n    display.setCursor(0,105);\r\n    display.println( SData );\r\n    \/\/ Soil Moisture\r\n    display.setCursor(0,130);\r\n    display.println( SDataSM );\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  \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>getRTC.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ DS3231 RTC Date and Time\r\n\/\/ Setup DS3231 RTC\r\nvoid isSetupRTC() {\r\n\r\n  if (! rtc.begin()) {\r\n    while (1);\r\n  }\r\n\r\n  if (rtc.lostPower()) {\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  }\r\n  \r\n}\r\n\/\/ DS3231 RTC Date and Time\r\nvoid isRTC(){\r\n \r\n    \/\/ Date and Time\r\n    sDate = &quot;&quot;;\r\n    sTime = &quot;&quot;;\r\n    \/\/ Date Time\r\n    DateTime now = rtc.now();\r\n\r\n    \/\/ sData\r\n    sDate += String(now.year(), DEC);\r\n    sDate += &quot;\/&quot;;\r\n    sDate += String(now.month(), DEC);\r\n    sDate += &quot;\/&quot;;\r\n    sDate += String(now.day(), DEC);\r\n\r\n    \/\/ sTime\r\n    sTime += String(now.hour(), DEC);\r\n    sTime += &quot;:&quot;;\r\n    sTime += String(now.minute(), DEC);\r\n    sTime += &quot;:&quot;;\r\n    sTime += String(now.second(), DEC);\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  \/\/ DFR|EEPROM Unique ID|Version|Date|Time|Temperature|Humidity|Lux|\r\n  \/\/ Soil Moisture|*\\r\r\n  zzzzzz = &quot;DFR|&quot; + uid + &quot;|&quot; + sver + &quot;|&quot; + sDate + &quot;|&quot; + sTime + &quot;|&quot; \r\n  + String(Temperature) + &quot;C|&quot; + String(Humidity) + &quot;%|&quot; \r\n  + String(SData) + &quot;|&quot; + String(SDataSM) + &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>getSHT40.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n\/\/ SHT40 Temperature &amp; Humidity\r\nvoid isSHT40(){\r\n\r\n  \/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n  \/\/ Temperature\r\n  Temperature = (175 * TemperatureData\/65535) - 45;\r\n  \/\/ Humidity\r\n  Humidity = (125 * HumidityData\/65535) - 6;\r\n\r\n}\r\n<\/pre>\n<p><strong>getSoilMoisture.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Gravity: Analog Soil Moisture Sensor\r\n\/\/ Soil Moisture\r\nvoid isSoilMoisture(){\r\n\r\n  \/\/ SDataSM =&gt; 0~900 Soil Moisture\r\n  SDataSM = map( SensorSM, 1, 3000, 0, 900);\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  \/\/ Setup BLE Scan\r\n  isSetupBLEScan();\r\n\r\n  \/\/ Setup DS3231 RTC\r\n  isSetupRTC();\r\n\r\n  \/\/MicroSD Card\r\n  setupSD();\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  \/\/ 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  \/\/ 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 #BLESensorBeacon #AmbientLight #SoilMoisture #SHT40 #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Adafruit #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Fermion: BLE Sensor Beacon Fermion: BLE Sensor Beacon, a wireless beacon that broadcasts sensor data via Bluetooth, with built-in 11-bit ADC acquisition and I2C write\/read functionality, can be &#8230; <a title=\"Project #29 &#8211; DFRobot &#8211; BLE Sensor Beacon &#8211; Mk12\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3924\" aria-label=\"Read more about Project #29 &#8211; DFRobot &#8211; BLE Sensor Beacon &#8211; Mk12\">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,82,10],"tags":[86,6,92,334,102,4,320,87,19,83,85,24,9,84,27,33,34,108],"class_list":["post-3924","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-program-esp32","category-projects","tag-adafruit","tag-arduino","tag-battery","tag-ble-sensor-beacon","tag-components","tag-consultant","tag-dfrobot","tag-display","tag-electronics","tag-esp32","tag-fritzing","tag-microcontroller","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\/3924","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=3924"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3924\/revisions"}],"predecessor-version":[{"id":4238,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3924\/revisions\/4238"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}