{"id":4617,"date":"2025-12-03T09:04:11","date_gmt":"2025-12-03T17:04:11","guid":{"rendered":"https:\/\/www.donluc.com\/?p=4617"},"modified":"2025-12-03T09:04:11","modified_gmt":"2025-12-03T17:04:11","slug":"project-28-sensors-conductivity-sensor-switch-mk18","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=4617","title":{"rendered":"Project #28 \u2013 Sensors \u2013 Conductivity Sensor Switch \u2013 Mk18"},"content":{"rendered":"<div style=\"width: 1200px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-4617-1\" width=\"1200\" height=\"675\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #ConductivitySwitch #FireBeetle2ESP32E #ESP32 #DFRobot #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04a.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04a.jpg\" alt=\"Conductivity Sensor Switch\" width=\"720\" height=\"639\" class=\"alignnone size-full wp-image-4619\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04a.jpg 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04a-300x266.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\/12\/DL2511Mk04b.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04b.jpg\" alt=\"Conductivity Sensor Switch\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-4620\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04b.jpg 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04b-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\/12\/DL2511Mk04c.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04c.jpg\" alt=\"Conductivity Sensor Switch\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-4621\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04c.jpg 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2025\/12\/DL2511Mk04c-300x200.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Gravity: Conductivity Sensor Switch<\/strong><\/p>\n<p>The Gravity Conductivity Sensor Switch module can be used to detect if an object has electrical conductivity. Its maximum detection value is 10 Mega Ohm. It can detect not only coins, wires, metal and other good conductors, but also the human body, fruit, plants and other conductors.<\/p>\n<p><strong>DL2511Mk04<\/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 Gravity: IO Shield for FireBeetle 2<br \/>\n1 x Gravity: Conductivity Sensor Switch<br \/>\n1 x Gravity: Digital RGB LED Module<br \/>\n1 x Lithium Ion Battery &#8211; 1000mAh<br \/>\n1 x Switch<br \/>\n1 x USB 3.0 to Type-C Cable<\/p>\n<p><strong>DL2511Mk04p<\/strong><\/p>\n<p><strong>DL2511Mk04p.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 #28 \u2013 Sensors \u2013 Conductivity Sensor Switch \u2013 Mk18\r\n28-18\r\nDL2511Mk04p.ino\r\nDL2511Mk04\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 Gravity: IO Shield for FireBeetle 2\r\n1 x Gravity: Conductivity Sensor Switch\r\n1 x Gravity: Digital RGB LED Module\r\n1 x Lithium Ion Battery - 1000mAh\r\n1 x Switch\r\n1 x USB 3.0 to Type-C Cable\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 &quot;Arduino.h&quot;\r\n\/\/ DFRobot Display GDL API\r\n#include &lt;DFRobot_GDL.h&gt;\r\n\/\/ Adafruit NeoPixel\r\n#include &lt;Adafruit_NeoPixel.h&gt;\r\n\r\n\/\/ Conductivity\r\nint iConductivity = D10;\r\n\/\/ Value\r\nint iVal;\r\n\/\/ OO\r\nString sOO;\r\n\r\n\/\/ Which pin on the Arduino is connected to the NeoPixels?\r\n#define iNeo D11\r\n\/\/ How many NeoPixels are attached to the Arduino?\r\n#define NUMPIXELS 1\r\n\/\/ When setting up the NeoPixel library.\r\nAdafruit_NeoPixel pixels(NUMPIXELS, iNeo, NEO_GRB + NEO_KHZ800);\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;28-18&quot;;\r\n\r\nvoid loop() {\r\n  \r\n  \/\/ isConductivity\r\n  isConductivity();\r\n\r\n  \/\/ isDisplayConductivity\r\n  isDisplayConductivity();\r\n\r\n  \/\/ Delay\r\n  delay( 1000 );\r\n  \r\n}\r\n<\/pre>\n<p><strong>getConductivity.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Conductivity\r\n\/\/ isConductivity\r\nvoid isConductivity(){\r\n  \r\n  \/\/ Set all pixel colors to &#039;Off&#039;\r\n  pixels.clear();\r\n\r\n  \/\/ Read the value from the sensor:\r\n  iVal = digitalRead(iConductivity);\r\n \r\n  \/\/ Sound Sensor\r\n  if( iVal == HIGH ) { \r\n        \r\n       \/\/ The first NeoPixel in a strand is #0, second is 1, all the way up\r\n       \/\/ to the count of pixels minus one. \/\/ For each pixel...\r\n       for(int i=0; i&lt;NUMPIXELS; i++) { \r\n\r\n          \/\/ pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255\r\n          \/\/ Green\r\n          pixels.setPixelColor(i, pixels.Color(0, 255, 0));\r\n\r\n          \/\/ Send the updated pixel colors to the hardware.\r\n          pixels.show(); \r\n\r\n        }\r\n\r\n    \/\/ On\r\n    sOO = &quot;On&quot;;\r\n\r\n  }\r\n   else{\r\n        \r\n      \/\/ The first NeoPixel in a strand is #0, second is 1, all the way up\r\n       \/\/ to the count of pixels minus one. \/\/ For each pixel...\r\n       for(int i=0; i&lt;NUMPIXELS; i++) { \r\n\r\n          \/\/ pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255\r\n          \/\/ Red\r\n          pixels.setPixelColor(i, pixels.Color(255, 0, 0));\r\n\r\n          \/\/ Send the updated pixel colors to the hardware.\r\n          pixels.show(); \r\n\r\n      }\r\n\r\n    \/\/ Off\r\n    sOO = &quot;Off&quot;;  \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  \/\/ SD\r\n  screen.setCursor(0, 60);\r\n  screen.println(&quot;Conductivity&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\/\/ isDisplayConductivity\r\nvoid isDisplayConductivity(){\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  \/\/ Sound Sensor\r\n  screen.setCursor(0, 30);\r\n  screen.println(&quot;Conductivity&quot;);\r\n  \/\/ Val\r\n  screen.setCursor(0, 60);\r\n  screen.println( iVal );\r\n  \/\/ On Off\r\n  screen.setCursor(0, 90);\r\n  screen.println( sOO );\r\n\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>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  \/\/ 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  \/\/ INITIALIZE NeoPixel strip object\r\n  pixels.begin();\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  \/\/ Conductivity\r\n  pinMode(iConductivity,INPUT);\r\n\r\n  \/\/ Delay\r\n  delay(100);\r\n\r\n  \/\/ DFRobot Display 240x320 - UID\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>Consultant, R&#038;D, Electronics, IoT, Teacher and Instructor<\/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 , Underwater and UAV Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial,  Marine and UAV<\/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>DFRobot:<\/strong> https:\/\/learn.dfrobot.com\/user-10186.html<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>Hackster:<\/strong> https:\/\/www.hackster.io\/luc-paquin<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 #ConductivitySwitch #FireBeetle2ESP32E #ESP32 #DFRobot #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Gravity: Conductivity Sensor Switch The Gravity Conductivity Sensor Switch module can be used to detect if an object has electrical conductivity. Its maximum detection value is 10 Mega Ohm. It can detect not only coins, wires, &#8230; <a title=\"Project #28 \u2013 Sensors \u2013 Conductivity Sensor Switch \u2013 Mk18\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=4617\" aria-label=\"Read more about Project #28 \u2013 Sensors \u2013 Conductivity Sensor Switch \u2013 Mk18\">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":[294,50,49,317,38,80,59,115,5,287,58,82,10],"tags":[6,92,102,404,4,320,87,19,83,85,24,9,84,27,248,33,34,108],"class_list":["post-4617","post","type-post","status-publish","format-standard","hentry","category-sensors","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-arduino","tag-battery","tag-components","tag-conductivity-sensor-switch","tag-consultant","tag-dfrobot","tag-display","tag-electronics","tag-esp32","tag-fritzing","tag-microcontroller","tag-programming","tag-programming-esp32","tag-projects-2","tag-sensors","tag-technology","tag-video-blog","tag-vlog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/4617","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=4617"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/4617\/revisions"}],"predecessor-version":[{"id":4622,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/4617\/revisions\/4622"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}