Using a capacitive type sensor that uses the TTP223B chip, this component is ideal for adding touch control, with replacement of mechanical switches in your project.

The application program for using the TTP223B capacitive sensor is very simple, when you touch the capacitive sensor connected to digital pin D2, the relay connected to digital pin D10 is energized and remains there until you touch the sensor again.
A special feature of the program is that pins D3 and D4 are used to power the sensor, which is why after setting them as OUTPUT, via the digitalWrite command pin D4 which is connected to GND of the sensor is brought to LOW level, while pin D3 connected to VCC of the sensor is brought to HIGH level, in this way it is not even necessary to use cables but it is sufficient to insert the sensor on the Arduino connector.

NOTE: be careful, if you use a different model of sensor you need to check the exact pin layout, as they could be different with the risk of damaging both the sensor and the Arduino board

More information in the related article on my site