24
IMPLEMENTING A DIGITAL MULTIMETER MAE 576 [MECHATRONICS] LAB-2 GROUP E Chembrammel Elavunkal Srinivasan Vishwajeet University at Buffalo, Mechatronics, Spring 2010

IMPLEMENTING A DIGITAL MULTIMETER

Embed Size (px)

DESCRIPTION

Implementation of a digital multimeter using basic stamp2 on a professional development board. It also includes R2R ladder network for digital to analog conversion

Citation preview

Page 1: IMPLEMENTING A DIGITAL MULTIMETER

IMPLEMENTING A

DIGITAL MULTIMETER

MAE 576 [MECHATRONICS] LAB-2GROUP E

Chembrammel Elavunkal Srinivasan Vishwajeet

University at Buffalo, Mechatronics, Spring 2010

Page 2: IMPLEMENTING A DIGITAL MULTIMETER

INTRODUCTION

Implement and facilitate analog to digital (A to D) and from digital to analog (D to A) conversion using the Basic stamp II kit

The circuit used for the implementation is drawn The code controlling the hardware is included to

complement the understanding of the functioning of the multimeter.

The accuracy of the multimeter is discussed Solution to improve the accuracy is proposed.

University at Buffalo, Mechatronics, Spring 2010

2

Page 3: IMPLEMENTING A DIGITAL MULTIMETER

OBJECTIVES

University at Buffalo, Mechatronics, Spring 2010

To implement a digital ohmmeter using the BS2 RCTIME command to measure resistance.

To implement a digital voltmeter using chip ADC0831 to measure varying voltages.

To implement an R-2R ladder circuit to facilitate digital to analog conversion.

To implement a Pulse width Modulation based digital to analog converter using chip LM358N.

3

Page 4: IMPLEMENTING A DIGITAL MULTIMETER

HARDWARE OVERVIEW

University at Buffalo, Mechatronics, Spring 2010

4

Basic Stamp 2 (Rev. J) Module Professional Development Board 2 x 16 Parallel LCD

Page 5: IMPLEMENTING A DIGITAL MULTIMETER

HARDWARE OVERVIEW

University at Buffalo, Mechatronics, Spring 2010

5

Professional Development Board (PDB) A Power switch L

L293D high-current quad half-H driver

B2.1 mm power connection,

centre positive, input voltage 6-12 VDC

MEight active-low push-

buttons with 5V pull-ups

CSerial programming

interface, DB-9N

Eight active-low DIP switches with 5V pull-ups

DBS1-IC, BS2-224, BS2-40

and Javelin Stamp socketsO

Pulse generator with 1Hz, 10Hz, 100Hz and 1 kHz

selectable output

EBS1 Serial Adapter

connectionP

RJ-11 connector for X-10 or 1-Wire I/O

F Sixteen blue discrete LEDs QMAX232E RS-232 DCE line

driver

GFive blue 7-segment LED

displaysR

DS1307 I2C real-time clock with 3V battery backup

HParallel LCD interface with contrast pot (4/8-bit modes

supported)S SX28AC/DP socket

I

Two servo headers (can also be used for Parallax Serial LCD displays and PING)))

sensor)

TSX-Key/SX-Blitz

programming connection

J Two 10K potentiometers USolderless breadboard for

connecting external components

KAudio amplifier with volume

control (speaker on-board/ext selectable)

Page 6: IMPLEMENTING A DIGITAL MULTIMETER

HARDWARE OVERVIEW

University at Buffalo, Mechatronics, Spring 2010

6

Basic Stamp 2 (Rev. J) Module

Page 7: IMPLEMENTING A DIGITAL MULTIMETER

HARDWARE OVERVIEW

University at Buffalo, Mechatronics, Spring 2010

7

EEPROM

Regulator

InterpreterPIC16F57

Name BS2-IC

Package 24-pin DIP

Package Size (L x W x H) 1.2"x0.6"x0.4"

Environment-40 to +185 oF (-40 to

+85 oC) **

Processor Speed 20 MHz

Program Execution Speed ~4,000 instructions/sec.

RAM Size 32 Bytes (6 I/O, 26 Variable)

