• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » ESP32 Arduino Glass Touch Button : Cheap DIY Method

By Abhishek Ghosh July 29, 2019 5:43 pm Updated on July 29, 2019

ESP32 Arduino Glass Touch Button : Cheap DIY Method

Advertisement

Earlier, we published a theoretical article named How to Build ESP32 Arduino Glass Touch Switch With LED. Here is How to Develop Your Own ESP32 Arduino Glass Touch Button in Cheap DIY Way and Calibrate it to the Best Result. Minimal resources needed for this project. In future, we will improve this thing with backlit LED. The above-linked article will give you a link to Espressif GitHub resources.

The fundamental about using metal electrode with glass top is keeping the resistance too low i.e. ESP32’s touch pin and the metal electrode should be as close as possible. Also, the metal electrode made of gold, copper, silver will work better than aluminium. For this project, we used ordinary aluminium foil.

NXP PCF8883 IC is a P-type MOSFET which will offer more advanced features than ESP32 when the coding part is not possible to deploy. Generic TTP22301 IC another similar IC. In a separate article, we will discuss how to develop a similar touch button with basic electronic components. Touch button created in this way with ESP32 will offer more ways to control than just touching, for example using Alexa with Watson IoT Platform, IR remote control and so on.

Advertisement

---

 

ESP32 Arduino Glass Touch Button : Calibration

 

You need just the ESP32, Arduino IDE, aluminium foil to create electrode and a piece of glass. ESP32 has onboard LED on Pin 2. ESP32 has 10 capacitive touch pins. These pins can be easily integrated into metal pads. You should cross-check this list from the illustration :

TOUCH0 = pin 4
TOUCH1 = no pin
TOUCH2 = pin 2
TOUCH3 = pin 15
TOUCH4 = pin 13
TOUCH5 = pin 12
TOUCH6 = pin 14
TOUCH7 = pin 27
TOUCH8 = pin 33
TOUCH9 = pin 32

We will later discuss how to use touch to wake up ESP32 from deep sleep. In the Arduino IDE, we can go to File > Examples > ESP32 > Touch and open the TouchRead sketch. The below code will help to calibrate :

Vim
1
2
3
4
5
6
7
8
9
10
void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("ESP32 Touch Testing");
}
 
void loop() {
  Serial.println(touchRead(4));  
  delay(1000);
}

The T0 pin corresponds to GPIO 4. For the above code, you’ll connect the pin 4 with the aluminium foil as the metal electrode. In the Arduino IDE, go to Tools and open the Serial Monitor at a baud rate of 115200. Touch it a few times to watch the change in value. Close the serial monitor, go to Tools > SerialPlotter. Touch it a few times again to watch the change in value.

The initial value and value while touching the naked pin varies. For my ESP32, the maximum value when not pin touched was 73. Touching the naked pin (number 4), made the value drops to near zero. Touching pin connected aluminium foil made the value down to 10. Now, place a glass over the pin connected aluminium foil. You will notice that upon touching the glass, the value drops to near 60.

In my case, 60 is the cut-off value. It is too high considering the max value is 73. For real production, we need to tweak the material, connection to bring the touching glass event lower to 50 or lesser. That value is “threshold value” for our next part.

 

Control LED with ESP32 Arduino Glass Touch Button

 

With the same setup, we can light up the onboard LED of ESP32. Adjust the “threshold value” :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const int touchPin = 4;
const int ledPin = 2;
 
// change with your threshold value
const int threshold = 65;
// variable for storing the touch pin value
int touchValue;
 
void setup(){
  Serial.begin(115200);
  delay(1000); // give me time to bring up serial monitor
  // initialize the LED pin as an output:
  pinMode (ledPin, OUTPUT);
}
 
void loop(){
  // read the state of the pushbutton value:
  touchValue = touchRead(touchPin);
  Serial.print(touchValue);
  // check if the touchValue is below the threshold
  // if it is, set ledPin to HIGH
  if(touchValue < threshold){
    // turn LED on
    digitalWrite(ledPin, HIGH);
    Serial.println(" - LED on");
  }
  else{
    // turn LED off
    digitalWrite(ledPin, LOW);
    Serial.println(" - LED off");
  }
  delay(500);
}

ESP32 Arduino Glass Touch Button

This ends this guide. You can see that one ESP32, a glass panel and one 8 channel relay effectively works as a replacement of the mechanical switches extending our previous guides. There are a lot of advantages of using this kind of switch instead of mechanical including being electric shockproof and glass can be easily cleaned. Cost of ESP32 with a glass panel, one 8 channel relay and power supply to ESP32 will be around $16. That is $2 per touch switch. If we used IC, our cost would go far high up.

We will discuss later how at easy cheap cost you can create LED backlit icons which will work over the glass.

Tagged With esp 32 touch button , esp32 touch , example esp32 button , https://thecustomizewindows com/2019/07/esp32-arduino-glass-touch-button-cheap-diy-method/ , smart glasses with esp32

This Article Has Been Shared 962 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to ESP32 Arduino Glass Touch Button : Cheap DIY Method

  • Arduino Temperature Humidity Sensor : New DHT11, DHT21, DHT22 Test Code

    Here is New Test Codes For Arduino Temperature Humidity Sensor DHT11, DHT21, DHT22 Test Code as Hardware (Not Shields). 2 Libraries Needed.

  • Arduino TFT Touch Screen Calculator (MCUFRIEND) : Part 1

    Arduino TFT Touch Screen Calculator is an Easy Example of Practical Deployment of Programmable Microcontroller From the Libraries.

  • DIY Electronic Component Storage Cabinet : For Arduino Hobbyists

    After Initial Days, Many Arduino Hobbyists Find Difficulty in Storing the Modules, Electronic Components, Tools. Here is an Article on DIY Electronic Component Storage Cabinet.

  • What is I²C Protocol? Relevance of I²C in Arduino

    Previously, we discussed about UART. What is I²C Protocol? I squared C (also pronounced as I-two-C) or I²C is a bus serial communication protocol designed by Philips for home automation and home electronics applications. Since 2006, licensing fees not needed to implement the I²C protocol. Fees needed to obtain I²C slave addresses allocated by NXP. […]

  • M5Stack (ESP32 Arduino) : Modular, Stackable, Wearable IoT Platform

    M5Stack is ESP32 Arduino by heart. It is a modular, stackable, wearable IoT platform for development which is obviously Open Source.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Advantages of Cloud Server Over Dedicated Server for Hosting WordPress March 26, 2023
  • Get Audiophile-Grade Music on Your Smartphone March 25, 2023
  • Simple Windows Security and Privacy Checklist for 2023 March 24, 2023
  • 7 Best Artificial Intelligence (AI) Software March 24, 2023
  • ESP32 Arduino Water Tank Level Monitoring Using Laser ToF Sensor March 23, 2023

About This Article

Cite this article as: Abhishek Ghosh, "ESP32 Arduino Glass Touch Button : Cheap DIY Method," in The Customize Windows, July 29, 2019, March 27, 2023, https://thecustomizewindows.com/2019/07/esp32-arduino-glass-touch-button-cheap-diy-method/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT