electronic load and other circuit ideas

6
www.edn.com March 17, 2005 | edn 91 ideas design I t is sometimes necessary to retrieve data at power-up in the same way that they were at the last power-down, so that the product wakes up in the state it had before shutdown or to retrieve some measurement. One approach is to save critical variables into EEPROM or flash memory as soon as they change. This ap- proach is generally not a good idea, be- cause flash is typically limited to 100,000 write cycles, and EEPROM is typically limited to 1 million cycles. These num- bers may seem large, but a product can easily reach them during their lifetimes. Another approach is to use a battery to keep the microcontroller supplied so that it doesn’t lose its RAM contents. This De- sign Idea presents an alternative option: detecting a power-down and triggering an interrupt routine that saves all the pa- rameters in EEPROM or flash before the microcontroller supply falls below the operating threshold. Figure 1 imple- ments such an approach for a PIC- 18F6720 microcontroller. One of the many features of this mi- crocontroller is its low-voltage detection, which can trigger an interrupt when its LVD input goes below a threshold. You can set the threshold at 2.06V to 4.64V. The PIC18 microcomputer ceases func- tioning when its voltage supply is less than 4.2V. Because the EEPROM/flash- saving cycle is fairly time-consuming, the tactic is to monitor the voltage at the in- put of the 5V regulator to detect the pow- er drop even before the microcomputer’s supply starts to drop. Select the LVD trip point inside the PIC18F6720 to be 1.22V, and calculate the required value of R 2 /R 1 with the fol- lowing equation: where V IN_THRESHOLD is the trip point be- low which a “data-save”function triggers. You should select this trip point to be as high as possible but not too high to avoid triggering on the ripples and noise on V IN . Figure 2 shows the V IN and V CC wave- forms when a power-down occurs. The T represents the time allowed for sav- ing data, which starts when the circuit de- tects the drop of V IN and finishes when the voltage on the microcontroller goes below 4.2V, at which point it ceases to function. If the same 5V supply powers other devices , add a Schottky diode in se- ries to ensure sufficient energy storage for the microcontroller to save the data. List- ing 1 in the Web version of this article at www.edn.com contains the assembly code that saves the data when a power- down occurs and retrieves the saved data at power-up. PIC18F6720 V CC V SS LVDIN 0.1 F 0.1 F 0.1 F 10 F 10k 78L05 V IN R 1 R 2 Power up a microcontroller with pre-power-down data Stephan Roche, Santa Rosa, CA Use a power-down-detection scheme with a PIC18F6720 to save data before the microcontroller ceases to function. Power up a microcontroller with pre-power-down data ..........................91 Power MOSFET is core of regulated-dc electronic load ..................92 Use PSpice to model distributed-gap cores ....................................94 Precision divide-by-two analog attenuator needs no external components ..................96 Quartz crystal-based remote thermometer features direct Celsius readout ..................98 Publish your Design Idea in EDN. See the What’s Up section at www.edn.com. Edited by Brad Thompson The V CC and V IN waveforms at power-down indicate the relationships in the sequence of events. V IN_THRESHOLD PIC18 CEASES FUNCTIONING DATA SAVE INITIATED V IN 5V 4.2V V CC Figure 2 Figure 1 The best of design ideas 8 Check it out at: www.edn.com

Upload: anees172000

Post on 06-Apr-2015

1.417 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Electronic Load and Other Circuit Ideas

www.edn.com March 17, 2005 | edn 91

ideasdesign

It is sometimes necessary to retrievedata at power-up in the same way thatthey were at the last power-down, so

that the product wakes up in the state ithad before shutdown or to retrieve somemeasurement. One approach is to savecritical variables into EEPROM or flashmemory as soon as they change. This ap-proach is generally not a good idea, be-cause flash is typically limited to 100,000write cycles, and EEPROM is typicallylimited to 1 million cycles. These num-bers may seem large, but a product caneasily reach them during their lifetimes.

Another approach is to use a battery tokeep the microcontroller supplied so thatit doesn’t lose its RAM contents. This De-sign Idea presents an alternative option:detecting a power-down and triggeringan interrupt routine that saves all the pa-rameters in EEPROM or flash before themicrocontroller supply falls below theoperating threshold. Figure 1 imple-ments such an approach for a PIC-18F6720 microcontroller.