Scratch Pad RAM N/A

EEPROM (Program) Size 2K Bytes, ~500 instructions

Number of I/O pins 16 +2 Dedicated Serial

Voltage Requirements 5 - 15 vdc

Current Draw @ 5V 3 mA Run / 50 µA Sleep

Source / Sink Current per I/O 20 mA / 25 mA

Source / Sink Current per unit 40 mA / 50 mA per 8 I/O pins

PBASIC Commands 42

PC Programming Interface Serial Port (9600 baud)

Windows Text Editor Stampw.exe (v1.04 and up)

[i] http://www.parallax.com/tabid/134/List/1/ProductID/1/Default.aspx

Basic Stamp 2 (Rev. J) Module

Page 8: IMPLEMENTING A DIGITAL MULTIMETER

HARDWARE USED

University at Buffalo, Mechatronics, Spring 2010

8

Component NameOn PDBY/N

Part # Page #

BS2 – IC Y Basic Stamp2 Module

PDB - Professional Development Board

Switches* Y [M]

Resistors N100Ω(3), 220Ω(1), 1kΩ(3), 2.2kΩ(5)

-

Capacitor N 0.1μF (1) -

ADC0831 NADC0831 (8-bit Analog to Digital Converter)

LM358N N LM 385 (Op-Amp)

LCD Display N 2 x 16 Parallel LCD

Page 9: IMPLEMENTING A DIGITAL MULTIMETER

HYPOTHESIS

University at Buffalo, Mechatronics, Spring 2010

9

The aim of the experiment can be summarized as follows: R-2R Mode Off When Switch S1(part M) is pressed, display the value of the unknown

resistance on the LCD. When Switch S2 is pressed, display the value of the voltage on the LCD. Switch S3 is used to toggle the R-2R mode. Once it is pressed, the R-2R

mode is enabled. R-2R Mode On When Switch S1(part M) is pressed, increment the value of the voltage in

steps of 16 and display on the LCD. When Switch S2 is pressed, decrement the value of the voltage in steps of

16 and display on the LCD. Switch S3 is used to toggle the R-2R mode. Once it is pressed, the R-2R

mode is disabled.

Page 10: IMPLEMENTING A DIGITAL MULTIMETER

PROPOSED SOLUTION

University at Buffalo, Mechatronics, Spring 2010

10

In the light of the objectives and the constraints we would like the digital multimeter to have the following characteristics

Integrate voltmeter, ohmmeter, R-2R circuit and PWM to obtain functionality of multimeter.

Develop a flow chart to get better understanding of process

Create circuit layout to integrate all necessary hardware Program code to ensure full operation spectrum Implement finished digital system

Page 11: IMPLEMENTING A DIGITAL MULTIMETER

CONSTRAINTS [Self Imposed]

University at Buffalo, Mechatronics, Spring 2010

11

Ensure clean hardware implementation Reduce use of hardware resources Streamline coding to achieve optimal functionality Test and achieve maximum accuracy in measurement

i. P14 is used for button 3 as well as for CS of one of the ADCs.

ii. P15 is used for RCTIME as well as for CS of the other ADC.

Additional Goals

Page 12: IMPLEMENTING A DIGITAL MULTIMETER

PROCEDURE

University at Buffalo, Mechatronics, Spring 2010

12

Ohmmeter:-

The RC circuit is constructed as shown in figure 1 using I/O pin of the basic stamp. The resistance to be measured is connected between the point 1 and the ground. The LCD

display is interfaced on to the stamp board as recommended. The ohmmeter measures the resistance in a range between 1kΩ-10kΩ. The output that is to be measures is connected to the basic stamp I/O pin 15. The RC time command of the basic stamp is used in the code to measure the time taken for

the discharge of the capacitor which is related to the resistance value using a relation. The RC time obtained was used to calculate the resistance A desktop multimeter is used to calibrate the ohmmeter. The resistance value is displayed on the LCD in KΩ. The Ohmmeter is activated by a push button which is connected to the I/O pin 12 of the basic

stamp.

Page 13: IMPLEMENTING A DIGITAL MULTIMETER

PROCEDURE

