#### 1. Introduction

Microcontroller systems can be implemented to measure capacitance by using 3 ways: (1) using an RC or LC relaxation oscillator ( R and L values are known), measuring the output frequency, and calculating capacitance using resonance frequency equations [1-3]; (2) using RC Monostable-MV (R value known), measure TON pulse width, and calculating capacitance using pulse width equation [4-5]; and (3) using a capacitor charging system in RC-series circuit with a stable DC voltage source, measuring the charging time until the capacitor voltage reaches a certain value, and calculating capacitance using the charging equation of the capacitor [6-9]. The accuracy of the capacitance measurement by measuring the charging time can be increased using Arduino M0 which has a 12-bit ADC [10].

##### Figure 1

RC circuit with DC voltage source.

#### RC charging circuit

The RC charging circuit is realized using a DC voltage source, resistor, and capacitor connected in series as shown in Figure 1 [11]. When the switch is closed, current i(t) flows from the voltage source through resistors and capacitors so that equations (1) to (3).

VS=VR+VC

(1)

VS=i(t)R+1ct=0t=idt

(2)

i(t)=VSRetRC

(3) The capacitor voltage can be calculated using equation (4). If the values of R , VS, and Δt (the charging time of VC(t) =0.5VS to VS ) is known, then capacitance can be calculated using equations (5) to (7) [11].

Vc(r)=Vs1etRC

(4)

erRC=VSVC(t)VS

(5)

t=RClnVS0,5VSVS

(6)

CX=Δt0,6931471×RCHG𝐹𝑎𝑟𝑎𝑑

(7)

##### Figure 2

Capacitance measurement system circuit.

#### Description of the capacitance measurement system

The capacitance measuring system (Figure 2) was built using the concept of charging a capacitor CX in an RC-series circuit that is controlled by Arduino M0 using pinMode () and digitalWrite Before the charging cycle, the CX voltage is emptied through RDISCHARGE which is connected to the ground through a digital pin 6. CX charging cycle is done through R CHARGE which is connected to a voltage of 3.3 Volts via digital pin 7. CX charging time from 0VS to 0.5VS(Δt) is calculated using the micros () function and then the capacitance can be calculated (equation 7) and displayed to the ERM20004FB-2 LCD with I2C -serial module. The pseudo-code of the Arduino M0-based capacitance measuring system uses the concept of charging capacitors in the RC-series circuit as described below:

• discharging CX until VCX=0 Volts,

• charging CX and save time (t1),

• stop charging when the ADC =2048(VCX=0.5VS) ,

• save time (t2),

• calculate Δt and CX using equation 7,

• show CX and Δt values to LCD, and

• repeat step 1.

##### Figure 3

