...
The capacitor used in this circuit is a 10000Pf capacitor:
The circuits were further modified to incorporate schmitt triggers, the schematics shows the new circuits:
In circuit 5, a TLV324IDCKR Schmitt trigger was used with an sot-23 breakout board. For Circuit 6 (using an inverting schmitt trigger), an op-amp circuit was used.
Measurements
Circuit 1: Unfiltered Switches
...
By having R1=10k and R2=380k the results have definitely improved. The result is a much smoother curve, but we some oscillations are still present in the curve. The circuit could be further improved with the use of a schmitt trigger.