University at Buffalo, Mechatronics, Spring 2010

13

Voltmeter:-

The voltage output from the potentiometer (i.e the voltage divider) is provided to the ADC . The ADC is connected as recommended in the manual using 3 I/O pins of the basic stamp. The pushbutton to activate the voltmeter is connected the pin 13 of the basic stamp. Using the measured value and the output value from the ADC calibration is made. A desktop

multimeter is used to note the output voltage from the potentiometer. The voltage thus measured is displayed on the LCD in binary form and in decimal form.

Pin Connections of ADC0831 in the Voltmeter Circuit Pin 1(i.e chip select) of the ADC is connected to the pin 14 of the BS2 which is connected to

the push button-I. Pin 2 (i.e Vin) is connected to the potentiometer since it is the source of input. Pin3 is connected to pin 4 (gnd) . Pin 5 is connected to VDD via pin 5 of the second ADC. Pin 6(DO) is connected to the pin 11 of the BSII via pin 6 of the other ADC.

Page 14: IMPLEMENTING A DIGITAL MULTIMETER

PROCEDURE

University at Buffalo, Mechatronics, Spring 2010

14

R-2R Ladder:-

A second ADC0831 is used to measure the voltage levels from the R2R ladder. Since the clock and data out pins (pins 7 & 6 respectively) take the same signals as

the first ADC0831 they are connected to the same BS2 pins (pins 7 & 6). The pushbutton to activate the R2R ladder is connected to P14 which is same as

the /CS pin of the first ADC0831, since the IC is not active at this time.d The pins 8 through 11 are the inputs to the ladder branches. Using the measured value and the output value from the ADC calibration is made.

A desktop multimeter is used to note the output voltage from the potentiometer. The voltage thus measured is displayed on the LCD in binary form and in decimal

form.

Page 15: IMPLEMENTING A DIGITAL MULTIMETER

PROCEDURE [Flow Chart]

University at Buffalo, Mechatronics, Spring 2010

15

Flow Chart

Page 16: IMPLEMENTING A DIGITAL MULTIMETER

PROCEDURE [Circuit]

University at Buffalo, Mechatronics, Spring 2010

16

Circuit

Page 17: IMPLEMENTING A DIGITAL MULTIMETER

PROCEDURE [Pin Layout]

University at Buffalo, Mechatronics, Spring 2010

17

Pin Layout

PIN # Component Device

P0 D4 LCD Data Input

P1 D5 LCD Data Input

P2 D6 LCD Data Input

P3 D7 LCD Data Input

P4 E LCD Pulse Input

P5 RS LCD Command/Write

P6 DataINADC (R-2R) and ADC

(Voltmeter)

P7 ClockADC (R-2R) and ADC

(Voltmeter)

P8 BIT0 [LSB] R-2R Network

P9 BIT1 R-2R Network

P10 BIT2 R-2R Network

P11 BIT3 R-2R Network

P12 BTN0 Ohmmeter Button

P13 BTN1 Voltmeter Button

P14BTN2

&Chip Select

R-2R Mode Select&

ADC(Voltmeter)

P15RC Circuit

&Chip Select

Ohmmeter&

ADC(R-2R)

Page 18: IMPLEMENTING A DIGITAL MULTIMETER

PROCEDURE [Source Code]

University at Buffalo, Mechatronics, Spring 2010

18

Source Code (Attached to Webpage)

Page 19: IMPLEMENTING A DIGITAL MULTIMETER

IMPLEMENTATION

University at Buffalo, Mechatronics, Spring 2010

19

Page 20: IMPLEMENTING A DIGITAL MULTIMETER

CALIBRATION-Ohmmeter

University at Buffalo, Mechatronics, Spring 2010

20

Resistances Used

(kΩ)

Digital Multimeter Basic Stamp Multimeter

Raw Data (kΩ)

Rounded Data (kΩ)

Non-Calibrated Data

Calibrated DataAbsolute

Error (kΩ)Value

(kΩ)%

ErrorValue

% Error

1.0 0.968 1.0 0.8 20.00% 0.820.00

%0.2

2.2 2.13 2.1 2 4.76% 24.76%