Capacitance measuring system when measuring CX(323K or 32nF ± 5%.

#### 3. Results

R DISCHARG Γ NG is set at 100Ohm1% to get a fast discharge time (t6RC=120μSec) when connected with CX maximum (100nF) and R CHARGING determined at 89. 7MOhm (9 resistors in series) to get Δt minimum >50000μS when connected to CX minimum (1nF) . Level data converter module (3.3 Volt to 5Volt) is used to connect SDA and SCL signals from Arduino M0 to 4×20 char LCD boards (with I2C -serial module). Capacitor measurement system has been successfully created (Figure 3, not calibrated, and has been tested to measure the capacitance of 14 ceramis-disks capacitors alternately using GWinstek LCR-821 (5 times each) and the results are shown in Table 1. Sketch ofthe system is created using Arduino IDE ver. 1.9.0-Beta and written in the following paragraph:

##### Table 1

Data from measurement of 14 capacitors.

 capasitor (ceramics disk) value measurement results No. LCR-821 capacitance measuring system % measurement error C X (nF) SD C X (nF) SD Δt(μS) 1 2 3 4 5 6 7 8 1 102K (10nF 10%) 0,9208 0,0091 0,9271 0,0110 68,732 0,68 2 302M (3nF 20%) 3,1005 0,0143 3,0948 0,0509 219,994 -0,18 3 472K (4n7F 10%) 4.4351 0,0016 4.4334 0,0859 229,528 -0.04 4 103G (10nF 2%) 9,4243 0,0018 9,4108 0,0058 567,639 -0,14 5 103K (10nF 10%) 9,7432 0,0068 9,7289 0,0109 586,508 -0,15 6 153J (15nF 5%) 15,4270 0,0083 15,4217 0,0377 899,649 -0,03 7 223K (22nF 10%) 20.7686 0,0103 20.6276 0,0392 1,266,618 -0.68 8 273K (27nF 10%) 25.9722 0,0181 25.7965 0,0241 1,590,332 -0.68 9 333K (33nF 10%) 31.9410 0,0113 31.9659 0,0796 1,984,776 0.08 10 473J (47nF 5%) 41.9192 0,0274 41.8124 0,1494 2,598,063 -0.25 11 563K (56nF 10%) 52.7006 0,0576 52.6150 0,0948 3,255,986 -0.16 12 633J (63nF 5%) 69.0542 0,1407 68.8577 0,0623 4,272,470 -0.28 13 104K(100nF 10%) 94,3276 0,1942 94,4634 0,1975 5,891,775 0,14 14 104J(100nF 5%) 98.5234 0,0575 98.5654 0,2419 6,128,104 0.04

CX measurement results (columns 2 and 4 in Table 1) are the average of 5 measurements using LCR- 821 and using capacitance measuring system. The % error (column 8) value is calculated using equation (8).

%𝑒𝑟𝑟𝑜𝑟=CX𝑠𝑦𝑠𝑡𝑒𝑚𝑣𝑎𝑙𝑢𝑒CX𝐿𝐶𝑅821CX𝐿𝐶𝑅821×100

#### 4. Discussion

Referring to equation (7), there are 2 variables that affect the measurement results of capacitance: (1) stability of the Δt ; and (2) stability of the R CHARGE . Because Δt is generated from the function of micros () which has a 4μS resolution [12] so that it is assumed that it does not affect the measurement results, the change in the RCHG value will cause a change in the value of the CX measurement. If the R CHARGE value rises, then the CX measurement value will decrease and vice versa. The average

R CHARGE value is 89.7MΩ with standard deviation 121 (measured 5 times using LCR-821, so it can be concluded that there is a correlation between the % error value of the measurement ofthe capacitance measuring system and the instability of the R CHARGE value.

#### 5. Conclusion

An Arduino-based capacitance measuring system uses the technique of calculating the charging time of the capacitor voltage in the RC-series circuit has been successfully made to measure the capacitance of 14 ceramic-disk capacitors with a measurement error rate <± 0.7% (compared to LCR- 821.

#### Funding

This capacitance measurement system research can be completed with research funds from the Faculty of Engineering, Universitas Negeri Jakarta (based on PPK Decree Faculty of Engineering, Universitas Negeri Jakarta, number 461.a/SP/20l8- May 23, 2018.

#### Acknowledgement

The researchers thanked many colleagues in the Laboratory of Instrument & Control of the Faculty of Engineering, Universitas Negeri Jakarta for their contributions and support for this research. The researcher also thanked all the reviewers who provided valuable input and helped complete this article.

#### Conflict of Interest

The researcher does not have a conflict of interest related to the completion ofthis article.

#### References

1

Taufik, M., (2017). Rancang bangun alat ukur kapasitor dan induktor digital, Jurnal PROtek,vol. 04, no. 1, pp. 35-40.

2

Yulianto, Y., (2014. Rancang bangun alat ukur resistansi, induktasi, dan kapasitansi meter digital, Bachelor thesis, Universitas Negeri Yogjakarta.

3

Marpaung,P., et al. (2007). Desain dan implementasi LC meter berbasis PC, in Proceedings of the Seminar Nasional Aplikasi Teknologi In ormasi 2007, pp. C109- C112.

4

Ramtonio, “Capacitance meter with Arduino and 555 Timer”, Internet: www. instructables.com/id/Capacitance-meter-with-arduino-and-555-timer/, 2018 [Maret 30, 2018.

5

Ardi, I. (2002. Digital capacitance meter. Bachelor thesis, STMIK Jakarta STI & K.

6

Lie, Y. (2003. Kapasitor meter dengan metode kurva pengisian. Bachelor thesis, Petra Christian University.

7

Hagiwara, N. and Saegusa, T. (1983. An RC discharge digital capacitance meter. IEEE Transactions on Instrumentation and Measurement, vol.32, issue: 2, pp. 316- 321.

8

Taha, S. (2010). A novel digital capacitance meter. International Journal of Electronics, vol. 66:2, pp. 317-320.

9

Arduino, “Capacitance meter and RC time constants Internet: www.arduino.cc /en/ Tutorial/CapacitanceMeter, 2018 [Maret 30, 2018.

10

Arduino, “Arduino M0 Internet: store.arduino.cc/usa/arduino-mO, 2018 [6 Sept 2018.

11

Djatmiko, W. (2013. Teknik Pulsa. Jakarta: Lembaga Pengembangan Pendidikan UNJ, ISBN: 978-602-390-053-4.

12

Arduino, “micros (”, Internet:www.arduino.cc/reference/en/language/functions/time/ micros/, 2018 [6 Sept 2018.