This setup detects a metal object of about 300g standing on a sensor plate of 100x150mm and turns on a led strip.
The script capacitiveToucheLED.ino use the modified Capacitive Sensor Library – see Capacitive Touch Sensing with Nano Every.
The automatic recalibration must be turned off, otherwise the sensor will no longer detect the object after a certain period of time.
const int AUTO_CALIBRATION_OFF = 0xFFFFFFFF;
void setup() {
sensor.set_CS_AutocaL_Millis(AUTO_CALIBRATION_OFF);
}
The recalibration is triggered at specific times when:
ledActive = false;
Note
You can force the recalibration by touching the sensor with your hand for a few seconds.
Note
The maximum aluminum area directly connected to the PCB should not be larger than 75x100 mm. The cable (0.14mm²) length should not be longer than 40 cm. Do not cross the sensor cable with power cables.
Important
It is important to connect the PCB to the ground, otherwise the sensor will not function properly.