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



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:

  1. 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.
  2. The same design technique is used also for the transistor. It can be PMOS or PNP BJT, and it can have different packages.
  3. 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.

The Gerber files prepared for PCBway(fab with very cheap and high quality production) are also available for download.

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. They 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:

  1. The clamping voltage must be not higher than 5.6V
  2. 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   

Step 8: The parts list (BOM)

  Part                                      Value /Name                Package

C1                                           100nF                                C0805       
C2                                           100nF                                C0805       
C21                                            10u                        085CS_1AR   
D1                                   Zener 5.1V                              DO34Z7      
D2                                      Zener 2V                              DO34Z7      
D3                                      Zener 2V                              DO34Z7              
F1               MF-MSMF050-2 500mA-                                 L1812 
                   resettable PTC
IC1/U1                                   LM358                                   SO08   0r
                                              LM358                               SOIC08
IC11                        74LVC1G14DBV                              SOT23-5 
U2               SN74LVC2G66_DCT_8                                    DCT8        
LED1                     GREEN SMD LED                  CHIPLED_0805
LED2                         RED SMD LED                  CHIPLED_0805
Q1                                       BSS123                                SOT23                 
Q2                                       BSS123                                SOT23       
Q3                                       BSS123                                SOT23       
Q4/T1                                   2N3906                                  TO92    Or
                                          NDT2955                              SOT223    
R1                                        10K 1W                             0207/10     
R2                                                 10                                R0805       
R3                                               510                                R0805       
R4                                               10K                                R0805       
R5                                                 2K                                R0805       
R6                                               1K1                                R0805       
R7                                               510                                R0805       
R8                      10K   (trimmer pot.)                          RTRIM64W    
R9                                      1 1W 1%                              0207/10     
R10                                           1.5K                                 R0805       
R11                                            12K                                 R0805       
R12                                           1.5K                                  R0805       
R13                                             300                                 R0805       
R14                                             300                                 R0805       
R15                                             300                                 R0805       
R16                    250K  (trimmer pot.)                          RTRIM64W    
R17                    1000  (trimmer pot.)                          RTRIM64W    
R18                                            10K                                  R0805       
S1                                  microswitch                            B3F-10XX    
S2                                  microswitch                            B3F-10XX    
U$1    Banana connector socket   4mm    
U$2    Banana connector socket   4mm    
U$3    Banana connector socket   4mm    
U$4      16x2 LCM (Character liquid crystal display module)  . Very cheap (2.25 USD) at ebay.   Not needed if you want to use only the serial monitor mode.   
Header connectors - male and female 
DUT      IN GND e c b e                        1X06
JANALOG  6x1F-H8.5-L14.5mm            1X06        
JANALOG1 POWER                             1X06        
JHIGH    10x1F-H8.5-L14.5mm              1X10        
JLOW     8x1F-H8.5-L14.5mm               1X08

Step 9: PCB's...

   The PCB's were ordered in the fab and after two weeks they came.

Step 10: Soldering...

     All the parts were soldered. I have decided to solder female header for LCM. On the LCD module, I have soldered pin headers. In this way I can simply attach and detach the display when needed or to use it for other projects  :-).
    When was possible, I tried to chose the most precise parts, from those available at home.

Step 11: Some explanation about the PCB

On the pictures can be seen how the tested devices (resistors, diodes, Schottky diodes, LEDS are inserted)

Step 12: Let's start the tests

    As first step I wanted to test the LCD connection and control correctness. For that purpose I used the well known "Hello world" example available in the "LiquidCrystal" library with small modifications.
   My LCM has different connections, as described in the example. The reason for that is - I wanted to have the "Arduino" digital pin #2 free, because I wanted to use the interrupt attached to this pin for other purposes.
     The pin connections are the following:

   LCM 1602                  Arduino

D4                                         6
D5                                         5
D6                                         4
D7                                         3
E                                          11
RS                                       12
RW - connected to ground

     Additionally, I have connected the display back-light  LED "K" pin to the "Arduino" digital pin 10. I wanted to be able to fade the back-light and to create some effects  ( "Overflow") .
     The modified "Hello world" sketch is attached.

Step 13: Functions definition

     The next step was to defined the all functional modes. I have counted 9 of them. They are shown on the picture. 
     Now the idea was to test the functional mode selection. I wanted that all the modes roll one after the other in one direction, by pressing the switch called "MODE". There are two switches on the shield board - the first duplicates the reset button of "Arduino", the second one is the "MODE" switch. As mentioned before, this switch is connected with pin #2 of the "Arduino" board. To this pin is attached the hardware INT0. Using the interupt, I have implemented debouncing of the switch. The debouncing and the menu state machine was tested with the attached sketch.

