Using Touch Sensors with Visual Micro

Touch Sensors are useful when you need:

 

  • an input button (and havent got a button)
  • something with a better environmental seal than the buttons available.
  • to detect that someone has touched it (not just a physical press from any object as with a button)

 

 

The Capacitive Touch sensing technique can be used to give a momentary input, and is compatible with virtually any Arduino board, with some boards integrating this for you.

How this works electrically can be seen here on the Arduino Playground, and shows how to add the additional resistor (and optional capacitor for stability) if your board does not have the touch element built in.

 

Conductive Elements

Any Conductive surface can be used, and will vary depending on the durability required and any other considerations.

Pencil on Paper - works, but will smudge and wear quickly

Conductive Foil / Tape - works well and allows it to be stuck on to any surface

3D Printed Conductive Plastic - works well and allows for almost any shape or fitting to be achieved

 

Example Conductive Element

Example 3D Printed Touch Pad
Here we have printed a touch pad using conductive PLA from Proto-Pasta on a 3D printer, and we have included the vMicro logo, as it will be integrated into a keyboard of shortcut keys later.

 

Example Board: ESP32

As the ESP32 Integrates the touch sensing hardware for us on 10xIO pins, all we need to do is to attach our conductive touch plate to the pin, and call touchRead(<<GPIONumber>>) or touchRead(T<<TouchNumber>>), and we don't need to set it up with pinMode().

Check the Pinout for your specific board, and the code is included in the Examples > ESP32 > Touch section, in the Visual Micro Explorer.

 

Getting it Stable

We reccomend using the Serial Debugger to calibrate your touch sensors for your particular application:-

Video Example of Using the Serial Debugger to Calibrate a Stepper Motor

Drawing Graphs Using @Plot Windows

Serial Debugging Tutorial