Lots of different possible problems - but what it is, is hard to say as you forgot to add a schematic of your setup, photos of your setup, and your code. All of these are potential problem sources.
For the sensor, you can also make it easy on yourself and incorporate TTP223 based sensors in your design.
It's much better if you make such huge links clickable! Use the URL icon in the complete editor (click "Preview") or manually add [url=...]text[/url] tags.
Anyway, that's the kind of sensor I was referring to. A few different models are out there, they work well. Long wires are a problem for capacitive sensing (they add lots of stray capacitance), another major one is improper grounding.
jago2:
I want to put the switches (4) behind some 3d printed PLA (1mm thick) which will also have some wood veneer on it.
Wood veneer will absorb sweat and moisture and become a conductor - use only good insulators.
1mm is thick, can you not use a thin film? The capacitance of two plates 1cm sq and 1mm apart is of the order of 1 to 3pF depending on the insulator's dlelectric constant. 0.1mm thick would be way way better...
Thanks MarkT and wvmarle - although seemingly contradictory advice.
Mark - the veneer will be lacquered so hopefully that will prevent any absorbtion. But the capsense library auto-calibrates on startup so even if there is a change hopefully it wouldn't be a problem.
The sensors are arriving today so I'll see if they will work.
I'd be open to another material for the top. Walnut veneer is fixed as the material for the sides of the eclosure so it would need to be something that complements it. Plain PLA is an option if smoothed well enough but colour wise I only (currently) have black, white and blue (plus a wood PLA but not given that a fair go yet). Painting is a possibility but ...
Ironically a metal would look good but that would interfere with the sensors even more!
Very likely the Amazon sensor (with purpose built, self calibrating IC) is going to work better than your DIY. Capacitive sensors are very simple in principle, but often pretty tricky to get right. In part as by their nature parasitics are a major issue.
Only had time for a quick test before I had to go out and will do more tomorrow but basically plug-and-play and work perfectly through the pla (in fact, a bit sensitive, so once I put the veneer on and test it with that, I'll look at increasing the gap to the surface if needed).
Thanks again for the suggestion, saved a lot of time and they seem to work beautifully (and I only need 4 for this project so I have 6 more for something else )