Step 14: The DMM software

After successful finishing of the previous tests, the main working DMM software was written.
The code is attached in the *.ZIP file.
I will explain only some main functions, the other simply repeat them:

The function for voltmeter (range 0-100V) :

void V_100() {
digitalWrite(v100, HIGH);
lcd.print("V-meter V=<100V");
Serial.println("* Voltmeter mode - Range 0 - 100 V *");
lcd.setCursor(0, 1);

prints some messages on the screen and calls the function voltage_meas() :

void voltage_meas() {
acc_value = 0;
for (int i=0; i <= 15; i++){
curr_value = analogRead(A0);
acc_value = acc_value + curr_value;
curr_value = int(acc_value/16);
if (curr_value == 1023) {
meas_overflow(); }
else {
switch (MODE) {
case 1:
disp_res = ( curr_value*supply*20)/1024*coeff_v100 ;
case 2:
disp_res = ( curr_value*supply*6)/1024*coeff_v30;
case 3:
disp_res = ( curr_value*supply*2)/1024*coeff_v10;
break; }
lcd.print(" V = ");
lcd.print(disp_res, 2);
lcd.print(" V");
Serial.print("* V = ");
Serial.print(disp_res, 2);
Serial.println(" V");

, which take 16 consecutive samples and
averages them. If the result is less than 1023, it converts the ADC word to corresponding voltage value and displays it on the screen. During this calculation, some trimming factors are added. First of them is the measured preliminary supply voltage (it is used as reference for the AD conversion), the second one tries to correct the devices mismatch. It is close to 1.00, but in some cases can differ few percents. This coefficient is determined empirically during the tuning phase. Explanation will follow.
If the result after the averaging of the 16 samples is 1023 the "meas_overflow" is called.

void meas_overflow() {
lcd.setCursor(0, 1);
lcd.print(" OVERFLOW!!! ");
Serial.println("* OVERFLOW!!! *");
lcd.setCursor(0, 1);
for (int i=0; i <= 101; i++){
analogWrite(back_light, brightness);
brightness = brightness + fadeAmount;
if (brightness == 255) {
fadeAmount = -fadeAmount ;

In this procedure the back-light is faded and a warning is displayed.

On the pictures can be seen the functioning DMM in different modes and functions.

P.S. Thanks to jfrontone, we have found a possible problem in the code.

It is in the button_pressed() procedure.

if the increment MODE=MODE++; does not work (sometimes this depends on the microcontroller chip or on the IDE version), you can write either MODE=++MODE; or MODE=MODE+1; . Until now no-one has reported about such problem in the "for" control structure - for example for (int i=0; i <= 101; i++)...

Step 15: Software tuning of the accuracy (part 1)

    Let's as first step to trim the voltmeter.
I will show how to do this for the range 0-10V. The other ranges are trimmed in the same way. 
To trim the accuracy for a given range the best approach is to chose trimming reference voltage, as close as possible to the upper limit of the range. Once trimmed for this voltage is assumed that, because of the linearity of the voltage divider and the AD conversion , the whole range is covered with the same accuracy. To trim the voltmeter for the range 0-10V I have taken new 9V battery.
As first step I have measured the power supply voltage at the "Arduino" board supply header. In my case it was 4.91V.
This voltage serves as reference for the ADC of the Atmega chip. It is included in the formula for the conversion of the taken ADC reading to voltage value:
                  disp_res = ( curr_value*supply*2)/1024*coeff_v10;

, where :
        disp_res  - is the voltage value displayed on the screen;
        curr_value - is the averaged digital reading;
        supply - is the measured power supply voltage ;
        coeff_v10 - is the software trimming coefficient 
     The next step is to measure the battery voltage by the standard DMM and to write the value.
     After that we measure the same battery with the "Arduino" based DMM. Based on both measurements we calculate the trimming coefficient   coeff_v10 as quotient resulting of the division of the first measurement result by the second measurement result.  In my case I have measured the battery with the standard DMM to be 9.51V. Measured by the "Arduino" DMM it was 9.34V.
The correction coefficient was calculated as:
     coeff_v10 = 9.51/9.34 = 1.018
The resulting value is assigned to the coeff_v10 in the code.
After recompiling and loading the code it is seen that after the trimming the "Arduino" DMM shows the target value.
I would recommend that this coefficient is calculated for few voltages measured with the same range settings and the final value entered in the code is the averaged of all calculated.

Step 16: Software tuning of the accuracy (part 2)

Let us trim the ampere meter.
The voltmeter trimming was easy - the error was caused only by the spread of the resistor values in the voltage dividers.
In the ampere meter the sources of errors are mainly:

  • the resistor spread of R1 (see the picture in step 4). Its value is 1 Ohm, and the exact value of the used device is difficult to be measured precisely
  • the voltage gain of the opamp - caused mainly by the resistors R2 and R3 values spread
  • The offset of the opamp Voffset. As mentioned before LM358 is not the best choice for this project ( I had one available and I have used it. That is the reason why the PCB supports also the SO08 package - not often used in our time). In the datasheet of the chip can be seen that the offset can be 7 mV. With our current to voltage transfer solution, this can introduce a constant current error of 7mA. It can happen that no current is passing, but the ampere meter shows 7mA, and vice versa : a current of 7 mA can flow and the device can show 0 mA.

All these errors must be cleaned up by the software.
As first step we have to determine the exact value of the R1 resistor. For that purpose I used a constant current generator.
I have applied 189.9 mA input current and I have measured 186.7 mV on the resistor R1. Its value is calculated to be 0.98315 Ohm. This number will be used also as correction coefficient.
Now remain two other parameter, which must be calculated / measured : the real voltage gain of the opamp and its offset voltage.
To determine them we need to make two separate measurements at two different currents. The measurements are : we fix the current by the current generator and we measure it once with the standard DMM and once with "Arduino" based DMM. The voltage on R1 is also measured during this procedure. Here are the results which I had :
Applied current Measured current Voltage over R1
(standard DMM) "Arduino" DMM (standard DMM)
[mA] [mA] [mV]

189.9 186 186.7
73.1 71.9 71.7

The opamp offset voltage is added to the voltage drop over R1, and the resulting potential is amplified 10 (corrected with the gain error coefficient) and finally converted by the ADC.
This process can be modeled with the following equation:
( VR1+Voffset)*coeff_A_gain=Imeas;
VR1 - is the voltage over R1;
Voffset - the input opamp offset voltage;
coeff_A_gain - gain error coefficient, in this case has unit of Siemens [S];
Imeas - measured by the "Arduino" DMM current

Based on this equation and the measured data, replacing Voffsetwith "x" andcoeff_A_gain with "y" a system of two equations and two unknown variables can be written:

(186.7 + x ) * y = 186
(71.7 + x ) * y = 71.9

186.7y + xy =186
71.7 y + xy = 71.9 ; extracting from the first the second equation

y = 0.992174 - the gain error caused by the resistor value spread of the gain defining resistors R2,R3

X = 0.767 mV - the input offset of the opamp (not so bad...)

The final code for the ampere meter now would have the following definitions:

float coeff_A_gain = 0.992174;
float coeff_A_res = 0.98315;
float opamp_offset = 0.000767;

The calculation of the current can be done with the following equation:
disp_res = (((curr_value*supply )/1024 - 10*opamp_offset)/coeff_A_gain)/coeff_A_res*100;

(see the step 14 for additional information)

Step 17: Trimming the ohmmeter

How to trim the ohmmeter I will show for the range 1000 Ohm. The same approach is used for the other range.

Before applying the software trimming some additional measurement must be done.

  1. The voltage drop over the Zener diode D2.
  2. To have stable current I have changed the following row in the main program ( loop () ) : digitalWrite(curr_mode, LOW------------------->HIGH); - in this way I can keep the current stable and to measure it during the welcome procedure. The current flowing from the PNP/PMOS collector/drain terminal to ground should be measured (picture 1)
  3. The same current is measured again but with serial connected resistance of 1KOhm (the max for the range) - picture 2. The voltage over the resistor should be measured too.

I have measured 2.5 mA in the first and 2.48 mA in the second measurements. My resistor was 997 Ohm.

Now we need to process the sampled data. To be able to make this we need to calculate also the Vce/Vds - the voltage drop over the transistor for bot cases.

This voltage - for simplicity I will write Vce is calculated using the following formula:

Vce = Vsupply - Vzener - Vr, where

Vsupply is the measured supply voltage of the "Arduino" board;

Vzener - the voltage drop over D2 (measured at step 1 above);

Vr - the voltage over the resistor - measured at step 3. For the first case is 0 V.

The calculated Vce and the corresponding currents are filled in excel file.(picture 3). Graph is done, and trendline corresponding to the date is shown (straight line). The equation of the trendline is displayed - it will be used for the calculations.

In my case Ir = Ice = 0.0081*Vce+2.4773 - using this formula we can calculate always the current Ice flowing through the measured resistor and also function of the voltage over the resistor, which is sampled by the ADC. Here is taken the presumption, that the dependence Ice of Vce is linear, what is commonly true.

Finally we calculate the resistance using the Ohm formula:

R = Vr / Ir

here is how the modified code looks like:


float V_zener = 2.16;
float Vr = 0;

float Vce = 0;

float Ice = 0;

float coeff_v100 = 1.01;

float coeff_v30 = 1.011;

float coeff_v10 = 1.018;

float coeff_A_gain = 0.992174;

float coeff_A_res = 0.98315;

float opamp_offset = 0.000767;

volatile unsigned long last_millis = 0;

void R_1000() {
digitalWrite(curr_mode, HIGH);



lcd.print("Ohmmeter R=<1000");

Serial.println("* Ohmmeter mode - Range 0 - 1000 Ohm *");

lcd.setCursor(0, 1);

acc_value = 0;

for (int i=0; i <= 15; i++)

{ curr_value = analogRead(A2);

acc_value = acc_value + curr_value; }

curr_value = int(acc_value/16);

if (curr_value >= 513) { meas_overflow(); }

else { Vr = ( curr_value*supply )/1024;

Vce = supply - V_zener - Vr; Ice = 0.0081*Vce + 2.4773;

disp_res = Vr / Ice * 1000;

lcd.print(" R = ");

lcd.print(disp_res, 1);

lcd.print(" Ohm");

Serial.print("* R = ");

Serial.print(disp_res, 1);

Serial.println(" Ohm");

delay(250); }


As conclusion:

The presented multimeter is designed in the simplest way, trying to embed as much functions as possible. This approach brings some undesired features - the input resistance is very low, the accuracy in comparison with the standard fabric DMM is lower. The reasons for that are :

the matching of the discrete elements (mainly resistors);

not enough accuracy of the microcontroller ADC - it is 10 bit, but allows error of 3-4 LSB;

the digital noise affecting the analog measurements;

not well fixed supply voltage (it can vary when the DMM is connected to different computers), which serves as voltage reference for the ADC converter;


Despite all disadvantages, in this work was shown, how using software tricks, the accuracy of such device can be drastically increased - starting with multiple ADC readings, their averaging and all additional software trimming. I think that similar project would be interesting for students willing to get deep inside the data measuring and processing theory. It can be used also as DMM replacement for home electronic projects, which do net require more complicated measurement tools.

Thank you for the attention!

<p>Dear Milen<br><br>You did a great job ! I have a project that need to use arduino as multimeter. Could you help me something? If i just want to use Arduino for measuring Current, Voltage, and Temperature and send the data to PLC, I don't need to show in LCD, but send to PLC.<br>What is the code should i use in Arduino program ? If Arduino's TX pin connect to TTL to RS232 converter.</p>
Thanks,<br>I think - you have to decide which type of communication you want to use : SPI or I2C and depending on this to define the used pins and libraries. From the code you can remove then the LCD and serial monitor part.
<p>Dear Milen,<br> Thank you for your replied and sorry for my late respond. I read about SPI and I2C as you recommended, So i chose I2C be my answer because I have to measure in real-time and yes I2C has more speed than SPI. I have a design for my Arduino measuring Voltage and Temperature as this in attached picture. Will it work ? I will use TX port for sending data to &quot;TTL to RS232&quot; and then to PLC.</p>
<p>Hi,</p><p>Check the connections of the voltage sensor - seems that the sig and supply pins are swapped. Is it not possible to supply this sensor with 5V arduino supply?</p><p>Do not forget pull-up resistors needed for the I2C communication. I suppose that also the rx TTL pin shall be connected - some return data is send also during the communication.</p><p>regards</p><p>Milen</p>
<p>Dear Milen,<br>Thank you very much ! But i'm not sure about the code. If i connected IR Temp and Voltage Sensor(swapped it already) with Arduino, Should i write the code like &quot;DigitalRead(A1, Voltage) and DigitalRead(SDA or SCL, Temp)&quot; like this ?<br>I know about doing code to show in LCD, But I don't know about sending/receiving data from TX/RX pin. Could you give me some hint ?<br>Sorry for bothering you a lot.</p>
<p>Hi .</p><p>Please write the type of both sensors. For the temperature sensor I suppose you have to serch the proper arduino library. The voltage sensor seems to me to have an analog output (check if true). In this case you have simply to use AnalogRead(A0). Check what should be the output voltage if you supply the sensor with 9V battery (as on the picture). If it is higher than 5V - an error will occur - you have to insert proper resistor voltage divider at the output of the voltage sensor and the analog arduino pin.</p>
<p>Great project! What are the dimensions of the PCB? I am going to order one but need the size and I can't read the Eagle files.</p><p>Thanks,</p><p>Will</p>
Hi Will,<br><br>The PCB size is 92.1 x 53.6 mm. Good luck.<br><br>Regards<br>milen
Thanks for the fast reply. My idea is to piggyback your electronics with a Pi Zero and have the Pi deliver a GUI front end. Ideally I want to get the Eagle board into Fritzing and hope I can find a conversion tool as I don't want to learn Eagle!<br><br>Will
<p>Hello Milen,Ray,</p><p>I am interested to make PCB for this design. If its possible may any of you share the Gerber files? I am going with PCBway.</p><p>Thanks</p>
<p>Hi Nituj,</p><p>I have attached the gerber files at step 3 of the instructable for download.</p><p>If any problem - please, contact me.</p><p>Regards</p><p>Milen</p>
<p>Hi Milen,</p><p>Thanks for the quick response and files. I will update BOM with part numbers &amp; I am going to build 5 numbers.</p><p>Thanks for the excellent project &amp; of course sharing your design.</p><p>Regards</p>
<p>Hi Milen,</p><p>I am only now ordering parts for this project because I had health problems. Old age is not good, but the alternative is worse! :-) I can't find the package &quot;085CS_1AR&quot; for C21 in Google, so can you give me some idea of the specification for this item? What voltage and accuracy are needed?</p><p>Best regards,</p><p>Ray</p>
Hi Ray,<br>This was a device from Eagle library. It is SMD tantalum capacitor.<br>I think you can solder there any capacitor size C or D1:<br>http://servenger.com/Resource/Tantalum_Chip_Caps_Case_Codes.pdf<br>Get well soon!<br>Milen<br><br>
<p>Great! Thanks Milen! I don't wish to offend, but I think C21 is electrolytic? It shows polarised on your schematic, and I think this is correct?</p><p>My bones ache, but my brain still works!</p><p>Ray</p>
<p>Hi Ray,</p><p>You are absolutely right : </p><p><a href="https://en.wikipedia.org/wiki/Tantalum_capacitor">https://en.wikipedia.org/wiki/Tantalum_capacitor</a></p><p>but if do not find such, you can solder a standard electrolytic one - simply bend it leads and solder them on the solder pads.</p><p>Regards</p><p>Milen</p>
<p>HI Milen,</p><p>I ordered the PCB's from PCBWay, and 3.5 days later they arrive at my home in Australia. $AUD55 for five boards. Unbelievable service. You just can't get that in this country. Thank you so much for your help. I can hardly wait to put the first one together.</p><p>Best</p><p>Ray</p>
<p>Hi Ray,</p><p>I am glad that I could help you.</p><p>Regards</p><p>Milen</p>
Thank you Milen. I have ordered my first PC's from PCBWay already using your Gerber files. And the link to ITEAD Studio is excellent. I can follow this procedure in future very easily. You have been very helpful and thanks again!<br>Best regards,<br>Ray
<p>Hi Milen, this is a wonderful instructable, and your instructions are very precise. I would love to make this, but the cost of the PCB in Australia is like $150.00. Have you any ideas on getting them made elsewhere? Is it only back and front or are there many layers? Like, could I perhaps make the PCB myself?</p><p>Thank you,</p><p>Ray</p>
Hi Ray,<br><br>Here : http://www.pcbway.com/setinvite.aspx?inviteid=9970<br>you can make your boards (10 pieces) for ~ 10 times less money.<br>You can pay with paypal and they will arrive for 8-14 days.<br>Simply make an account at their site, send them the gerber and drill files, and pay the PCB's. You can track the production process and after that also the delivery. Also the PCB color can be chosen without price increase. The PCB's fpr this project are contaion only two metal layers - top and bottom.This makes the PCB.s cheaper and is fully enough.<br>Regards and good luck with the designing.<br>Milen<br>P.S. You can order also less than 10 PCB;s, but I am not sure is this would affect the price when 10 ordered.
Hi Milen,<br><br>Thank you so much for this. They are quoting only $13 for 5 pieces which is amazing!!!! Now I need an intractable on how to create the gerber files. There are so many variables in Eagle I am so confused. Like, what is &quot;wheel&quot;? but I will study this and try to create the right files.<br><br>Thanks again, fantastic 'able.<br><br>Ray
<p>Hi Ray,</p><p>I think that this will work for you:</p><p><a href="http://blog.iteadstudio.com/how-to-export-gerber-files-from-eagle/">http://blog.iteadstudio.com/how-to-export-gerber-f...</a></p><p>It is different PCB company, but the rules are acceptable by PCBway and</p><p>no problem shall appear.</p><p>Regards</p><p>Milen</p>
<p>Hi Milen,</p><p>Thank you for this good job!</p><p>Would you please help me to change the circuit like MeR5's request? Voltage range is 0~5V only, and current range is 0~100mA. For 100mA current measurement, I change R9 from 1 Ohm to 5.1 Ohm, and if I change R11 to larger one then I can reduce the measure range more because I want to get more precise measurement. Is it OK?</p><p>And I want two inputs for voltage, and two for current.</p><p>Thanks you!</p><p>Daniel</p>
Hi,<br>You can simplify the circuit a lot...<br>If you want to measure voltage between 0 and 5 volt, you do not need any voltage divider and switching circuitry at the inputs.<br>Simply apply the voltage to the input of the arduino ADC.<br>I<br>In all cases I would advice you to put some protection on these inputs - for example a resistor 10K and a zenner diode 5.1..5.6V.<br>If the measured voltage comes from the device, which is supplied by<br>the same power supply, used for the arduino - this is not needed.<br>You can use directly two ADC arduino inputs.<br>For the current measurements - different approaches can be used -<br>the simplest - you put resistor 50 Ohm and pass the current through - measure the voltage drop directly over it - without the use of any opamp. - disadvantage - the power dissipated by the resistor at max current (100mA) will be 0.5W. If you use small size resistor, it can overheat and to burn or at least to change it value (because of its TC), which could affect the accuracy of the measurement.<br>-the second method which can be used, is the actual.<br>Using 5.1 Ohm resistor will cause that the voltage drop over it with 100mA current is 510mV. The arduino supply is 5v. That means : you should amplify this voltage max 5/0.51 times. In other case the ADC will go in saturation. This gain defines the values of the resistors, you should use. The opamp is in noninverting configuration - the gain is 1+(R11+R12)/R9.<br>You will have the highest accuracy if at the maximum allowed current the input voltage at the ADC inputs is identical to the ADC reference (in this case the supply voltage).<br>Disadvantage of these current measurements, that the current is collected in the arduino ground. To measure some passing current, which flows further in other device - you should not merge both ground nets. The arduino must be floating. Solution for this problem can be found here:<br>https://www.maximintegrated.com/en/app-notes/index.mvp/id/746<br>You can use such chip with all needed supporting circuitry.<br><br>
Hi Milen,<br><br>Thanks for your quick reply.<br>It's a little hard to figure out your comment for me right now. I need time to digest.<br>My goal is to use Arduino to monitor voltage &amp; current of a driving board. This current output from board to operate a small device, its power consumption is about 30mA. I need to monitor the current drop during the device operation for a long time (500hrs Reliability Assurence). At the same time I need to monitor other constant voltage (among 4~5V) that will keep the previous output in the same level.<br>Do you have any specific suggest for my situation? <br>Can I measure voltage only between 4~5V? If it can be, I can get 5X precision of voltage measurement.<br>Thanks again!<br>Daniel
<p>Hi Daniel,</p><p>You can measure the voltage between 4-5 V using opamp in non-inverting configuration with reference 5V and gain of 5.In this way when you have 4V at the input - the output will be at 0V. With 10 bit resolution you will be able to measure the voltage with ~ 1mV precision, For the current measurements I would suggest that you use some if the chips, mentioned here - <a href="https://www.maximintegrated.com/en/app-notes/index.mvp/id/746">https://www.maximintegrated.com/en/app-notes/index...</a></p><p>Shall this be high or low side current measurement chip - depends in that is the current sourced from or sunk in the load</p>
Hi Milen,<br>Would you please give me further hint on &quot;opamp in non-inverting configuration&quot;, I hope I can carry it out. Thanks.<br>Daniel<br>
<p>Hi Daniel,</p><p>You can read this: <a href="http://www.analog.com/library/analogDialogue/archives/39-05/Web_Ch1_final_R.pdf">http://www.analog.com/library/analogDialogue/archi...</a></p><p>Page 8. Fig1-3. Only the bottom terminal of Rg connected to the 5V supply.</p><p>When Rf/Rg=4, the gain is 5 and 4V input voltage will bring your output to 0V.</p><p>The opamp used should have common mode input voltage covering the positive supply rail, and rail to rail output. The input offset should by small.</p><p>One solution could be: <a href="http://www.linear.com/product/LT6004">http://www.linear.com/product/LT6004</a>.</p>
<p>Thanks a lot! I will try.</p>
<p>please can you help me to change a little bit this circuit to become a circuit that measured only voltage and current permenantly and without buttons and choice of the measurment</p><div><br><div><div><div>about the component sn74lvc2g66 , i didn't found it , can i replace it with other component</div></div></div></div>
Hi,<br><br>If you want to simplify the circuit - only for V and I - you do not need <br>sn74lvc2g66. Please, be more specific - what is the input voltage range, how big is the current you want to measure? How many inputs you will have? Two for voltage, and two for current, or they have to be combined - you want to measure the voltage over the load through you also measure the current?
<p>Thank you for your answers, indeed the objectif of our project is to build a circuit that is used to measure I and V (always) without interreption and send its measures at distance (we will use a GSM module for this) the problem remains in the manufacturing of the measuring circuit; V max is 380V and 500A is I max</p>
<p>Hi,</p><p>500A is very serious current :-). It will be difficult to measure it using the principle used in the DMM.</p><p>You have to use such kind of device:</p><p><a href="http://www.aliexpress.com/item/500A-AC-DC-4V-to-send-maps-isolate-microcontroller-designed-for-power-measurement-module-detection-chip/32572802869.html">http://www.aliexpress.com/item/500A-AC-DC-4V-to-se...</a></p><p>It should have a microcontroller inside, and you have to catch only the data.</p><p>Another possible, but <strong>very</strong> difficult for implementation solution is to use </p><p>Allegro current measurement chips, connected in parallel (for example</p><p>ACS770xCB, which could measure 100A), but splitting of the current in 5 branches could be practically impossible. </p><p>The voltage of 380V could be measured - it will need some high resistive voltage divider (but the precision will be not high -especiall for lower voltages, because of the 10bit resolution of the atmega ADC and the possible resistor mismatch) This can be corrected by the software, but in some limits.</p>
circuit simulation by proteus isis please
<p>Sorry,</p><p>I did not use proteus. I use LTSpice for simulations and Eagle for PCB's.</p><p>But I did not simulate this circuit. There is nothing to simulate there.</p><p>All are simply equations.</p>
<p>found the problem with my project. I went back to having the same problem with the C8051F320/1 microcontroller. why not flowing into the modes????? well one simple fix in your code to fix them all with the debounced switch working great thanks to Jeremy Blum. problem is commented out:</p><p>void button_pressed() {<br> long current_Time = millis(); <br> if ((current_Time - last_millis) &gt; 150) {<br> last_millis = current_Time; <br> <br> if (MODE == 9) {<br> MODE = 1; <br> } <br> else {<br> // MODE = MODE++; issue is here<br> MODE = MODE+1; solution. all it was <br> } <br> }<br> } </p><p>Thanks for the great project and your patience with me. </p><p>Thank you thank you thank you</p>
Congrats...I am glad that you succeeded to solve the problem!<br>Good luck with the project and all the best
<p>Thank you for your response. I will try all your advise and see if I did make a wiring mistake or other issue. </p><p>Thank you for your time.</p>
<p>Okay I have had the project wired up for a while and tried everything debouncing, so gave up on that. I thought I found a solution to make the code you wrote go past the welcome screen. A debounced switch such as a 10K resistor from 5V to positive side of switch with a .33uF capacitor across the switch, then an inverted Schmitt trigger going to pin 2. It actually works on all other code except yours. Not sure what to do next. I am very frustrated as I have 2 weeks to make this work and have no solutions to the problem. I even tried writing the code different ways and nothing past welcome screen or running the loop to get to the modes. If you have any wisdom I would appreciate it. Sorry if I seem needy. lol. I know it is not in the hardware as it worked with other code. The issue with debouncing is I did not know how to add the millis() (milliseconds) to make it debounced. Still new at this code. </p>
Hi,<br><br>It is very strange for me.. No one except you is reporting problems with code. It is not perfect, but it works somehow. Sometimes it skips some menu item, but this should not be a big problem. You can compare the performance of the shield with yours looking the movie. If you want to implement hardware debouncing - you could find a lot of circuits in internet. Easy circuit can be done by the use of the 555 timer in mono-stable mode. You can try also to use external clock generator with low frequency instead the switch on pin.2. I saw that use Arduino Mega - its pin 2 is connected with interrupt 0. <br>For me seems that you have a hardware problem - I would advice you to make some very simple setup - connect only the LCD through breadboard (you can even not connect the LCD) - you can use the serial monitor - take a bare arduino, connect a switch with resistor at pin 2 as in the schematic, load the code, start the serial monitor and press the button - if it does not work, try with other arduino board....if it works - search the problem in the connections.<br>I see that you use a lot of cable connections - It can be that you have somewhere a bad contact. If you want, you can trace the connection between the switch and the arduino pin #2, but measuring the resistance from the arduino header to the pins of the switch. I hope that you will find the problem soon...<br>P.S Last idea...Check you fuses. The default settings for arduino Mega are<br>Arduino Mega 2560<br><br>Low Fuse 0xFF<br>High Fuse 0xD8<br>Extended Fuse 0xFD<br><br>P.P.S. Change the code in the way that for debouncing is not used INT0, but INT1. (Arduino mega has 6 external interrupt pins). INT1 is on pin 3 - connect the switch there and check again...<br><br>
I will keep trying. Thanks <br>It was the digital debounce example out of the menu. Might put that example into the sketch with a little modification.
I am having problems with getting the mode button to change the mode. I tested the button with the normal debounce example and it worked. Not sure why this is not changing on your DMM code.
Hi,<br><br>The reasons can be few:<br>1) Check the correctness of the circuit - do you have the pull-up resistor at the mode input - if you do not have, you can activate the <br>internal one.<br>2) I do not know which example you tried, but as you see in the code I use the interrupt 0 for debouncing. That means - the button must be connected to arduino uno or mega pin 2. The interrupt is activated on rising edge of the signal - you can try to change it to falling or change.<br>You may try to simplify the program - at first to try to run only small parts - for example only to change the mode and to print it out in the serial monitor...<br>
Thankyou for the answer and I will do my best. Adding in some LED driver channels to test a line of LEDS and using the current generator for single. The max 407 is actually doing well. Wish you well in your work. Wish I had your job. If time will post it all with my efforts.
Hello, I am currently building this project and wondering if you have any updates or as you discussed going further into the problem. I think cost should be last in our thoughts of making this better. I am wondering if the Max 407 off of the constant current generator can replace the LM358? Are there alternative ways to produce the trimming current? You were the only reference for anything like this and appreciate the post. I am putting this in a project box and going to make it more precise to use at work. I need to have 3 decimal points. Anyway please continue to work on this as I think this is the better project out of all of them for anyone in electronics for refresher and learning more about engineering. Well hope You consider to keep going.
<p>Hi,</p><p>I would like to wish you success in the building of the project.</p><p>It should be not a problem to use MAX407 as current generator. To have better results, you should use Arduino Due - its ADC has 12 bit resolution. The bad thing is that it uses 3.3V supply - some resistor values might need to be changed. Good thing of using the Arduino Due - it has 10bit DAC, which you could use for creating of some voltage reference (instead a Zenner diode) or to adjust fine the trimming current - the voltage of the DAC could be applied at the V2C converter input.</p><p>In the current time I do not have enough free time to do something additional in this project, but you can try to improve the design by yourself (it is not perfect). The only new thing I did is: I included additional menu item - random number generator - it produces for me a set of random numbers, which I can use to play in lottery (6 of 49) :-) . This feature is not published - it is specific for each country. If you improve the design I would suggest you to describe you modifications in a different instructable.</p><p>In all cases as this design is now - it should not be used at places where precise measurements are needed - for example at work. Additional work must be done also in the direction of enlarging the input resistance. As it is in the moment in some cases can be a reason for false measurements (if the output resistance of voltage the source you want to measure is relatively high).</p><p>Good luck in the playing....</p>
Oh and is there an update to this for further investigation on my part to make better.
I am building this DMM. I noticed that a max 407 was used in the constant generator and wondering if that can replace the LM358. Also trying to find a generator for trimming. Is there an easier route to produce the current? The generator at school has limits. I might just have to build the generator. I had used your design last quarter to adapt this meter to a C8051F320/1. Everything worked except the obvious, Too much code and just needed to add a variable to finish. I am using the Arduino now for simplicity. Also debounce of the switch worked with a small delay and a small capacitor across the switch. Anyway thank you for being the only reference for this project. Having fun.
<p>Hello. Thank you sharing your work. I have a question regarding the transistors. I dont wanna use smd transistor so can you advice me any? </p>

About This Instructable



Bio: Thank you all for following me.
More by Milen:Arduino controlled power supply source Arduino Nano to Arduino Uno adapter Arduino controlled tiny FM radio 
Add instructable to: