{"id":85775,"date":"2019-05-31T13:59:09","date_gmt":"2019-05-31T13:59:09","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=85775"},"modified":"2019-05-31T18:56:44","modified_gmt":"2019-05-31T18:56:44","slug":"esp32-touch-pins-arduino-ide","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-touch-pins-arduino-ide\/","title":{"rendered":"ESP32 Capacitive Touch Sensor Pins with Arduino IDE"},"content":{"rendered":"\n<p>This article shows how to use the ESP32 touch pins with Arduino IDE. The ESP32 touch pins can sense variations in anything that holds an electrical charge. They are often used to wake up the <a href=\"https:\/\/randomnerdtutorials.com\/esp32-touch-wake-up-deep-sleep\/\">ESP32 from deep sleep<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/ESP32-Touch-Sensor-Pins-Arduino-IDE.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 Touch Pins with Arduino IDE\" class=\"wp-image-85806\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/ESP32-Touch-Sensor-Pins-Arduino-IDE.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/ESP32-Touch-Sensor-Pins-Arduino-IDE.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/ESP32-Touch-Sensor-Pins-Arduino-IDE.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/ESP32-Touch-Sensor-Pins-Arduino-IDE.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<p class=\"rntbox rntclgreen\">To read the value of the ESP32 touch pins, use the <span class=\"rnthl rntliteral\">touchRead(GPIO)<\/span> function, that accepts as argument, the GPIO you want to read. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Watch the Video Tutorial<\/h2>\n\n\n\n<p>You can watch the video tutorial or keep reading this page for the written instructions. <\/p>\n\n\n<p style=\"text-align:center\"><iframe width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/40tyJfvpcxw?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introducing the ESP32 Touch Sensor<\/h2>\n\n\n\n<p>The ESP32 has 10 capacitive touch GPIOs. These GPIOs can sense variations in anything that holds an electrical charge, like the human skin. So they can detect variations induced when touching the GPIOs with a finger.<\/p>\n\n\n\n<p>These pins can be easily integrated into capacitive pads, and replace mechanical buttons. Additionally, the touch pins can also be used as a <a href=\"https:\/\/randomnerdtutorials.com\/esp32-touch-wake-up-deep-sleep\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"wake up source when the ESP32 is in deep sleep (opens in a new tab)\">wake up source when the ESP32 is in deep sleep<\/a>. <\/p>\n\n\n\n<p>Take a look at your board pinout to locate the 10 different touch sensors \u2013 the touch sensitive pins are highlighted in pink color.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/ESP32-DOIT-DEVKIT-V1-Board-Pinout-30-GPIOs-Copy.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"966\" height=\"574\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/ESP32-DOIT-DEVKIT-V1-Board-Pinout-30-GPIOs-Copy.png?resize=966%2C574&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 Touch Sensitive Pins GPIOs\" class=\"wp-image-72035\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/ESP32-DOIT-DEVKIT-V1-Board-Pinout-30-GPIOs-Copy.png?w=966&amp;quality=100&amp;strip=all&amp;ssl=1 966w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/ESP32-DOIT-DEVKIT-V1-Board-Pinout-30-GPIOs-Copy.png?resize=300%2C178&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/ESP32-DOIT-DEVKIT-V1-Board-Pinout-30-GPIOs-Copy.png?resize=768%2C456&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 966px) 100vw, 966px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Learn more about the ESP32 GPIOs: <a href=\"https:\/\/randomnerdtutorials.com\/esp32-pinout-reference-gpios\/\">ESP32 Pinout Reference<\/a>. <\/p>\n\n\n\n<p>You can see that touch sensor 0 corresponds to GPIO 4, touch sensor 2 to GPIO 2, and so on.<\/p>\n\n\n\n<p class=\"rntbox rntclblue\"><strong>Note: <\/strong> Touch sensor 1 is GPIO 0. However, it\u2019s not available as a pin in this particular ESP32 development board (version with 30 GPIOs). GPIO 0 is available on the version with 36 pins.<\/p>\n\n\n\n<p class=\"rntbox rntclgreen\"><strong>Note: <\/strong> at the time of writing this tutorial, there is an issue with touch pin assignment in Arduino IDE. GPIO 33 is swapped with GPIO 32 in the assignment. This means that if you want to refer to GPIO 32 you should use T8 in the code. If you want to refer to GPIO33 you should use T9. If you don\u2019t have this issue, please ignore this note.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">touchRead()<\/h2>\n\n\n\n<p>Reading the touch sensor is straightforward. In the Arduino IDE, you use the <span class=\"rnthl rntliteral\">touchRead()<\/span> function, that accepts as argument, the GPIO you want to read.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>touchRead(GPIO);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Code \u2013 Reading the Touch Sensor<\/h2>\n\n\n\n<p>We\u2019ll program the ESP32 using Arduino IDE, so make sure you have the ESP32 add-on installed before proceeding:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><a rel=\"noreferrer noopener\" href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-windows-instructions\/\" target=\"_blank\">Windows<\/a><\/strong><a rel=\"noreferrer noopener\" href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-windows-instructions\/\" target=\"_blank\">&nbsp;instructions \u2013 ESP32 Board in Arduino IDE<\/a><\/li><li><strong><a rel=\"noreferrer noopener\" href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-mac-and-linux-instructions\/\" target=\"_blank\">Mac and Linux<\/a><\/strong><a rel=\"noreferrer noopener\" href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-mac-and-linux-instructions\/\" target=\"_blank\">&nbsp;instructions \u2013 ESP32 Board in Arduino IDE<\/a><\/li><\/ul>\n\n\n\n<p>Let\u2019s see how that function works by using an example from the library. In the Arduino IDE, go to&nbsp;<strong>File<\/strong>&nbsp;&gt;&nbsp;<strong>Examples<\/strong>&nbsp;&gt;&nbsp;<strong>ESP32<\/strong>&nbsp;&gt;&nbsp;<strong>Touch<\/strong>&nbsp;and open the&nbsp;<strong>TouchRead<\/strong>&nbsp;sketch.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/\/ ESP32 Touch Test\n\/\/ Just test touch pin - Touch0 is T0 which is on GPIO 4.\n\nvoid setup() {\n  Serial.begin(115200);\n  delay(1000); \/\/ give me time to bring up serial monitor\n  Serial.println(&quot;ESP32 Touch Test&quot;);\n}\n\nvoid loop() {\n  Serial.println(touchRead(4));  \/\/ get value of Touch 0 pin = GPIO 4\n  delay(1000);\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP32-Course\/raw\/master\/code\/TouchRead\/TouchRead.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>This example reads the touch pin 0 and displays the results in the Serial Monitor.<\/p>\n\n\n\n<p>The T0 pin (touch pin 0), corresponds to GPIO 4, as we\u2019ve seen previously in the pinout.<\/p>\n\n\n\n<p>In this code, in the <span class=\"rnthl rntliteral\">setup()<\/span>, you start by initializing the Serial Monitor to display the sensor readings.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.begin(115200);<\/code><\/pre>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span> is where you read the sensor.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.println(touchRead(4));<\/code><\/pre>\n\n\n\n<p>Use the <span class=\"rnthl rntliteral\">touchRead()<\/span> function, and pass as an argument the pin you want to read. In this case, the example uses T0, which is the touch sensor 0, in GPIO 4. You can either pass the touch sensor number (T0) or the GPIO number (4).<\/p>\n\n\n\n<p>Now, upload the code to your ESP32 board. Make sure you have the right board and COM port selected.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Testing the sketch example<\/h3>\n\n\n\n<p>Connect a jumper wire to GPIO 4. You will touch the metal part of this wire so that it senses the touch.<\/p>\n\n\n\n<p>In the Arduino IDE window, go to&nbsp;<strong>Tools<\/strong>&nbsp;and open the Serial Monitor at a baud rate of 115200. You\u2019ll see the new values being displayed every second.<\/p>\n\n\n\n<p>Touch the wire connected to <span class=\"rnthl rntcgreen\">GPIO 4<\/span> and you\u2019ll see the values decreasing.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"700\" height=\"413\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-GPIO4.jpg?resize=700%2C413&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 Touch Pins with Arduino IDE Demonstration\" class=\"wp-image-85777\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-GPIO4.jpg?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-GPIO4.jpg?resize=300%2C177&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<p>You can also use the serial plotter to better see the values. Close the serial monitor, go to&nbsp;<strong>Tools<\/strong>&nbsp;&gt;&nbsp;<strong>Serial<\/strong><strong>Plotter<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"393\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-serial-plotter.jpg?resize=658%2C393&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 Touch Pins with Arduino IDE Demonstration Serial Plotter\" class=\"wp-image-85778\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-serial-plotter.jpg?w=658&amp;quality=100&amp;strip=all&amp;ssl=1 658w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-serial-plotter.jpg?resize=300%2C179&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 658px) 100vw, 658px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Touch Sensitive LED<\/h2>\n\n\n\n<p>You can use this feature to control outputs. In this example, we&#8217;ll build a simple touch controlled LED circuit. When you touch the GPIO with your finger, the LED lights up.<\/p>\n\n\n\n<p>For this example, you need the following parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\">ESP32 DOIT DEVKIT V1 Board<\/a> (read <a href=\"https:\/\/makeradvisor.com\/esp32-development-boards-review-comparison\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Best ESP32 Development Boards (opens in a new tab)\">Best ESP32 Development Boards<\/a>)<\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/3mm-5mm-leds-kit-storage-box\/\" target=\"_blank\">5mm LED<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\" target=\"_blank\">330 Ohm resistor<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\">Breadboard<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\">Jumper wires<\/a><\/li><\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Finding the threshold value<\/h3>\n\n\n\n<p>Grab a piece of aluminium foil, cut a small square, and wrap it around the wire as shown in the following figure.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"387\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/alluminium-foil_f.jpg?resize=700%2C387&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 Touch Pins with Arduino IDE threshold\" class=\"wp-image-85779\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/alluminium-foil_f.jpg?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/alluminium-foil_f.jpg?resize=300%2C166&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<p>With the previous code running, go back to the serial monitor.<\/p>\n\n\n\n<p>Now, touch the aluminium foil, and you\u2019ll see the values changing again.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"401\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-GPIO4-alluminium-foil.jpg?resize=700%2C401&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 Touch Pins with Arduino IDE Demonstration with aluminium foil\" class=\"wp-image-85780\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-GPIO4-alluminium-foil.jpg?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-GPIO4-alluminium-foil.jpg?resize=300%2C172&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<p>In our case, when we&#8217;re not touching the pin, the normal value is above 70. And when we touch the aluminum foil it drops to some value below 10.<\/p>\n\n\n\n<p>So, we can set a threshold value, and when the reading goes below that value, an LED lights up. A good threshold value in this case is 20, for example.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Schematic<\/h3>\n\n\n\n<p>Add an LED to your circuit by following the next schematic diagram. In this case, we&#8217;re connecting the LED to <span class=\"rnthl rntcblue\">GPIO 16<\/span>. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"745\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch_sensitive_led_schematic.jpg?resize=768%2C745&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Touch Sensitive LED with ESP32 Touch Pins Schematic Diagram\" class=\"wp-image-85781\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch_sensitive_led_schematic.jpg?w=768&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch_sensitive_led_schematic.jpg?resize=300%2C291&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Code<\/h3>\n\n\n\n<p>Copy the following code to your Arduino IDE.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/\/ set pin numbers\nconst int touchPin = 4; \nconst int ledPin = 16;\n\n\/\/ change with your threshold value\nconst int threshold = 20;\n\/\/ variable for storing the touch pin value \nint touchValue;\n\nvoid setup(){\n  Serial.begin(115200);\n  delay(1000); \/\/ give me time to bring up serial monitor\n  \/\/ initialize the LED pin as an output:\n  pinMode (ledPin, OUTPUT);\n}\n\nvoid loop(){\n  \/\/ read the state of the pushbutton value:\n  touchValue = touchRead(touchPin);\n  Serial.print(touchValue);\n  \/\/ check if the touchValue is below the threshold\n  \/\/ if it is, set ledPin to HIGH\n  if(touchValue &lt; threshold){\n    \/\/ turn LED on\n    digitalWrite(ledPin, HIGH);\n    Serial.println(&quot; - LED on&quot;);\n  }\n  else{\n    \/\/ turn LED off\n    digitalWrite(ledPin, LOW);\n    Serial.println(&quot; - LED off&quot;);\n  }\n  delay(500);\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP32-Course\/raw\/master\/code\/Touch_Sensitive_LED\/Touch_Sensitive_LED.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>This code reads the touch value from the pin we\u2019ve defined, and lights up an LED when the value is below the threshold. This means that when you place your finger in the aluminium pad, the LED lights up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Testing the Project<\/h3>\n\n\n\n<p>Upload the sketch to your ESP32. Now, test your circuit. Touch the aluminum foil and see the LED lighting up.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"390\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-sensitive-led.jpg?resize=700%2C390&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Touch Sensitive LED with ESP32 Touch Pins Demonstration\" class=\"wp-image-85782\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-sensitive-led.jpg?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/touch-sensitive-led.jpg?resize=300%2C167&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial you&#8217;ve learned how to use the ESP32 touch pins. In summary:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The ESP32 has 10 capacitive touch GPIOs.<\/li><li>When you touch a touch-sensitive GPIO, the value read by the sensor drops.<\/li><li>You can set a threshold value to make something happen when it detects touch.<\/li><li>The ESP32 touch pins can be used to wake up the ESP32 from deep sleep.<\/li><\/ul>\n\n\n\n<p>We hope you&#8217;ve found this tutorial interesting. If you want to learn more about the ESP32, enroll in our course: <a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">Learn ESP32 with Arduino IDE<\/a>.<\/p>\n\n\n\n<p>You might also want to take a look at our <a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32\/\">free ESP32 projects and tutorials<\/a>.<\/p>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article shows how to use the ESP32 touch pins with Arduino IDE. The ESP32 touch pins can sense variations in anything that holds an electrical charge. They are often &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32 Capacitive Touch Sensor Pins with Arduino IDE\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-touch-pins-arduino-ide\/#more-85775\" aria-label=\"Read more about ESP32 Capacitive Touch Sensor Pins with Arduino IDE\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":85806,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[276,281,277,299,264],"tags":[],"class_list":["post-85775","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-esp32-project","category-esp32-arduino-ide","category-0-esp32","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/05\/ESP32-Touch-Sensor-Pins-Arduino-IDE.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/85775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=85775"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/85775\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/85806"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=85775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=85775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=85775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}