• 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 https://thecustomizewindows com/2019/07/esp32-arduino-glass-touch-button-cheap-diy-method/ , esp 32 touch button , esp32 touch , esp32 touch button , example esp32 button , smart glasses with esp32
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

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • How to Control Multiple Relays With Single Arduino ESP32?

    Before How to Control Multiple Relays With Single Arduino ESP32 Testing, You Need to Learn How to Create Multiple MQTT Channels & Fetch Data.

  • WROOM ESP32 Example Codes For IBM Watson IoT Platform

    Here Are Few WROOM ESP32 Example Codes For IBM Watson IoT Platform So That Anyone Can Get Started With Both of Them Without Huge Experience.

  • Control Multiple AC Appliances With One ESP32 Arduino

    Here is how to use ESP32 and IBM Watson IoT to control multiple relays (i.e. multiple AC appliances) by pushbutton and over the internet.

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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
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