One of the many features of this mi-crocontroller is its low-voltage detection,which can trigger an interrupt when itsLVD input goes below a threshold. Youcan set the threshold at 2.06V to 4.64V.

The PIC18 microcomputer ceases func-tioning when its voltage supply is lessthan 4.2V. Because the EEPROM/flash-saving cycle is fairly time-consuming, thetactic is to monitor the voltage at the in-put of the 5V regulator to detect the pow-er drop even before the microcomputer’ssupply starts to drop.

Select the LVD trip point inside thePIC18F6720 to be 1.22V, and calculatethe required value of R

2/R

1with the fol-

lowing equation:

where VIN_THRESHOLD

is the trip point be-low which a “data-save”function triggers.You should select this trip point to be ashigh as possible but not too high to avoid

triggering on the ripples and noise onV

IN�.

Figure 2 shows the VIN

and VCC

wave-forms when a power-down occurs. The�T represents the time allowed for sav-ing data, which starts when the circuit de-tects the drop of V

INand finishes when

the voltage on the microcontroller goesbelow 4.2V, at which point it ceases tofunction. If the same 5V supply powersother devices , add a Schottky diode in se-ries to ensure sufficient energy storage forthe microcontroller to save the data. List-ing 1 in the Web version of this article atwww.edn.com contains the assemblycode that saves the data when a power-down occurs and retrieves the saved dataat power-up.�

PIC18F6720

VCC

VSS

LVDIN

0.1 �F0.1 �F0.1 �F 10 �F

10k

78L05VIN

R1

R2

Power up a microcontroller with pre-power-down dataStephan Roche, Santa Rosa, CA

Use a power-down-detection scheme with a PIC18F6720 to save databefore the microcontroller ceases to function.

Power up a microcontroller with pre-power-down data ..........................91

Power MOSFET is core of regulated-dc electronic load ..................92

Use PSpice to model distributed-gap cores ....................................94

Precision divide-by-two analog attenuatorneeds no external components ..................96

Quartz crystal-based remote thermometerfeatures direct Celsius readout ..................98

Publish your Design Idea in EDN. See theWhat’s Up section at www.edn.com.

Edited by Brad Thompson

The VCC and VIN waveforms at power-down indicate the relationships in the sequence of events.

VIN_THRESHOLD

PIC18 CEASES FUNCTIONING

DATA SAVE INITIATED

VIN

5V4.2V

VCC

F igure 2

F igure 1

The best ofdesign ideas� Check it out at:

www.edn.com

Page 2: Electronic Load and Other Circuit Ideas

92 edn | March 17, 2005 www.edn.com

ideasdesign

Designers use electronic dc loadsfor testing power supplies andsources, such as solar arrays or bat-

teries, but commercial ones are often ex-pensive. By using a power MOSFET in itslinear region, you can build your own(Figure 1). It uses two simple feedbackloops to allow the transistors to work as

a current drain in current-regulationmode or as a voltage source in voltage-regulation mode. Designers use current-regulation mode when they are charac-terizing voltage sources, in which thepower source must deliver current valuethat is set in the electronic load. They usevoltage-regulation mode with current

sources because it forces the sources tooperate at a voltage that the load sets.

In current mode, RSHUNT

senses ILOAD

,and the resultant voltage feeds back tothe inverting input of op amp IC

1A. Be-

cause the dc gain of this amplifier is highin the linear-feedback operating range,the inverting input stays equal to the

+

5

6

R61k

VCC

IC1B

CA3240/DIP8

C3100 nF

C4100 nF

R71k

R847k

VREF4

78

+

3

2

R41k

RSHUNT0.3350W

R1470

VCC

Q1

IC1A

CA3240/DIP8

C51 �F

R51k

R947k

VREF

4

18

2N2222A1

32

CURRENT/VOLTAGEREGULATION

VOUT

VCC

IOUT

K1

5

4

3

12 2

1D1

1N4007

R310k

RA270k

RB10k

F110A

Q3IRF150

R210k

Q2IRF150

LOAD�

LOAD+

FEED 1VFEED

F igure 1