0.1

3.2 3.1 3.1 3.1 0.00% 33.23%

0.1

4.4 4.28 4.3 4.4 2.33% 4.22.33%

0.1

4.7 4.59 4.6 4.7 2.17% 4.52.17%

0.1

5.7 5.56 5.6 5.8 3.57% 5.60.00%

0.0

6.9 6.73 6.7 7.1 5.97% 6.81.49%

0.1

7.9 7.7 7.7 8.1 5.19% 7.92.60%

0.2

9.4 9.16 9.2 9.7 5.43% 9.42.17%

0.2

10.0 9.76 9.8 10.4 6.12% 10.13.06%

0.3

11.0 10.73 10.7 11.4 6.54% 11.13.74%

0.4

Page 21: IMPLEMENTING A DIGITAL MULTIMETER

Calibration-Voltmeter

University at Buffalo, Mechatronics, Spring 2010

21

Measurements

(V)

Digital Multimeter Basic Stamp Multimeter

Raw Data (V)

Rounded Data

(V)

Raw Data (V)

Rounded Data (V)

% ErrorAbsolute Error

(V)

0 0 0 0 0 - 0.00

0.5 0.498 0.5 0.509 0.51 2.00% 0.01

1 1.025 1.03 1.039 1.04 0.97% 0.01

1.5 1.504 1.5 1.509 1.51 0.67% 0.01

2 2.09 2.09 2.098 2.1 0.48% 0.01

2.5 2.49 2.49 2.51 2.51 0.80% 0.02

3 3.02 3.02 3.059 3.06 1.32% 0.04

3.5 3.48 3.48 3.51 3.51 0.86% 0.03

4 3.97 3.97 4 4 0.76% 0.03

4.5 4.49 4.49 4.529 4.53 0.89% 0.04

5 4.97 4.97 5 5 0.60% 0.03

Page 22: IMPLEMENTING A DIGITAL MULTIMETER

Calibration-R2R

University at Buffalo, Mechatronics, Spring 2010

22

Digital Increm

ent

Binary

Value

BIT3 (V)

BIT2 (V)

BIT1 (V)

BIT0 (V)Expected Voltage

(V)

Increment of 16

2.5 1.25 0.625 0.3125 BINARYHEX

0 0000 0 0 0 0 0 00000000 01 0001 0 0 0 1 0.3125 00010000 102 0010 0 0 1 0 0.625 00100000 203 0011 0 0 1 1 0.9375 00110000 304 0100 0 1 0 0 1.25 01000000 405 0101 0 1 0 1 1.5625 01010000 506 0110 0 1 1 0 1.875 01100000 607 0111 0 1 1 1 2.1875 01110000 708 1000 1 0 0 0 2.5 10000000 809 1001 1 0 0 1 2.8125 10001111 8F10 1010 1 0 1 0 3.125 10011111 9F11 1011 1 0 1 1 3.4375 10101111 AF12 1100 1 1 0 0 3.75 10111111 BF13 1101 1 1 0 1 4.0625 11001111 CF14 1110 1 1 1 0 4.375 11011111 DF15 1111 1 1 1 1 4.6875 11101111 EF

Page 23: IMPLEMENTING A DIGITAL MULTIMETER

CONCLUSION

University at Buffalo, Mechatronics, Spring 2010

23

Successfully implemented a digital multimeter

Digital to analog converter

Page 24: IMPLEMENTING A DIGITAL MULTIMETER

REFERENCES

University at Buffalo, Mechatronics, Spring 2010

24

http://www.parallax.com/Store/Education/KitsandBoards/tabid/182/CategoryID/

67/List/0/SortField/0/Level/a/ProductID/320/Default.aspx

http://ww.parallax.com/tabid/441/Default.aspx BASIC Stamp Syntax and Reference Manual http://www.parallax.com/tabid/214/

Default.aspx http://www.parallax.com/tabid/134/List/1/

ProductID/1/Default.aspx http://www.parallax.com/Portals/0/Downloads/

docs/prod/audiovis/lcd2x16par.pdf http://www.national.com/mpf/DC/

ADC0831.html#Parametrics