You are on page 1of 5



(OHFWULFDO(QJLQHHULQJ6WDFN([FKDQJH
LVDTXHVWLRQDQGDQVZHUVLWHIRU
HOHFWURQLFVDQGHOHFWULFDOHQJLQHHULQJ
SURIHVVLRQDOVVWXGHQWVDQG
HQWKXVLDVWV,W
VIUHH
6LJQXS

VLJQXS

ORJLQ

$Q\ERG\FDQ
DQVZHU

7KHEHVWDQVZHUVDUHYRWHG
XSDQGULVHWRWKHWRS

calculatebatteryvoltageusingpicADC
IneedtocalculatebatteryvoltageusingmyPIC'sADC.Mybatteryvoltageis24VandADChasa12bitresolution,thePIC
operatingvoltageis3.3V.
IamusingthePIC'sinternalVref+andVrefasreferencevoltages,ferritebead(model1206)Idon'tknowthecorrectvalue.
Whyistheferritebeadused?
HowcanIcalculatethebatteryvoltageusingthiscircuitpleasehelpmewiththecalculationclearly?

SLF

KHOS

+HUH
VKRZLWZRUNV

$Q\ERG\FDQDVN
DTXHVWLRQ

WRXU

 DGF  IHUULWH
HGLWHG-XO
DW

DVNHG-XO
DW

0U3KRRN\


$QVZHUV

Iwillwritethisansweralittlemoreelaborately,asyoudonotseemtohavevery
muchknowledgeaboutelectronics.
Firstofall,yourcircuitdoesnotlooklikeavoltagemeasuringcircuit,butmorelike
asupplyingcircuit.(MaybeforyourPICmicrocontroller?)
ThezenerdiodeZ2limitsthevoltageontherightsidetoamaximumof3.3V.(It
doessobyjustbecomingconductiveatthatvoltage.)
Duetothis,thereisavoltagedropof24V3.3V=20.7VoverR2,leadingtoatotal
currentof20.7mA.Fromthis,1.5mAwillflowthroughR13,therestof19.2mAwill
flowthroughZ2.
Ifyouconnectsomethingconsuminglet'ssay15mAat3.3Vtotherightside,Z2
willonlyconsume4.2mA.ThetotalcurrentthroughR2willstillbe
1.5mA+15mA+4.2mA=20.7mA,sothevoltagedropisstill20.7Vandthe
remainingvoltageontherightstillis3.3V.
However,ifyouconnectsomethingconsumingmorethat19.2mA,theoverall
currentthroughR2exceeds20.7mAandsodoesthevoltagedrop.TheVoltageon
therightbreaksdown,below3.3V.
So,thiscircuitallowstosupplya3.3Vdeviceconsumingnotmorethan19.2mAon
therightside.Butbeawarethattherewillalwaysbeacurrentof20.7mA,evenif
nodeviceisconnected.Thiswillslowlydrainthebattery.Also,duetothehigh
voltagedrop,over86%ofthebattery'spoweriswastedasheat!That'snotvery
efficient.
C1andC9(andtheirvalues)arequitetypicalblockingcapacitorsusede.g.near
microcontrollers.Thepowerconsumptionofamicrocontrollercanchangevery
quickly,whilethewiresalsohaveaninductance.Thismeansthecircuitcannot
fulfillthefastchangingpowerdemands,leadingtoanunstablesupplyvoltagefor
themicrocontroller.Asresult,themicrocontrollermaynotworkfine.That
capacitorsactasbufferandcanprovidesomecurrentuntiltherestofthecircuit
providesthefullcurrent.(Ifyouwant,it'slikeapantry)

3UDGHHSNXPDUN


Commingtotheferrite:
Afirstremark:1206isjustthephysicalsize,notthemodel,noranyelectrical
parameter
Ferritesblockhighfrequenciesandallowlowfrequencies(andDC)topass.Thisalso
meanstheycanfiltersuddenspikesofcurrentbysmoothingthemalittle.Let'ssay
youhavethatmicrocontrollerwithitsfastchangingcurrentconsumptionandsome
othercircuitverysensitivetoasmoothsupplyvoltage.Thecurrentconsumptionof
themicrocontrollerwouldcausevoltagedrops,whichwouldbenoticedbytheother
circuit.Thatferritewouldreducethiseffectbysmoothingthecurrentflowingtothe
microcontroller.However,thatwouldcausebiggervoltagedropsonthe
microcontrollerside,buttherefore,youhavethecapacitors.
Finally,youaskedhowtomeasureabatteryvoltagebyADC.Ingeneral,anADC
acceptsacertaininputvoltagerange.ForthePIC,itisdefinedbyVREF and
VREF .Inmostcases,VREF is0VandVREF canbechosenbetweenthe
supplyvoltage(3.3Vinyourcase)oraninternalreference(seedatasheet,Iguess
1.25V).Butit'salsooftenpossibletofeedyourown,externalreferencevoltageto
theADC.
Forprecisemeasurement,usetheinternalreference,asitisindependentfromthe
supplyvoltageandverystable.
TheADCconvertsavoltagewithinthatrangetoanumber,i.e.n = 0 for
12
VADC _in = VREF andn = 2
1 = 4095 (12bitADC)forVADC _in =
So,theconversionis

VREF + .

n
VADC _in = (VREF + VREF )

12

+ VREF
1

Now,yourbatteryvoltageexceedstherangeoftheADC,soyouwanttodivideit
downuntilit'sinrange.Doitsothattheexpectedvoltagetobemeasuredwillbea
littlebelowtheupperADClimit.Forexample,tomeasureyour24Vusingthe
internal1.25Vreference,usea19kOhmanda1kOhmresistortodividethe24V
downto1/20,whichis1.2V.Ofcourse,youwillhavetomultiplyVADC _in by20to
gettheactualvoltage.
HGLWHG-XO
DW

DQVZHUHG-XO
DW

VZHEHU


 thankyousweber.Nowiamclearaboutadccalculation. 3UDGHHSNXPDUN -XO


DW



Ferritebeadisusedherejustasanoisefilter.R2andR13isavoltagedividercircuit
andzenerisusedtopreventtheMCUpinfromgettingdamaged.
AspermeatADCPinofMCUthereshouldnotbeavoltagegreaterthanvref,
Lookingattheschematicitlooklikesitis3.3V,sincetheusedzenerdiodehasa
breakdownvoltageof3.3V.
Nowcomingtoyourschematicandassumingthatthemaximumsensevoltageat
MCU'sADCpinis3.3V.Asmentionedyourbatteryvoltageis24V,R2is1KandR13
is2.2KsothevoltageatBAT.VOLTwhichwillconnecttotheADCpinofMCUcanbe
calculatedasbelow
BAT.VOLT=(R13/(R13+R2))*Vbat=16.5V,whichmaydamageyourMCUpin.Since
themaximumvoltagethatADCpincansenseis3.3V(Assumed)soherethevalue
ofresisterhastobesetinsuchawaythatfor24volt,thevoltageatMCUpin
shouldhave3.2V.
SincetheADChasaresolutionof12bit,Sofor3.3Vyouhaveastepofaround
0.4mV.
AndoneresistershouldbeusedbeforeBacktoBackdiodeasshowninthefigure
belowandtheresistorvalueofvoltagedevidercanbereplacedwiththevalueas
showninthefigure

HGLWHG-XO
DW

DQVZHUHG-XO
DW

6DQMHHY.XPDU


Thecircuityoushowappearstobeapowersupply.Youcannotmeasurethe



actualbatteryvoltagefromit.ThedesignatorBATT.VOLTjustmeansthatitis
derivedfromthebattery.
Ifyouwanttomeasurebatteryvoltageyouneedavoltagedividerfromthe+24V
tothePICADCinput.Youdon'tmentionthepartnumber,butIthinkmostPICs
requirethesourceimpedancetobelessthan10Kor2.5K,solet'suse2.5K.
SoyouneedtworesistorsR1andR2suchthatR2/(R1+R2)=Vref/Vbat(max)
whereVbat(max)isthemaximumbatteryvoltageyouwanttomeasure,and
R1*R2/(R1+R2)<2.5K.
Solet'ssayyouareusingtheFVRmodule(availableonsomePICs)fora2.048V
referenceandVbat(max)=30V.ThenyoucouldpickR2=2.00KandR1=27.4K.
Sofora24VVbatyou'dget3265counts,andfora30VVbatyouwouldget4081
counts.
YoucancalculateVbat=(ADC_counts/4096)*Vref*(27.4+2)/2
DQVZHUHG-XO
DW

6SHKUR3HIKDQ\
N





You might also like