Power MOSFET is core of regulated-dc electronic loadAusias Garrigós and José M Blanes, University Miguel Hernández,Electronic Technology Division, Elche, Spain

Using MOSFETs and a relay, this electronic load can operate in both current- and voltage-regulation modes.

Page 3: Electronic Load and Other Circuit Ideas

94 edn | March 17, 2005 www.edn.com

ideasdesign

noninverting input, which correspondsto V

IREF. The amplifier establishes its out-

put value to operate MOSFETs Q2

andQ

3in a linear region and, therefore, dis-

sipate the power from the source. Thevalue of the source current is propor-tional to the current-loop reference,V

IREF, and is I

LOAD�V

IREF/R

SHUNT. Set V

IREF

using a resistive voltage divider connect-ed to a stable reference, or use the outputof a D/A converter from a PC-based I/Ocard for flexible configuration.

Voltage-operating mode is simi-lar, but now the sensed variable isthe output voltage, which voltage dividerR

A/R

Battenuates, so that the electronic

load can operate at higher voltages thanthe op-amp supply voltage. The sensedvoltage feeds back to the noninvertinginput of IC

1B, and the MOSFETs again

operate in the linear region. Load volt-age V

LOAD�V

VREF�(R

A�R

B)/R

B.

The dual-op-amp CA3240, IC1, can

operate with an input voltage below itsnegative supply rail, which is useful forsingle-supply operation, but you can useany op amp if you have a symmetricalsupply. Relay K

1switches operating

mode through a digital control line driv-ing Q

1. The MOSFET is critical; you can

add the IRF150 devices this design usesin parallel to increase the current-hand-ing capabilities due to their positive-temperature coefficient, which equalizesthe current flowing in the parallel MOS-FETs. With the two MOSFETs in the cir-cuit, the load handles 10A, and powerconsumption is greater than 100W, sousing a heat sink and small fan is a goodidea.

This circuit is useful for characterizingphotovoltaic modules, which have twosource modes. With this circuit and aPC-based setup, the I-V characteristic of

a photovoltaic module from HeliosTechnology (www.heliostechnology.com) shows a region above V

MPP(voltage

in the maximum point), at which a sharptransition corresponds to a voltagesource (Figure 2). At voltages belowV

MPP, the photovoltaic modules look like

a current source. It is normally difficultto characterize this flat region of thecurve with a simple current-mode elec-tronic load, because the voltage output issensitive to small variations in current,and thus a constant-voltage mode loadis a better choice.�

The I-V characteristics of a photovoltaic module, using the electronic load, showthe special attributes of these power sources.

PSpice software letsyou create magnetic-core models that simu-

late nonlinear magnetic de-vices (Figure 1). These sim-ulations are useful for ob-serving hard-to-measuremagnetic parameters such ascore flux density, especiallywhen you cannot quicklyprocure a sample device. Therequired inputs to the PSpicemagnetic-core model are ini-tial permeability of the corematerial, data points fromthe B-H magnetizationcurve, and the physical prop-erties of the core, such asmagnetic-path length, cross-

sectional area, and air-gaplength.

All of the needed inputsfor the magnetic-coremodel are typically avail-able from core manufac-turers’ data sheets. Howev-er, in the case of a dis-tributed gap with powdercores such as MPP orKoolMu, you need to de-termine the equivalent airgap to model the core us-ing PSpice, because it relieson the air-gap length as in-put data to the model. Us-ing the conservation of fluxand manipulating Am-pere’s Law for a magnetic

Use PSpice to model distributed-gap coresJeff Fries, GE Transportation Systems Global Signaling, Grain Valley, MO

You use a screen capture from PSpice Model Editor tocreate a magnetic-core model.F igure 1

I REGULATION MODEV REGULATION MODE

0 5 10 15 20 25

VSA (V)

3

2.5

2

1.5

1

0.5

0

ISA (A)

VREGULATION

IREGULATION

F igure 2

Page 4: Electronic Load and Other Circuit Ideas

96 edn | March 17, 2005 www.edn.com

ideasdesign

circuit with an air gap result in:1/U

E�(1/U

I)�(L

G/L

E), where U

Eis the

effective permeability of the core, UI

isthe initial permeability of the core ma-terial, L

Gis the length of the gap in cen-

