Touch at the UN

Hello everyone

yesterday we briefly showed how to use the native touch pins on the ESP32 Uses. For use on the Microcontrollers, compatible with Arduino UNO R3 we need some hardware and a Library. However, the operating principle is the same. In our example, we use as little hardware as possible and limit ourselves to one resistance. Unfortunately, the function cannot be called as conveniently as on the ESP32 with ArduinoIDE.

The necessary hardware:

The assembly, circuit can hardly be called, is quite simple:
Insert the resistance between D2 and D8 into the Uno and then attach the crocodile clamp to the D8 side of the resistance.

Since we want to use as few components as possible in this example, we use the LED integrated in the UN.

The necessary Libary can be found here.

Here is the sample code:

 #include <CapacitiveSensor.H>

CapacitiveSensor   cs_2_8 = CapacitiveSensor(2,8); 1M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil

Void Setup()                     {    cs_2_8.set_CS_AutocaL_Millis(0xFFFFFFFF);turn off autocalibrate on channel 1 - just as an example    Serial.Begin(9600);    pinMode(13,Output);
}

Void Loop()                     {
 Long Touch =  cs_2_8.capacitiveSensor(100);     Serial.println(Touch);  print sensor output     If(Touch >= 1000)    {     digitalWrite(13,High);    }    else{     digitalWrite(13,Low);    }   }

Until the next post :)

For arduinoProjects for beginners

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN