fossasia / pslab-firmware

Firmware for PSLab Open Hardware Platform https://pslab.io
Apache License 2.0
1.56k stars 76 forks source link

feat: get capacitor range #135

Closed CloudyPadmal closed 2 years ago

CloudyPadmal commented 2 years ago

Porting get capacitor range function

This function can be used to get an estimate of how large the capacitance is. It doesn't yield anything pF. Instead it outputs a numerical value. This could be used to compare two objects wrt to their capacitance.

The following figure shows how this numerical output varies wrt to charging time. As charging time increases, the range seems to converge to a flat value.

bessman commented 2 years ago

In the python driver, this function was originally used to choose an appropriate charge time for MULTIMETER_GetCapacitance. It is still used for that purpose in pslab-android: https://github.com/fossasia/pslab-android/blob/d46e5d8c5deafffb5f878ab703dda577cb80d6bf/app/src/main/java/io/pslab/communication/ScienceLab.java#L2473

The python driver now uses an alternative method to estimate the capacitor range which takes longer but is more accurate. Since the android app depends on this function, we need to keep it.