Digital multimeter shield for Arduino
This instructable describes a shield, which converts “Arduino” board in a digital multimeter (DMM).
The shield can be inserted on “Arduino” UNO und Duemilanove boards. It can work in three modes:
- standalone – the measurement data can be seen at the character or graphical LCM
- connected – the measurement data can be read on the PC screen using the “Arduino” IDE “Serial monitor”
- combined – the data can be observed on both devices
The second mode does not require the presence of LCM, what makes the shield very cheap.
The “Arduino” based DMM has the following functions:
- voltmeter with 3 ranges : 0-10V; 0-30V; 0-100V
- amperemeter – it has a range 0-500mA
- ohmmeter with 2 ranhes : 0-1KOhm, 0-250KOhm
- diode, LED, connectivity checker
- LED functionality tester
- NPN BJT Beta meter
Step 1: DMM “Arduino” v/s Standard digital multimeter
The following movie shows how the “Arduino” based DMM works in comparison with non-professional standard DMM
Step 2: WARNINGS
I thought to add these warnings at the end, where the conclusions should be, but I have changed my mind because of the importance of this step. Before starting the copying of the design and doing some measurements the following things should be kept always in attention.
Dangerous voltages could appear at the shield nodes, connections and parts. As the shield is designed in the presented implementation, it can be used for measuring of voltages until 100 V. These voltages are dangerous for the life!!!. Even voltages close to 30 V in some cases can cause death. For this reason, all requirements concerning the work with high voltages must be met:
You should use only insulated leads. You should avoid touching of the shield parts (especially the banana socket for voltage measurements and the input resistor). You should keep your table clean – no metal parts or instruments shall be placed close to the shield because they can create short circuit between the shield parts. You should not touch any of the banana sockets and plugs during high voltage measurements. (The banana socket for the voltage measurement is not insulated in any way and touching it during operation can have deadly results!!!).
I would like to thank the user “granz” (see the comments), who reminded us about the following: When using the “Arduino” based DMM connected to the computer, you should be aware of that the ground potentials of the DMM is the same as the ground potential of you PC, and you should measure voltages and currents of device or unit, which have the same ground potential. In other case you risk to damage both – you computer and your device. If you are not sure, what the ground potential of your device is – then it is recommended to use the “Arduino” based DMM in standalone mode – supplied by battery pack or isolated DC/DC converter.
Step 3: The design work
The main idea of the project was to create a shild for “Arduino”, which can be used for voltage and current measurements. The shield had to be relatively precise ~ 1% and to be able to display the measured data on the liquid crystal display.
Starting the design, I decided to keep the circuit as simple and cheap as possible. During the design phase, I have found that I can implement some additional useful functions without big efforts and investments. Because I have used dual opamp chip and one of the embedded amplifiers was used for the ampere meter, I was looking for a way, how I could use the second one. I decided to design with its use a voltage to current converter, which further could be used for other functions : resistance measurements, diode/LED functionality checks, NPN Transistor gain measurements. This required some additional parts, but have added more functionality to the board.
Although the main two functions could be done very precise (especially with final software trimming), the additional functions have some lack of accuracy. The error in some cases can reach ~10%. The reason for that will be explained further. Keep reading :-).
There are some simple solutions, which can drastically improve also this accuracy, but they require some additional parts and are matter of possible feature project.
The schematics and the PCB board layout are presented on the pictures.
Remarks on the schematic:
- On the schematic you can see two opamp instances – they both represent only one chip, but with different packages. On the PCB both instances are placed one over other. In the reality only one chip shall be soldered. This approach makes the PCB more universal – different type of packages are supported simultaneously.
- The same design technique is used also for the transistor. It can be PMOS or PNP BJT, and it can have different packages.
- This chain is optional. The devices can be omitted. When using PMOS transistor, the LED could indicate if some device is connected for measurement : high intensity – the load is missing, low intensity – the load is connected. When using PNP BJT for the VIC (Voltage to Current Converter), it is difficult to see a change in the intensity of the LED. The advantages/ disadvantage of using PMOS or PNP will be discussed further.
The “Eagle” design files are attached to the project and are available for download and free use.
Step 4: Explanation : How this shield works…
The schematic may look quite complicated. For that reason I will try to explain how the different functions work, separating the circuit in sub-blocks, simplifying them and showing how the calculations were done.
Let’s start with the voltmeter. On the picture, its simplified schematic can be seen. Three voltage dividers ( for the three ranges) can be alternatively formed by use of switches controlled by the “Arduino” board. Only one switch is closed during the voltage measurement. As switches I use NMOS enhancement mode switching transistors from the type BSS123. The have typical Ron around 6-10 Ohms, which does not influence a lot the accuracy for the ranges 0-10V, 0-30V. For the range 0-100V, their Ron is taken into account, when calculating the voltage divider ratio.
The Zener diode is used to clamp the Vmeas potential ( the voltage applied to the analog input A0 of the “Arduino”) at 5.6V and to protect the Atmel chip. Its clamping value is taken with the presumption, that the board will be supplied with 5V source. This Zener diode must be very carefully chosen. I took one of ten measured. It must satisfy two criteria:
- The clamping voltage must be not higher than 5.6V
- The current flowing through the diode in reverse connection, when 5V are applied on it must be close to 0. If significant current flows, this will affect the measurement accuracy and will introduce some non linearity. The diode, which I soldered was passing only 1uA.
Step 5: How the current is measured…
You can see how the current is measured on the presented schematic diagram.
The measured current is passed through 1 OhM resistance to the ground. Amplifier, which output is connected with the “Arduino” analog input A1 is amplifying the voltage drop over the resistor with gain 10.
To prevent damages, when higher then desired current is applied at the ampere meter, I have put a resettable PTC for 500mA.
Step 6: How the resistance is measured….
A reference voltage with respect the positive supply range is created by the use of the Zener diode (2V). The generated in this way voltage reference is applied to the input of voltage to current converter realized by the opamp and the PNP BJT (PMOS) transistor, at which emitter (source) terminal, adjustable and commutable resistors are connected. The voltage over these resistors is identical with the voltage over the Zener diode. The “Arduino” board controls, which of both switches will be closed, defining in this way through which of both resistors will flow current. Thus two possible current values are possible: 10uA, 2.5mA. These currents can be adjusted very preciously. The generated so current is passed through the measured device (resistor, diode, LED, transistor) and the voltage drop appeared over the device under test (DUT) is applied to the analog pin A2 of the “Arduino” board.
For the VIC (voltage to current converter) can be used as well PMOS or PNP bipolar devices.
At the first try I was using PMOS NDT2955 device. (I had one available, and decided to use it). The opamap used was LM358.
Making some tests, I have found that some measured data is not stable. I found that oscillation appeared. The VIC was not stable.
The reason for that was: The maximal capacitive load, which the LM358 can drive is less than 50pF (without resistive isolation).
The gate capacitance of the used PMOS was 600pF, which was making the whole circuit unstable. Then, I have changed the transistor with PNP BJT (Bipolar Junction Transistor) 2n3906, and the circuit was stabilized.
In other words: the type of the opamp and transistor of the VIC must be carefully chosen. The LM358 is not the best choice – it has stability problems with high capacitive loads, it has sensible offset and the output swing is not the best. If more precision is required better to be chosen an R2R (rail to rail) input/output opamp with JFET/CMOS (low input current) inputs, with low offset.
The higher offset in my case would be useful “feature”, because further, in the software tuning part, I would like to show, how this offset can be corrected by the use of the software.
Using the PMOS transistor, will allow us to use the “load/no load” function of the Ohmmeter, but could create stability problems.
Using PNP BJT has the advantage that the circuit is stable.
In both cases, independently, which type devices are used (OK..mostly for the PMOS), they create small accuracy problems.
The reason for lower accuracy is the limited output resistance of both devices. What is this meaning:
Lets take the resistor range 1000 Ohm. In this case, reference current of 2.5mA are passed through the resistor, and the generated voltage is applied to the ADC input of the Atmega chip. The resistor value, which we want to measure can vary between 0 Ohm and 1000 Ohm. The voltage Vmeas in this way also varies between 0V and 2.5V. The Vce (Vds) : Collector-emitter/ Drain-source voltage varies between 0.5V-3V. The variation of the mentioned voltage affects directly the collector-emitter / drain-source flowing current, what finally results in worse accuracy. The described phenomena can be better understood looking on the typical NPN BJT transfer characteristics presented on the picture.
This effect can be in some limits corrected by the software, but if some non linearity effects are available, the correction becomes very difficult.
Step 7: How the Beta is measured….
The current, which generation was explained in the previous step is passed through different devices : resistors, diodes, LED’s, Schottky diodes…etc. The generated voltage drop over the corresponding device is measured. This voltage can serve as information obout the functioning of the device. For example, the Vf (the voltage drop over the device, when connected in forward direction) can vary for:
diodes – 0.4V- 0.8V
Schottky diodes – 0.1V-0.5V
LED (depend on the color) – 1.1V-3.5V…etc.
For this check, the current of 10uA is used.
If the current 2.5mA is passed though the mentioned devices, these voltages become higher. The LED’s start to glow. This is way to test securely the functionality of LED diodes. (The white ones could not glow – sometimes they require over 3V).
The current with value 10uA is used also for the NPN BJT Beta (Hfe) measurement . The circuit and the corresponding calculation for this can be seen on the picture .
For more detail: Digital multimeter shield for Arduino