You are on page 1of 4

Software for Radio Shack 22-812 Digital Multimeter

Don Peterson (someonesdad1@gmail.com) Version: 20 Aug 2009 Minor changes: 8 Mar 2010 his !ac"age contains the #ollo$ing #iles:
readme.pdf rs22812.py rs22812_linux.py meter.py

his #ile P%thon scri!t that can tal" to the meter o&er the serial !ort and !rint readings to the console. A modi#ied scri!t that can 'e used on (inu). *ncludes more so!histicated o!tion !arsing. +,* scri!t using $)P%thon that sho$s the current reading on the screen and logs readings to a #ile.

Needed hardware
-ou $ill need a .adio /hac" 220812 digital multimeter (currentl% selling #or around 120). *t has a 9 !in #emale D connector that allo$s %ou to connect a serial ca'le to the meter. he t$o !%thon scri!ts can then 'e used to gather readings #rom the meter. -ou3ll also need a serial ca'le $ith a 9 !in male connector on one end. he other end $ill need to #it %our com!uter3s serial !ort. 4om!uters t%!icall% don3t come $ith serial !orts an%more 'ut %ou can 'u% ,/5 to serial ada!ters #or around 116 each.

Needed software
-ou3ll need !%thon7 an o!en source general !ur!ose !rogramming language. -ou can get it #rom htt!:88$$$.!%thon.org. he current &ersion at this $riting $as 2.9.27 $hich is $hat * tested $ith. -ou3ll also need P%/erial #rom htt!:88!%serial.source#orge.net. sim!le to tal" to a serial !ort. his is a !%thon module that ma"es it

*# %ou $ant to use the +,* inter#ace in meter.py7 %ou3ll need to install $)P%thon7 an o!en source !ro:ect that $ra!s the 4;; $)<idgets li'rar% in !%thon clothing. -ou can get $)P%thon #rom htt!:88$$$.$)!%thon.org. * de&elo!ed the !rogram $ith $)P%thon 2.8.10.1. /ince the meter.py scri!t uses onl% sim!le $idgets7 the scri!t $ill li"el% $or" $ith nearl% an% &ersion o# $)P%thon.

rs22812.py
his scri!t contains a !%thon o':ect that enca!sulates the e##ort needed to tal" to the meter. *t can 'e used in one o# t$o $a%s. =irst7 %ou can use it in %our o$n code. <hen %ou instantiate the ./22812 o':ect7 %ou !ass in the 4>M !ort (either a num'er (on M/ <indo$s) or a de&ice name). hen %ou call the GetReading() method and %ou3ll get a tu!le o# strings returned. he strings are: 1. .eading 2. Mode 20 Aug 2009 Page 1 o# ?

@. Modi#iers he .eading string $ill 'e a num'er #ollo$ed '% a unit. *# the ~ character is a!!ended to the unit7 it means it $as an A4 measurement. he Mode string $ill indicate the mode o# the instrument. /ee the comments in the code #or $hat these are. he in#ormation is largel% redundant $ith $hat3s alread% gi&en in the .eading string. he Modi#ier tu!le contains strings that tell more a'out the meter3s state. /ome that %ou3ll see are:
AUTO R !

he meter is in auto ranging mode. *# not !resent7 the range is #i)ed. .eadings are relati&e. <hen the .A( 'utton is !ressed7 the reading is stored and su'tracted #rom su'seBuent readings. Press the .A( 'utton again to turn this mode o##. /ho$n $hen the MAC8M*D 'utton is !ressed. reading seen. he last reading is #roEen. his dis!la%s the ma)imum

"A# "$% &O!'

Press the MAC8M*D 'utton t$ice to see the minimum reading.

he second $a% to use the scri!t is as a console data logger. .un the scri!t as
pyt()n rs22812.py and it $ill !rint out readings to stdout. =or e)am!le7 here $ere some sam!les

#rom a 2 &olt !ea"0to0!ea" sBuare $a&e:


