{"id":2888,"date":"2021-10-12T07:35:29","date_gmt":"2021-10-12T14:35:29","guid":{"rendered":"https:\/\/www.donluc.com\/?p=2888"},"modified":"2021-10-12T07:35:29","modified_gmt":"2021-10-12T14:35:29","slug":"project-15-environment-chronodot-mk16","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=2888","title":{"rendered":"Project #15: Environment \u2013 ChronoDot \u2013 Mk16"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2888-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #RTC #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03a.png\" alt=\"ChronoDot\" width=\"720\" height=\"634\" class=\"alignnone size-full wp-image-2890\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03a-300x264.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\/10\/DL2110Mk03b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03b.png\" alt=\"ChronoDot\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2891\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03b-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\/10\/DL2110Mk03c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03c.png\" alt=\"ChronoDot\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2892\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03c-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\/10\/DL2110Mk03d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03d.png\" alt=\"ChronoDot\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2893\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/10\/DL2110Mk03d-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>ChronoDot &#8211; Ultra-Precise Real Time Clock &#8211; v2.1<\/strong><\/p>\n<p>The ChronoDot RTC is an extremely accurate real time clock module, based on the DS3231 temperature compensated RTC. It includes a CR1632 battery, which should last at least 8 years if the I2C interface is only used while the device has 5V power available. No external crystal or tuning capacitors are required.<\/p>\n<p>The top side of the Chronodot now features a battery holder for 16mm 3V lithium coin cells. It pairs particularly well with CR1632 batteries. The DS3231 has an internal crystal and a switched bank of tuning capacitors. The temperature of the crystal is continously monitored, and the capacitors are adjusted to maintain a stable frequency. Other RTC solutions may drift minutes per month, especially in extreme temperature ranges&#8230;the ChronoDot will drift less than a minute per year. This makes the ChronoDot very well suited for time critical applications that cannot be regularly synchronized to an external clock.<\/p>\n<p><strong>DL2110Mk03<\/strong><\/p>\n<p>1 x Arduino UNO &#8211; R3<br \/>\n1 x ProtoScrewShield<br \/>\n1 x RGB LCD Shield 16&#215;2 Character Negative Display<br \/>\n1 x ChronoDot &#8211; Ultra-Precise Real Time Clock &#8211; v2.1<br \/>\n1 x Adafruit PowerBoost 500 Shield<br \/>\n1 x Lithium Ion Battery &#8211; 3.7v 2000mAh<br \/>\n4 x Pololu Carrier for MQ Gas Sensors<br \/>\n1 x SparkFun Hydrogen Gas Sensor &#8211; MQ-8<br \/>\n1 x 4.7K Ohm<br \/>\n1 x Pololu Carbon Monoxide &#038; Flammable Gas Sensor &#8211; MQ-9<br \/>\n1 x 22k Ohm<br \/>\n1 x SparkFun Carbon Monoxide Gas Sensor &#8211; MQ-7<br \/>\n1 x 10K Ohm<br \/>\n1 x SparkFun Alcohol Gas Sensor &#8211; MQ-3<br \/>\n1 x 220k Ohm<br \/>\n1 x Temperature and Humidity Sensor- RHT03<br \/>\n1 x PIR Motion Sensor (JST)<br \/>\n1 x SparkFun Solderable Half-Breadboard<br \/>\n1 x Half-Breadboard<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Arduino UNO &#8211; R3<\/strong><\/p>\n<p>RHT &#8211; Digital 5<br \/>\nPIR &#8211; Digital 7<br \/>\nMQ8 &#8211; Analog 0<br \/>\nMQ9 &#8211; Analog 1<br \/>\nMQ7 &#8211; Analog 2<br \/>\nMQ3 &#8211; Analog 3<br \/>\nSDA &#8211; Analog 4<br \/>\nSCL &#8211; Analog 5<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2110Mk03p.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 #15: Environment \u2013 ChronoDot \u2013 Mk16\r\n10-03\r\nDL2110Mk03p.ino\r\n1 x Arduino UNO - R3\r\n1 x ProtoScrewShield\r\n1 x RGB LCD Shield 16x2 Character Negative Display\r\n1 x ChronoDot - Ultra-Precise Real Time Clock - v2.1\r\n1 x Adafruit PowerBoost 500 Shield\r\n1 x Lithium Ion Battery - 3.7v 2000mAh\r\n4 x Pololu Carrier for MQ Gas Sensors\r\n1 x SparkFun Hydrogen Gas Sensor - MQ-8\r\n1 x 4.7K Ohm\r\n1 x Pololu Carbon Monoxide &amp; Flammable Gas Sensor - MQ-9\r\n1 x 22k Ohm\r\n1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7\r\n1 x 10K Ohm\r\n1 x SparkFun Alcohol Gas Sensor - MQ-3\r\n1 x 220k Ohm\r\n1 x Temperature and Humidity Sensor - RHT03\r\n1 x PIR Motion Sensor (JST)\r\n1 x SparkFun Solderable Half-Breadboard\r\n1 x Half-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 &lt;EEPROM.h&gt;\r\n\/\/ RHT Temperature and Humidity Sensor\r\n#include &lt;SparkFun_RHT03.h&gt;\r\n\/\/ Adafruit RGB LCD Shield 16x2\r\n#include &lt;Adafruit_RGBLCDShield.h&gt;\r\n\/\/ Wire\r\n#include &lt;Wire.h&gt;\r\n\/\/ DS3231 RTC Date and Time\r\n#include &lt;RTClib.h&gt;\r\n\r\n\/\/ RHT Temperature and Humidity Sensor\r\n\/\/ RHT03 data pin Digital 5\r\nconst int RHT03_DATA_PIN = 5;\r\n\/\/ This creates a RTH03 object, which we&#039;ll use to interact with the sensor\r\nRHT03 rht;\r\nfloat latestHumidity;\r\nfloat latestTempC;\r\n\r\n\/\/ Gas Sensors MQ\r\n\/\/ Hydrogen Gas Sensor - MQ-8\r\nint iMQ8 = A0;\r\nint iMQ8Raw = 0;\r\nint iMQ8ppm = 0;\r\n\/\/ Two points are taken from the curve in datasheet.\r\n\/\/ With these two points, a line is formed which is\r\n\/\/ &quot;approximately equivalent&quot; to the original curve.\r\nfloat H2Curve[3] = {2.3, 0.93,-1.44};\r\n\r\n\/\/ Carbon Monoxide &amp; Flammable Gas Sensor - MQ-9\r\nint iMQ9 = A1;\r\nint iMQ9Raw = 0;\r\nint iMQ9ppm = 0;\r\n\r\n\/\/ Carbon Monoxide Gas Sensor - MQ-7\r\nint iMQ7 = A2;\r\nint iMQ7Raw = 0;\r\nint iMQ7ppm = 0;\r\n\r\n\/\/ Alcohol Gas Sensor - MQ-3\r\nint iMQ3 = A3;\r\nint iMQ3Raw = 0;\r\nint iMQ3ppm = 0;\r\n\r\n\/\/ PIR Motion\r\n\/\/ Motion detector\r\nconst int iMotion = 7;\r\n\/\/ Proximity\r\nint proximity = LOW;\r\nString Det = &quot;&quot;;\r\n\r\n\/\/ Adafruit RGB LCD Shield\r\nAdafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();\r\n\/\/ These #defines make it easy to set the backlight color\r\n#define OFF 0x0\r\n#define RED 0x1\r\n#define YELLOW 0x3\r\n#define GREEN 0x2\r\n#define TEAL 0x6\r\n#define BLUE 0x4\r\n#define VIOLET 0x5\r\n#define WHITE 0x7\r\n\/\/ Momentary Button\r\nint yy = 0;\r\nuint8_t momentaryButton = 0;\r\n\r\n\/\/ DS3231 RTC Date and Time\r\nRTC_DS3231 rtc;\r\nString sDate;\r\nString sTime;\r\n\r\n\/\/ Software Version Information\r\nString uid = &quot;&quot;;\r\n\/\/ Version\r\nString sver = &quot;15-16&quot;;\r\n\r\nvoid loop()\r\n{\r\n     \r\n  \/\/ Adafruit RGB LCD Shield\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n  \r\n  \/\/ RHT Temperature and Humidity Sensor\r\n  isRHT03();\r\n\r\n  \/\/ Gas Sensors MQ\r\n  isGasSensor();\r\n\r\n  \/\/ isPIR Motion\r\n  isPIR();\r\n\r\n  \/\/ DS3231 RTC Date and Time\r\n  isRTC();\r\n\r\n  \/\/ Adafruit RGB LCD Shield\r\n  \/\/ Display\r\n  isDisplay();\r\n\r\n  \/\/ Delay\r\n  \/\/ Turn the LED on HIGH is the voltage level\r\n  digitalWrite(LED_BUILTIN, HIGH);\r\n  \/\/ Wait for a 0.5 second\r\n  delay( 500 );\r\n  \/\/ Turn the LED off by making the voltage LOW\r\n  digitalWrite(LED_BUILTIN, LOW);\r\n  \/\/ Wait for a 0.5 second\r\n  delay( 500 );\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; 5; x++)\r\n  {\r\n    uid = uid + char(EEPROM.read(x));\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getGasSensorMQ.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Gas Sensors MQ\r\n\/\/ Gas Sensor\r\nvoid isGasSensor() {\r\n\r\n  \/\/ Read in analog value from each gas sensors\r\n  \r\n  \/\/ Hydrogen Gas Sensor - MQ-8\r\n  iMQ8Raw = analogRead( iMQ8 );\r\n\r\n  \/\/ Carbon Monoxide &amp; Flammable Gas Sensor - MQ-9\r\n  iMQ9Raw = analogRead( iMQ9 );  \r\n\r\n  \/\/ Carbon Monoxide Gas Sensor - MQ-7\r\n  iMQ7Raw = analogRead( iMQ7 );\r\n\r\n  \/\/ Alcohol Gas Sensor - MQ-3\r\n  iMQ3Raw = analogRead( iMQ3 );\r\n  \r\n  \/\/ Caclulate the PPM of each gas sensors\r\n\r\n  \/\/ Hydrogen Gas Sensor - MQ-8\r\n  iMQ8ppm = isMQ8( iMQ8Raw );\r\n\r\n  \/\/ Carbon Monoxide &amp; Flammable Gas Sensor - MQ-9\r\n  iMQ9ppm = isMQ9( iMQ9Raw ); \r\n\r\n  \/\/ Carbon Monoxide Gas Sensor - MQ-7\r\n  iMQ7ppm = isMQ7( iMQ7Raw ); \r\n\r\n  \/\/ Alcohol Gas Sensor - MQ-3\r\n  iMQ3ppm = isMQ3( iMQ3Raw ); \r\n\r\n}\r\n\/\/ Hydrogen Gas Sensor - MQ-8 - PPM\r\nint isMQ8(double rawValue) {\r\n\r\n  \/\/ RvRo\r\n  double RvRo = rawValue * (3.3 \/ 1023);\r\n\r\n  return (pow(4.7,( ((log(RvRo)-H2Curve[1])\/H2Curve[2]) + H2Curve[0])));\r\n  \r\n}\r\n\/\/ Carbon Monoxide &amp; Flammable Gas Sensor - MQ-9\r\nint isMQ9(double rawValue) {\r\n\r\n  double RvRo = rawValue * 3.3 \/ 4095;\r\n\r\n  double ppm = 3.027*exp(1.0698*( RvRo ));\r\n  return ppm;\r\n  \r\n}\r\n\/\/ Carbon Monoxide Gas Sensor - MQ-7\r\nint isMQ7(double rawValue) {\r\n\r\n  double RvRo = rawValue * 3.3 \/ 4095;\r\n\r\n  double ppm = 3.027*exp(1.0698*( RvRo ));\r\n  return ppm;\r\n  \r\n}\r\n\/\/ Alcohol Gas Sensor - MQ-3\r\nint isMQ3(double rawValue) {\r\n\r\n  double RvRo = rawValue * 3.3 \/ 4095;\r\n\r\n  double bac = RvRo * 0.21;\r\n  return bac;\r\n  \r\n}\r\n<\/pre>\n<p><strong>getPIR.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ PIR Motion\r\n\/\/ Setup PIR\r\nvoid setupPIR() {\r\n\r\n  \/\/ Setup PIR Montion\r\n  pinMode(iMotion, INPUT_PULLUP);\r\n  \r\n}\r\n\/\/ isPIR Motion\r\nvoid isPIR() {\r\n\r\n  \/\/ Proximity\r\n  proximity = digitalRead(iMotion);\r\n  if (proximity == LOW) \r\n  {\r\n\r\n    \/\/ PIR Motion Sensor&#039;s LOW, Motion is detected\r\n    Det = &quot;Motion Yes&quot;;\r\n\r\n  }\r\n  else\r\n  {\r\n\r\n    \/\/ PIR Motion Sensor&#039;s HIGH\r\n    Det = &quot;No&quot;;\r\n    \r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getRGBLCDShield.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Adafruit RGB LCD Shield\r\n\/\/ Setup RGB LCD Shield\r\nvoid isSetupRGBLCDShield() {\r\n\r\n  \/\/ Adafruit RGB LCD Shield\r\n  \/\/ Set up the LCD&#039;s number of columns and rows: \r\n  RGBLCDShield.begin(16, 2);\r\n\r\n  \/\/ Set the cursor to column 0, line 0\r\n  RGBLCDShield.setBacklight(RED);\r\n  \/\/ Don luc \r\n  RGBLCDShield.setCursor(0,0);\r\n  RGBLCDShield.print(&quot;Don Luc&quot;);\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  \/\/ Electronics\r\n  RGBLCDShield.print(&quot;Electronics&quot;);\r\n  \/\/ Delay\r\n  delay(5000);\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n\r\n  \/\/ Set the cursor to column 0, line 0\r\n  RGBLCDShield.setBacklight(TEAL);\r\n  \/\/ Version \r\n  RGBLCDShield.setCursor(0,0);\r\n  RGBLCDShield.print(&quot;Version: &quot; + sver);\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  \/\/ Unit ID\r\n  RGBLCDShield.print(&quot;Unit ID: &quot; + uid);\r\n  \/\/ Delay\r\n  delay(5000);\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n  \r\n}\r\n\/\/ isDisplay\r\nvoid isDisplay() {\r\n\r\n  \/\/ Momentary Button\r\n  momentaryButton = RGBLCDShield.readButtons();\r\n\r\n  switch ( yy ) {\r\n    case 1:\r\n    \r\n      \/\/ RHT Temperature and Humidity Sensor\r\n      \/\/ Set the cursor to column 0, line 0\r\n      RGBLCDShield.setCursor(0,0);\r\n      \/\/ Temperature C\r\n      RGBLCDShield.print( &quot;Temp C: &quot; );\r\n      RGBLCDShield.print( latestTempC );\r\n      \/\/ Set the cursor to column 0, line 1\r\n      RGBLCDShield.setCursor(0, 1);\r\n      \/\/ Humidity\r\n      RGBLCDShield.print( &quot;Humidity: &quot; );\r\n      RGBLCDShield.print( latestHumidity );\r\n\r\n      break;\r\n    case 2:\r\n    \r\n      \/\/ PIR Motion Sensor\r\n      \/\/ Set the cursor to column 0, line 0\r\n      \/\/ PIR Motion Sensor\r\n      RGBLCDShield.setCursor(0,0);\r\n      RGBLCDShield.print( &quot;PIR Motion&quot; );\r\n      \/\/ Set the cursor to column 0, line 1\r\n      RGBLCDShield.setCursor(0, 1);\r\n      \/\/ Det\r\n      RGBLCDShield.print( Det );\r\n      \r\n      break;\r\n    case 3:\r\n\r\n      \/\/ Gas Sensors 1\r\n      \/\/ Set the cursor to column 0, line 0\r\n      RGBLCDShield.setCursor(0,0);\r\n      \/\/ Hydrogen Gas Sensor - MQ-8\r\n      RGBLCDShield.print( &quot;MQ-8: &quot; );\r\n      RGBLCDShield.print( iMQ8ppm );\r\n      \/\/ Set the cursor to column 0, line 1\r\n      RGBLCDShield.setCursor(0, 1);\r\n      \/\/ Carbon Monoxide &amp; Flammable Gas Sensor - MQ-9\r\n      RGBLCDShield.print( &quot;MQ-9: &quot; );\r\n      RGBLCDShield.print( iMQ9ppm );\r\n      \r\n      break;\r\n    case 4:\r\n\r\n      \/\/ Gas Sensors 2\r\n      \/\/ Set the cursor to column 0, line 0\r\n      RGBLCDShield.setCursor(0,0);\r\n      \/\/ Carbon Monoxide Gas Sensor - MQ-7\r\n      RGBLCDShield.print( &quot;MQ-7: &quot; );\r\n      RGBLCDShield.print( iMQ7ppm );\r\n      \/\/ Set the cursor to column 0, line 1\r\n      RGBLCDShield.setCursor(0, 1);\r\n      \/\/ Alcohol Gas Sensor - MQ-3\r\n      RGBLCDShield.print( &quot;MQ-3: &quot; );\r\n      RGBLCDShield.print( iMQ3ppm );\r\n      \r\n      break;\r\n    case 5:\r\n\r\n      \/\/ DS3231 RTC Date and Time\r\n      \/\/ Date and Time\r\n      DateTime now = rtc.now();\r\n      \/\/ Set the cursor to column 0, line 0\r\n      \/\/ Date \r\n      RGBLCDShield.setCursor(0,0);\r\n      RGBLCDShield.print( sDate );\r\n      \/\/ Set the cursor to column 0, line 1\r\n      RGBLCDShield.setCursor(0, 1);\r\n      \/\/ Time\r\n      RGBLCDShield.print( sTime );\r\n      \r\n      break;\r\n    default:\r\n\r\n      \/\/ Don luc Electronics\r\n      yy = 5;\r\n      RGBLCDShield.setBacklight(RED);\r\n      \/\/ Set the cursor to column 0, line 0\r\n      \/\/ Don luc \r\n      RGBLCDShield.setCursor(0,0);\r\n      RGBLCDShield.print(&quot;Don Luc&quot;);\r\n      \/\/ Set the cursor to column 0, line 1\r\n      RGBLCDShield.setCursor(0, 1);\r\n      \/\/ Electronics\r\n      RGBLCDShield.print(&quot;Electronics&quot;);\r\n\r\n   }\r\n   \r\n   if ( momentaryButton ) {\r\n    \r\n    if ( momentaryButton &amp; BUTTON_UP ) {\r\n      \r\n      yy = 1;\r\n      \/\/ RHT Temperature and Humidity Sensor\r\n      RGBLCDShield.setBacklight(GREEN);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_DOWN ) {\r\n      \r\n      yy = 2;\r\n      \/\/ PIR Motion Sensor\r\n      RGBLCDShield.setBacklight(VIOLET);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_LEFT ) {\r\n      \r\n      yy = 3;\r\n      \/\/ Gas Sensors 1\r\n      RGBLCDShield.setBacklight(TEAL);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_RIGHT ) {\r\n\r\n      yy = 4;\r\n      \/\/ Gas Sensors 2\r\n      RGBLCDShield.setBacklight(YELLOW);\r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_SELECT ) {\r\n\r\n      yy = 5;\r\n      \/\/ DS3231 RTC Date and Time\r\n      RGBLCDShield.setBacklight(WHITE);\r\n   \r\n    }\r\n    \r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getRHT.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ RHT Temperature and Humidity Sensor\r\n\/\/ setup RHT Temperature and Humidity Sensor\r\nvoid setupRTH03() {\r\n\r\n  \/\/ RHT Temperature and Humidity Sensor\r\n  \/\/ Call rht.begin() to initialize the sensor and our data pin\r\n  rht.begin(RHT03_DATA_PIN);\r\n  \r\n}\r\n\/\/ RHT Temperature and Humidity Sensor\r\nvoid isRHT03(){\r\n\r\n  \/\/ Call rht.update() to get new humidity and temperature values from the sensor.\r\n  int updateRet = rht.update();\r\n\r\n  \/\/ The humidity(), tempC(), and tempF() functions can be called -- after \r\n  \/\/ a successful update() -- to get the last humidity and temperature value \r\n  latestHumidity = rht.humidity();\r\n  latestTempC = rht.tempC();\r\n\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>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 Unique ID\r\n  isUID();\r\n  \r\n  \/\/ RHT Temperature and Humidity Sensor\r\n  \/\/ Setup RTH03 Temperature and Humidity Sensor\r\n  setupRTH03();\r\n\r\n  \/\/ PIR Motion\r\n  \/\/ Setup PIR\r\n  setupPIR();\r\n\r\n  \/\/ Setup DS3231 RTC\r\n  isSetupRTC();\r\n\r\n  \/\/ Initialize digital pin LED_BUILTIN as an output.\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n\r\n  \/\/ Adafruit RGB LCD Shield\r\n  isSetupRGBLCDShield();\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>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/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 and E-Mentor<\/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\/luc\/<\/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 #Environment #MQ #PIR #RHT03 #RTC #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; ChronoDot &#8211; Ultra-Precise Real Time Clock &#8211; v2.1 The ChronoDot RTC is an extremely accurate real time clock module, based on the DS3231 temperature compensated RTC. It includes a CR1632 battery, which should &#8230; <a title=\"Project #15: Environment \u2013 ChronoDot \u2013 Mk16\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=2888\" aria-label=\"Read more about Project #15: Environment \u2013 ChronoDot \u2013 Mk16\">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":[106,47,50,49,38,59,5,46,58,10,43],"tags":[86,6,92,181,102,4,87,19,107,85,24,93,103,9,27,88,109,33,34],"class_list":["post-2888","post","type-post","status-publish","format-standard","hentry","category-environment","category-adafruit","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-microcontrollers","category-pololu","category-arduino-programming","category-projects","category-sparkfun","tag-adafruit","tag-arduino","tag-battery","tag-chronodot","tag-components","tag-consultant","tag-display","tag-electronics","tag-environment","tag-fritzing","tag-microcontroller","tag-pir-motion-sensor","tag-pololu","tag-programming","tag-projects-2","tag-rht03-humidity-and-temperature-sensor","tag-sparkfun","tag-technology","tag-video-blog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2888","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=2888"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2888\/revisions"}],"predecessor-version":[{"id":2894,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2888\/revisions\/2894"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}