(edited because I figured out how to get PWM working for the LED, and results are marginally better) (and again to enable BBCode)

The idea is to set a GPIO pin LOW, then as an INPUT, and see how long (based on capacitive field of your body moving to and from) the pin registers as HIGH. I try to self-calibrate by finding the min and max readings for how long it takes (iterations/cycles of a loop) to detect the INPUT change... so train the MCU by moving toward and away from the MCU a few times. It is not a linear response, it is most apparent within an inch or so of the MCU. The LED intensity(value) method didn't work for me, so I had to try and do a fake-PWM on the LED... any improvements for linearizing the response and making the LED nicer would be appreciated!

I wonder if capacitive sensing would work better using an ADC? Link an ADC input to a DAC output. Set the DAC to half scale to charge the capacitance to 1.65V, then turn the DAC pin to a digital input to make it high impedance. Then take periodic readings from the ADC. This would allow for the situation where the capacitance change causes the voltage to fall - as far as I can see there's no guarantee which way it will move so you need to measure the absolute value of any change from the initial reading.

In my youth I experimented with capacitive sensing using a different sensing technique. I found sensitivity was improved by using a metal plate as the sensor - of course this needs to be well insulated and I mounted it behind a perspex sheet.

Nonlinearity is inevitable as the relationship between distance and capacitance is nonlinear. The capacitance between a pair of conductive plates is proportional to area/distance.