timeters, and LE

is the magnetic-pathlength of the core in centimeters. As-suming that the initial permeability, U

I,

of the core is high, which is typical of dis-tributed-gap cores, then the term 1/U

I

drops out, and you can rearrangethe equation to solve for the gaplength as L

G�L

E/U

E. Using the magnetic-

path length, LE, and effective permeabil-

ity, UE, that the core manufacturer’s data

sheet specifies, calculate the equivalentair-gap length of the distributed gap-corefor use in the PSpice model.

As an example, take the KoolMu77310-A7 toroidal powder core fromMagnetics Inc (www.mag-inc.com). Be-cause the data sheet does not specify theinitial permeability of the KoolMu core,arbitrarily use 5000. (This parameter isinsignificant in the model due to the airgap.) Use the magnetization curve for theKoolMu material and mark the datapoints in Table 1.

Physical data for the 77310-A7 core

shows a magnetic path length of 5.67 cm,cross-sectional area of 0.331 cm2, and ef-fective permeability of 125. From thisdata, you calculate the effective air-gaplength of 0.045 cm. Enter this data intoPSpice for the core model.

A quick and easy way to verify the ac-curacy of the model is to create an in-ductor in PSpice using your magnetic-core model. Place the inductor in a series-tuned RLC circuit (Figure 2). UsingPSpice, run an ac sweep of the circuit,and use a probe to find the resonant fre-quency, f

RES. Using the resonant frequen-

cy, you can calculate the measured inductance of the PSpice model as

LMEAS

�1/(4��2�fRES

2�C). If yourmagnetic-core model is correct, thisshould be close to the expected induc-tance calculated as L

EXP�(N2)�A

L, where

N is the number of turns, and the coredata sheet typically supplies the induc-tance factor, A

L.�

_+ V1

AC=1

R10

C0.1 �F

LN=28

K1K77310A7

COUPLING=1

V V

You can use this RLC-resonant circuit to measure the modeled inductance in PSpice,using an ac sweep analysis.

TABLE 1—DATA POINTSFOR KOOLMU COREB H

(Gauss) (Oersteds)275 11500 106000 608000 1009900 300

10,600 700

Many modern A/D con-verters offer only a 5V in-put range, and using

these converters with a �5V orlarger input signal gives the de-signer a problem: how to dis-card half of a good analog signalwithout introducing errors anddistortion. To solve the prob-lem, you can use an attenuatorcomprising two operationalamplifiers and two resistors (Fig-ure 1). However, this approachcan reduce a system’s performance by in-troducing gain errors due to amplifier off-set and drift and resistor mismatch.

IC1R1

R2VIN

_

+IC2 VOUT

_

+

Precision divide-by-two analog attenuatorneeds no external componentsMoshe Gerstanhaber and Chau Tran, Analog Devices, Wilmington, MA

A conventional activevoltage divider requires

two op amps, IC1 and IC2, and tworesistors, R1 and R2, that form a 2-to-1 voltage divider.

_

+

_

+

_

+

1

7

65 8

4

AD8221

10k

10k

10k

10k

V0

VR

�VS +VS

VIN

F igure 2

You can use an instrumentation amplifier to halve an ana-log signal’s amplitude. All resistors are internal to the IC.

F igure 1

F igure 2

Page 5: Electronic Load and Other Circuit Ideas

98 edn | March 17, 2005 www.edn.com

ideasdesign

VIN (V)

GAIN ERROR (�V)

300

200

100

0

�100

�200

�300�13 �12 �11 �10 �9 �8 �7 �6 �5 �4 �3 �2 �1 0 1 2 3 4 5 6 7 8 9 10 11 12 13

F igure 3

The circuit in Figure 2 introduces a full-scale gain error of less than 300 ��V over a 26V input-voltage range.

Figure 2 shows an alternative circuitthat provides a precision gain of one-halfwith low offset, low drift, and low input-bias currents and that uses an AD8221instrumentation amplifier.

The amplifier’s output, VO, equals the

difference between the two inputs, VIN�

and VIN�

: VO�(V

IN�)�(V

IN�). Connect-

ing the amplifier’s output to its invert-ing input and substituting V

Ofor V

IN�

yields: VO�(V

IN�)�(V

O), or V

