Implementing Multimeter in PSLab Android App
The Pocket Science Lab Android app being on the verge of development have various new features adding up per day. One of the new things added up recently is the splitting of the control section in three different instruments and implementing the control read section into a multimeter. This blog will be discussing about how the multimeter is implemented.
The different instruments are power section, multimeter and wave generator. While in the previous implementation of control section it was divided into three parts namely control main, control read and control advanced as shown in figure (1). The control is the power source, read is the multimeter and advanced section is the wave generator.
Figure (1): Screenshot of control section
Figure (1) shows the previous implementation of a multimeter i.e the read section but as we know this is way different than the actual implementation of a multimeter and thus from here comes the task of implementing a new multimeter.
What is a Multimeter, how does it looks?
A multimeter basically is an instrument designed to measure electric current, voltage, and usually resistance, typically over several ranges of value.
Figure (2): Showing a real multimeter instrument and its different sections [2]
Figure(2) clearly shows how an actual multimeter looks. It basically has three important components i.e the display the buttons and the rotary knob or the dial and thus the task was to implement the same in PSLab android.
Implementation in PSLab
Figure (3) : Screenshot of new implementation of multimeter
The implementation of multimeter is thus inspired from its original look i.e it has got basic buttons, a rotary knob and a display. Figure (3) shows the implementation of multimeter in the android-app
Back-end of Multimeter
A separate multimeter activity was implemented for the multimeter. The main back-end part of getting the resistance, capacitance, frequency and count pulse were taken from the communication related classes such as the ScienceLab class and PacketHandler class. For example to get the voltage calculation we use the getRawableVoltage function
private double getRawAverageVoltage(String channelName) {
try {
int chosa = this.calcCHOSA(channelName);
mPacketHandler.sendByte(mCommandsProto.ADC);
mPacketHandler.sendByte(mCommandsProto.GET_VOLTAGE_SUMMED);
mPacketHandler.sendByte(chosa);
int vSum = mPacketHandler.getVoltageSummation();
mPacketHandler.getAcknowledgement();
return vSum / 16.0;
} catch (IOException | NullPointerException e) {
e.printStackTrace();
Log.e(TAG, "Error in getRawAverageVoltage");
}
return 0;
}
The above function shows the pure backend of PSLab and how data is taken from the hardware using the packet handler class, after which the data is processed in various other functions after we getting the final result. Similarly the function to get count pulse is
public int readPulseCount() {
try {
mPacketHandler.sendByte(mCommandsProto.COMMON);
mPacketHandler.sendByte(mCommandsProto.FETCH_COUNT);
int count = mPacketHandler.getVoltageSummation();
mPacketHandler.getAcknowledgement();
return 10 * count;
} catch (IOException e) {
e.printStackTrace();
}
return -1;
}
As we see that the data is being taken through a similar manner in the above function i.e using the packetHandler class(by sending and receiving bytes). Thus in all the other functions for capacitance, frequency similar communication model can be found.
Similarly all the functions are implemented in the ScienceLab class and thus all the functions are directly called from the ScienceLab class in the Multimeter activity. For more knowledge on these one can directly have a look at the PSLab android app codes available in Github.
Implementation of the Rotary Knob
The rotary knob is implemented using the BeppiMenozzi Knob library. More information regarding the same can be found in my previous blog on implementing the rotary knob.
Resources:
-
-
- BeppiMenozzi,knob-library,github.com:
https://www.fluke.com/en/learn/blog - Fluke:
https://www.fluke.com/en/learn/blog - PSLab-android codes, Github:
https://github.com/fossasia/pslab-android
- BeppiMenozzi,knob-library,github.com:
-
You must be logged in to post a comment.