MakerGram Logo

    MakerGram

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups

    ESP32 with a capacitive sensor

    ESP32
    2
    5
    389
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FlorianB last edited by

      Hi! I am trying to add an capacitive sensor to the ESP32, that will work through glass with 3mm thickness and an distance of 8 to 2 cm. I have bought sensors which only work on touch, i have looked into the touchRead() function but cant get a steady value increase/decrease with distance and only a real touch gets me enough difference to count it as a "touch". I have checked Arduino examples with foil where a resistor can set the sensitivity but nothing worked on my ESP32. i have spent hours looking for an example, can somebody point me to one please?

      salmanfaris 1 Reply Last reply Reply Quote 0
      • salmanfaris
        salmanfaris @FlorianB last edited by

        @FlorianB Can you share the code, output window/error and details of the sensor module?

        F 2 Replies Last reply Reply Quote 0
        • F
          FlorianB @salmanfaris last edited by

          @salmanfaris I haven't found a good sensor module for this at all. I used a thing which was calles touch sensor and it returns only 1/0. Tried to use touchRead() but it is not sensitive apparently, only 40 and 1 more or less.

          #define touch_pin_numer 33

          const int VALUE_THRESHOLD = 30;
          int TOUCH_SENSOR_VALUE;
          void setup()
          {
          Serial.begin(115200);
          delay(1000);

          }
          void loop(){
          TOUCH_SENSOR_VALUE = touchRead(touch_pin_numer);
          Serial.println(TOUCH_SENSOR_VALUE);
          if(TOUCH_SENSOR_VALUE < VALUE_THRESHOLD)
          {
          Serial.println ("Touch ON");
          }
          else{
          Serial.println ("Touch OFF");
          }
          }

          should show something between 40 (current max) and 1 (current min) the closer the finger gets but it shows 40/41/39 and 1 - nothing inbetween. got this code from the web

          salmanfaris 1 Reply Last reply Reply Quote 0
          • F
            FlorianB @salmanfaris last edited by

            @salmanfaris best if you could point me to an example that works as described: getting different values depending on hoe close the finger is without really touching. nothing i tried did work yet

            1 Reply Last reply Reply Quote 0
            • salmanfaris
              salmanfaris @FlorianB last edited by salmanfaris

              @FlorianB said in ESP32 with a capacitive sensor:

              I haven't found a good sensor module for this at al

              One of my friend used TP223 Touch button module from Ali express, and it's worked fine also @Akhil also used on of module.

              another option is that you can build capacitive sensor your own with resistors.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Recent Posts

              • A

                @Richu-Bini I'm not sure if this is the root cause but normally, you should add an RC delay on the EN pin. This is because the BOOT pin should reach 3.3V before the EN reaches 3.3V hence, the RC delay on the EN pin. A 10K resistor and a 1μF Cap should do it. Here's a sketch on how it should look like:
                RC delay on ESP.jpg

                Here is the part in the datasheet of the WROOM32 that tells you to do it:
                WROOM_Data.PNG

                • read more
              • R

                @Richu-Bini am using an Arduino uno as ttl module

                • read more
              • Hi @Richu-Bini , What kind of UART/FTDI programmer you are using? Could also share the connection diagram to the module with the programmer?

                and in the diagram I see, you already twisted Rx and Tx, so you should connect the FTDI with the module Esp32 Rx - FTDI Rx and Esp32 TX - FTDI TX.

                7c84a195-7185-4c07-ab28-7270a9017db7-image.png

                • read more
              • R

                WhatsApp Image 2023-05-10 at 12.37.42.jpg

                Showing this message from serial monitor .... i have used an arduino as a TTL module by shorting the GND and reset pin
                WhatsApp Image 2023-05-10 at 09.14.46.jpg

                when i tried to upload the code it is showing this error

                956c990f-9b85-44a5-8c27-1b02402eae4c-image.png

                This is the schematic i used

                • read more
              • @Adithya-SM Can you confirm the I2C address is correct? You can use this I2C Scanner to program to find the correct address

                // -------------------------------------- // i2c_scanner // // Modified from https://playground.arduino.cc/Main/I2cScanner/ // -------------------------------------- #include <Wire.h> // Set I2C bus to use: Wire, Wire1, etc. #define WIRE Wire void setup() { WIRE.begin(); Serial.begin(9600); while (!Serial) delay(10); Serial.println("\nI2C Scanner"); } void loop() { byte error, address; int nDevices; Serial.println("Scanning..."); nDevices = 0; for(address = 1; address < 127; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. WIRE.beginTransmission(address); error = WIRE.endTransmission(); if (error == 0) { Serial.print("I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.print(address,HEX); Serial.println(" !"); nDevices++; } else if (error==4) { Serial.print("Unknown error at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); } } if (nDevices == 0) Serial.println("No I2C devices found\n"); else Serial.println("done\n"); delay(5000); // wait 5 seconds for next scan }

                • read more
              By MakerGram | A XiStart Initiative | Built with ♥ NodeBB
              Copyright © 2023 MakerGram, All rights reserved.
              Privacy Policy | Terms & Conditions | Disclaimer | Code of Conduct