I’m designing capacitive sensors, and I’m trying to measure the capacitance using an Arduino Mega 2560. I’m having an issue with my capacitance measurement data quality, such that I am seeing 3 signals when I am only measuring 1 capacitor’s capacitance.
The capacitances are very small, on the scale of pF, and the method of how I measure the capacitance is by charging the bottom electrode/plate, then measuring the top/sensing electrode’s voltage, and then discharging the capacitor by shutting off the +5 V power supply sent to the bottom electrode. The measured voltage is compared to the parasitic capacitance and a calibration constant, and this is used to calculate the capacitance. I attached a schematic and picture of my setup.
I conducted a pure shear test on my sensor, such that I started recording the capacitance, applied a shear force over time, and removed the shear load. The idea is that when I plot the capacitance over time, I will get a V-shaped plot. **The problem is, my raw data looks like I am measuring 3-signals instead of 1-capacitance signal. ** I am not sure why it is doing this. There seems to be no pattern to the 3 signal plot, it seems to randomly fluctuate between being too high or low. I attached pictures of my data - one of them is when I only plot the middle signal values.
I was thinking maybe the internal clock of the Arduino isn’t fast enough and the slight delays might affect the charge applied to the bottom electrode. That slight charge difference might cause a slight difference in V applied to the bottom electrode. (i.e. 4.99 V instead of 5 V), and that would change the capacitance that is calculated. I attached a pictures of my data.
How do I remove the noise in my raw data? I was looking into doing a Butterworth and Low Pass filter, or using a median filter, but ideally, I want to remove that noise altogether or minimize it such that when I measure one capacitor, I see one capacitance signal recorded instead of 3. I tried doing this with a very large capacitor (1 mF and 1 uF) and got similar results, multiple capacitance signals read for 1 signal with no shear force applied, just a physical capacitor connected to the Arduino - pictures attached.
Is there a better setup I should use to measure capacitance? Should I use a different type of microcontroller? I attached the Arduino code if that helps. Please explain this on a simple level/with detail because I’m new to using Arduino’s and electrical engineering principles.
*** One thing I forgot to mention, I am sampling the sensor data at 50 Hz from the Arduino. So instead of using “while millis() % 100” I am using “while millis() % 20” ***
Capacitance_Meter.ino (1.19 KB)