O�(V

IN�).

Thus, the circuit provides a precisiongain of one-half with no external com-ponents and, in this configuration, is un-conditionally stable. The performanceplots of figures 3 and 4, respec-tively, show a gain error of lessthan 300 �V and a maximumnonlinearity error of about 1ppm over a 26V input-voltagerange.

To introduce an offset voltage,V

OS, that equals half of a refer-

ence voltage (VOS

�VR/2), con-

nect the AD8221’s reference in-put (Pin 6) to voltage V

R. To bias

the attenuator’s output at half ofthe positive- or negative-power-supply voltage, connect the ref-erence pin to the appropriatepower supply.�

Although quartz crystals haveserved as temperature sensors, de-signers haven’t taken advantage of

the technology because few manufactur-ers offer the sensors as standard products(references 1 and 2). In contrast to con-ventional resistance- or semiconductor-based sensors, a quartz-based sensor pro-vides inherently digital-signal condi-tioning, good stability, and a direct digi-tal output that’s immune to noise andthus ideally suited to remote-sensorplacement (Figure 1, pg 100).

An economical and commercially

available quartz temperature sensor, Y1

and IC1, an LTC-485 RS485 transceiver in

transmitter mode, form a Pierce crystaloscillator. The sensor, an Epson HTS-206,presents a nominal frequency of 40 kHzat 25C and a temperature coefficient of�29.6/ppm/C (Reference 3). The trans-ceiver’s differential-line-driver outputsdeliver a frequency-coded temperaturesignal over a twisted-pair cable at dis-tances as far as 1000 ft.

A second LTC-485, IC2, in receiving

mode, accepts the differential data andpresents a single-ended output to IC

3, a

PIC-16F73 processor that converts thefrequency-coded temperature data andpresents the temperature in Celsius for-mat on LCD

1. You can view and down-

load the conversion program’s sourcecode in the Web version of this DesignIdea at www.edn.com.�

References1. Benjamin, Albert, “The Linear

Quartz Thermometer—A New Tool forMeasuring Absolute and DifferentialTemperature,” Hewlett-Packard Journal,March 1965.

Quartz crystal-based remote thermometer features direct Celsius readoutJim Williams and Mark Thoren, Linear Technology Corp

VIN (V)

NONLINEARITY ERROR(PPM)

�13 �12 �11 �10 �9 �8 �7 �6 �5 �4 �3 �2 �1 0 1 2 3 4 5 6 7 8 9 10 11 12 13

�2

�1

0

1

2

The circuit in Figure 2 introduces a maximum nonlinearity error of about 1 ppm over a 26V input-voltage range.

F igure 4

Page 6: Electronic Load and Other Circuit Ideas

100 edn | March 17, 2005 www.edn.com

ideasdesign

2. Williams, Jim, “Practical Circuitryfor Measurement and Control Prob-

lems,”Application Note 61, August 1994,Linear Technology Corp.

3. HTS-206 specifications, EpsonCorp, www.eea.epson.com.

1719

16151413

28

1211

27

252423

26

222176

432

5

188

VCC

RC7RC6RC5RC4RC3RC2RC1RC0RB7RB6RB5RB4RB3RB2RB1RB0RA5RA4RA3RA2RA1RA0

5V

5V

IC2LTC485

6

7

5V

8

1

2

35

5V

CONTRAST

GND

D7D6D5D4ENRWRS

OSC2

OSC1

VDQ

110

9

28

D1BAV74LT1

R5100

1000 FEETTWISTED-PAIR

CABLE

4

6

7

23

8

5V

5 R3100k

R110M

R210M

R33.3M

C415 pF

C310 pF

C210 pF

Y1

IC1LTC485

C1100 pF

CONTRASTADJUST

R710k

R61k

IC3PIC16F73

10 MHzY2

C50.1 �F

R810k

LCD1

NOTES: Y1 = EPSON PART NO. HTS-206, 40 kHz/25�C,�29.6 PPM/�C.LCD1=2�16-CHARACTER LCD (OPTREX DMC-162498 OR SIMILAR).

MCLR

A quartz-crystal temperature sensor provides Celsius-temperature readouts accurate to 2% over a ��40 to ��85C range.F igure 1