1*Aug2++*,11-28-1* 1*Aug2++*,11-28-2+ 1*Aug2++*,11-28-22 1*Aug2++*,11-28-26 1*Aug2++*,11-28-27 1*Aug2++*,11-28-25 1*Aug2++*,11-28-2* 1*Aug2++*,11-28-41 1*Aug2++*,11-28-42 1*Aug2++*,11-28-46 1*Aug2++*,11-28-47 1*Aug2++*,11-28-48 1*Aug2++*,11-28-4* 1*Aug2++*,11-28-61 1*Aug2++*,11-28-64 .1/ (0,1.++8 102 0'3 102 ()) .2/ (0+.**8 102 0'3 102 ()) .4/ (01.++5 102 0'3 102 ()) .6/ (01.++5 102 0'3 102 ()) .8/ (0,1.++8 102 0'3 102 ()) .7/ (0,1.++5 102 0'3 102 ()) .5/ (0,1.++5 102 0'3 102 ()) .8/ (01.++5 102 0'3 102 ()) .*/ (01.++5 102 0'3 102 ()) .1+/ (01.++5 102 0'3 102 ()) .11/ (0,1.++5 102 0'3 102 ()) .12/ (0,1.++5 102 0'3 102 ()) .14/ (0,1.++5 102 0'3 102 ()) .16/ (01.++5 102 0'3 102 ()) .18/ (01.++5 102 0'3 102 ())

he readings are time0stam!ed7 num'ered7 and %ou can see the tu!le o# in#ormation that GetReading() returns. *n this case7 the AUTO modi#ier $as o## 'ecause %ou $ould other$ise occasionall% see 0= on the screen (re!resents o&er#lo$ $hile the meter is autoranging). -ou can see that the meter is not Buite a'le to "ee! u! $ith a 1 second sam!ling inter&al.

meter.py
his is a con&enience +,* utilit% that lets %ou start and sto! the readings and set the sam!ling rate. he readings made are automaticall% a!!ended to a log #ile $ith a time stam!. Fere3s a screen shot o# the !rogram running:

20 Aug 2009

Page 2 o# ?

he time o# the last reading is sho$n at the to!G ne)t is the reading and an% modi#ier. he 9t)p 'utton sho$s /tart $hen readings aren3t 'eing made and sho$s /to! $hen readings are 'eing made (it3s a toggle 'utton). he Tips 'utton can 'e used to turn ti!s on. <hen %ou hold the mouse o&er an o':ect7 a $indo$ $ill !o! u! a#ter a dela% e)!laining $hat the o':ect is. he 9ample rate 'o) is used to set the sam!ling rate. -ou onl% need to !ress the 9et 'utton i# %ou $ant to change the sam!ling rate a#ter the 9tart 'utton has 'een !ressed. -ou3ll $ant to ma"e sure %ou change the meter.!% scri!t to include the !ro!er serial !ort designator #or %our s%stem 00 it is unli"el% %ou3ll use the same de#ault as * did. he data read #rom the meter are logged in a #ile. Fere3s a sam!le o# the data:
:r)gram started 1*Aug2++*,11-6+-2+ 9tart ;utt)n pressed 1*Aug2++*,11-6+-27 %e< sampling inter=al 1 s 1*Aug2++*,11-6+-27 1*Aug2++*,11-6+-25 .1/ (0,+.*** 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-2* .2/ (0,+.*** 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-4+ .4/ (0,1.+++ 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-42 .6/ (01.++8 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-44 .8/ (01.++8 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-48 .7/ (01.++8 102 0'3 102 (0Aut)02)) 9t)p ;utt)n pressed 1*Aug2++*,11-6+-48 %e< sampling inter=al 2 s 1*Aug2++*,11-6+-4* 9tart ;utt)n pressed 1*Aug2++*,11-6+-64 1*Aug2++*,11-6+-64 .1/ (01.++8 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-67 .2/ (0,1.++4 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-6* .4/ (0,+.*** 102 0'3 102 (0Aut)02)) 1*Aug2++*,11-6+-82 .6/ (01.++8 102 0'3 102 (0Aut)02)) 9t)p ;utt)n pressed 1*Aug2++*,11-6+-84 :r)gram ended 1*Aug2++*,11-6+-8*

he readings are timestam!ed as $ell as num'ered #rom $hen the 9tart 'utton $as !ressed. -ou can3t see it #rom this e)am!le7 'ut there3s a 'lan" line inserted 'e#ore H:r)gram started...H #or each in&ocation o# the !rogram. his7 along $ith the indentation7 ma"es it easier to #ind rele&ant data. he settings &aria'le at the 'eginning o# the #ile lets %ou change &arious settings in the !rogram. *# %ou start the !rogram $ithout the digital multimeter turned on7 the !rogram $ill 'loc" inde#initel% 'ecause there is no timeout set #or the serial !ort. he 9t)p 'utton $on3t $or" and %ou3ll :ust ha&e 20 Aug 2009 Page @ o# ?

to "ill the !rogram unless %ou $ant to turn on the meter.

20 Aug 2009

Page ? o# ?

You might also like