I want to make the multi channel simultaneous capacitance meter by extending the following " Capacitance Meter for 470 uF to 18 pF Capacitors". But I don't know the code and circuit. I'm using Arduino Uno.
Hi, @1ttoooomyy
Welcome to the forum.
How do you want to extend the meter?
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum
Thanks.. Tom....
![]()
Thanks for @TomGeorge .
I want to measure the multi capacitance simultaneously based on " Capacitance Meter for 470 uF to 18 pF Capacitors".
Do you mean you want to use one UNO to cover outside the 18pf to 470uF range?
Tom....
![]()
You need one insulated complete circuit for each capacitor, including controller and power supply. Then send the values wirelessly (optocoupler...) to the common display controller.
Hi,
So you want to make a capacitive touch mat.
How many capacitors do you want to measure?
Tom....
![]()
Yes. But I have to record the capacitance value. So the program code must be based on the following " Capacitance Meter for 470 uF to 18 pF Capacitors". Furthermore, I don't want to use any external resistors. And I want to measure the maximum 5 capacitors.
Hi,
What is your project?
Why do you need to record the values?
We really need to know the full scope of your project so we can advise you properly.
Can you please tell us your electronics, programming, arduino, hardware experience?
Tom....
![]()
Hello,
I'm a researcher and studying the wearable electronics.
Now, I want to build the sensor and record the capacitance as shown in the attached journal (Fig. 5-6).
My major study is nano electronics, but I'm a beginner at programming, arduino, and hardware.
Pencil-on-Paper Based Touchpad for Eco-friendly and Reusable Human-.pdf (5.1 MB)
Hi,
Okay so if all you wanted to do was detect a capacitance change due to touch, you can used the CapSense library that uses analog pins of the controller, how ever this does not actually measure the capacitance.
It uses a different principle to the method of measuring capacitance.
Using the project you cited, you could be able to multiplex the 5 capacitors to two controller pins and measure them in sequence with one UNO.
I would suggest you get some hardware and at least test for one capacitor so you can learn some basic Arduino code and layout, before expanding to more.
Tom....
![]()
Hello,
I've already measure the one capacitance value using the above code(How to Make an Arduino Capacitance Meter). So I want to measure the two capacitors for next step. So, could you explain how to do it using controller pins you mentioned?
Hi,
Can you please post your code?
You can use another pair of pins to measure another, but with only 6 analog pins you will only be able to do three capacitors total.
But lets get to two or three first.
After that you will need some more hardware.
Tom....
![]()
Hello,
The following is my code.
OK, if I increase the number of capacitors, I will get the Arduino mega.
const int OUT_PIN = A2;
const int IN_PIN = A0;
const float IN_STRAY_CAP_TO_GND = 24.48;
const float IN_CAP_TO_GND = IN_STRAY_CAP_TO_GND;
const float R_PULLUP = 34.8;
const int MAX_ADC_VALUE = 1023;
void setup(){
pinMode(OUT_PIN, OUTPUT);
pinMode(IN_PIN, OUTPUT);
Serial.begin(9600);
}
void loop(){
pinMode(IN_PIN, INPUT);
digitalWrite(OUT_PIN, HIGH);
int val = analogRead(IN_PIN);
digitalWrite(OUT_PIN, LOW);
if (val < 1000){
pinMode(IN_PIN, OUTPUT);
float capacitance = (float)val * IN_CAP_TO_GND / (float)(MAX_ADC_VALUE - val);
Serial.print(capacitance, 3);
Serial.print(F("e-12"));
Serial.println(F(") "));
}
else{
pinMode(IN_PIN, OUTPUT);
delay(1);
pinMode(OUT_PIN, INPUT_PULLUP);
unsigned long u1 = micros();
unsigned long t;
int digVal;
do{
digVal = digitalRead(OUT_PIN);
unsigned long u2 = micros();
t = u2 > u1 ? u2 - u1 : u1 - u2;
} while ((digVal < 1) && (t < 400000L));
pinMode(OUT_PIN, INPUT);
val = analogRead(OUT_PIN);
digitalWrite(IN_PIN, HIGH);
int dischargeTime = (int)(t / 1000L) * 5;
delay(dischargeTime);
pinMode(OUT_PIN, OUTPUT);
digitalWrite(OUT_PIN, LOW);
digitalWrite(IN_PIN, LOW);
float capacitance = -(float)t / R_PULLUP / log(1.0 - (float)val / (float)MAX_ADC_VALUE);
if (capacitance > 1000.0){
Serial.print(capacitance / 1000.0, 2);
Serial.print(F("e-6"));
}
else{
Serial.print(capacitance, 2);
Serial.print(F("e-9"));
}
Serial.println(F(") "));
Serial.print(digVal == 1 ? F("Normal") : F("HighVal"));
Serial.print(F(", t= "));
Serial.print(t);
Serial.print(F(" us, ADC= "));
Serial.print(val);
Serial.println(F(")"));
}
while (millis() % 1000 != 0);
}
