digital attenuator design - sandia national laboratories · this document describes the design and...

55
UNLIMITED RELEASE SANDIA REPORT SAND2012-10095 Unlimited Release Printed November 2012 Digital Attenuator Design Perry J. Robertson Prepared by Sandia National Laboratories Albuquerque, New Mexico 87185 and Livermore, California 94550 Sandia National Laboratories is a multi-program laboratory managed and operated by Sandia Corporation, a wholly owned subsidiary of Lockheed Martin Corporation, for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-AC04-94AL85000. Approved for public release; further dissemination unlimited.

Upload: others

Post on 10-Oct-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

SANDIA REPORT SAND2012-10095 Unlimited Release Printed November 2012

Digital Attenuator Design Perry J. Robertson

Prepared by Sandia National Laboratories Albuquerque, New Mexico 87185 and Livermore, California 94550

Sandia National Laboratories is a multi-program laboratory managed and operated by Sandia Corporation, a wholly owned subsidiary of Lockheed Martin Corporation, for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-AC04-94AL85000.

Approved for public release; further dissemination unlimited.

Page 2: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

2

Issued by Sandia National Laboratories, operated for the United States Department of Energy by Sandia Corporation. NOTICE: This report was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government, nor any agency thereof, nor any of their employees, nor any of their contractors, subcontractors, or their employees, make any warranty, express or implied, or assume any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represent that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government, any agency thereof, or any of their contractors or subcontractors. The views and opinions expressed herein do not necessarily state or reflect those of the United States Government, any agency thereof, or any of their contractors. Printed in the United States of America. This report has been reproduced directly from the best available copy. Available to DOE and DOE contractors from U.S. Department of Energy Office of Scientific and Technical Information P.O. Box 62 Oak Ridge, TN 37831 Telephone: (865) 576-8401 Facsimile: (865) 576-5728 E-Mail: [email protected] Online ordering: http://www.osti.gov/bridge Available to the public from U.S. Department of Commerce National Technical Information Service

5285 Port Royal Rd. Springfield, VA 22161 Telephone: (800) 553-6847 Facsimile: (703) 605-6900 E-Mail: [email protected] Online order: http://www.ntis.gov/help/ordermethods.asp?loc=7-4-0#online

Page 3: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed
Page 4: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

4

Unlimited Release SAND2012-10095

November 2012

Digital Attenuator Design

Perry J. Robertson RF and Opto Microsystems

Sandia National Laboratories P.O. Box 5800

Albuquerque, New Mexico 87185-MS1082

Abstract

This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed with a 1 dB step resolution and 0.1 dB accuracy with a bandwidth from 1 to 10 MHz. The attenuator dynamic range provides attenuation of input signals from zero to 63 dB in 1 dB steps using a rotary control. A linear array of LEDs is used to display the attenuation value as a 6-bit binary value.

Page 5: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

5

Page 6: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

6

Page 7: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

7

CONTENTS

1.! Introduction ............................................................................................................................ 11!2.! Step Attenuator ....................................................................................................................... 13!

3.! Digital Attenuator Chip .......................................................................................................... 19!4.! Attenuator Design ................................................................................................................... 21!

5.! Attenuator Performance .......................................................................................................... 25!6.! Controller Board ..................................................................................................................... 27!

7.! Printed Circuit Board Design ................................................................................................. 29!8.! Software Operation ................................................................................................................. 31!

9.! Conclusions ............................................................................................................................ 33!Appendix A ................................................................................................................................... 35!

Appendix B .................................................................................................................................... 43!Appendix C .................................................................................................................................... 53!

Page 8: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

8

FIGURES

Figure 3. Step Attenuator 3D View. 16!Figure 4. Step Attenuator Design Drawing. 17!Figure 5. Digital Attenuator Chip Pinout (from Mini-Circuits DAT-31-PP+ Datasheet). 19!Figure 6. Digital Attenuator. 22!Figure 7. Digital Attenuator Side View. 22!Figure 8. Digital Attenuator Top Down View. 23!Figure 9. Digital Attenuator Controller Installed. 23!Figure 10. Attenuator Performance. 25!Figure 11. Arduino Nano Development Board Top and Bottom Views. 27!Figure 12. Arduino Nano 3.0 with part descriptions (from ardunio.cc). 28!

Page 9: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

9

NOMENCLATURE A Amperes DOE Department of Energy SNL Sandia National Laboratories mV milli-Volt, 1 V = 1000 mV mA milli-Amp, 1 A = 1000 mA V Volts

Page 10: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

10

Page 11: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

11

1. INTRODUCTION !"#$% &'&()% *+,-.(/0$% 0"(% *($#1/% +2% '% *#1#0'334% ,+/0)+33(*% $0(&% '00(/-'0+)% ,'&'53(% +2%+&()'0#/1% +6()% '% 2)(7-(/,4% )'/1(% 2)+.%8% 0+% 89%:;<=% % >/#0#'334?% '%@(5% $('),"%+2% '6'#3'53(%,+..(),#'3%+22()#/1$%0-)/(*%-&%'%/-.5()%+2%,'/*#*'0($?%"+@(6()%0"(4%'33%(#0"()%3',A(*%0"(%&)(,#$#+/%)(7-#)(*%2+)%0"(%0')1(0%'&&3#,'0#+/%+)%@()(%&)+"#5#0#6(34%(B&(/$#6(=%%C0%0"(%0#.(%+2%0"(%$('),"?%,+..(),#'3%$0(&%'00(/-'0+)$%@()(%)-//#/1%')+-/*%DE?999%(',"%'/*%0"()(%@()(%04&#,'334% $&(,#2#(*% 0+% +&()'0(% '0% +6()% 8% F;<=% % G#003(% #/2+).'0#+/% @'$% '6'#3'53(% +/% 0"(#)%+&()'0#+/% '0% 3+@()% 2)(7-(/,#($=% % C**#0#+/'334?% *-(% 0+% 0"(% /-.5()% +2% -/#0$% 0"'0%@+-3*% 5(%/((*(*%HIJKL%0"(%&-),"'$(%+2%$-,"%'%3')1(%/-.5()%@+-3*%5(%&)+"#5#0#6(34%(B&(/$#6(=%%C% 3+@% ,+$0% M"+554% 1)'*(N% 5#/')4% *#1#0'3% '00(/-'0+)% A#0% @'$% #/#0#'334% *#$,+6()(*=% % !"#$%'00(/-'0+)%@'$%5'$(*%+/%&#%'00(/-'0+)%$(1.(/0$%,+//(,0(*%54%OPO!%$@#0,"($=%%>0%'&&(')(*%0"'0% @'$% 6()4% '22+)*'53(% 1#6(/% 0"(% 3')1(% /-.5()% +2% -/#0$% )(7-#)(*=% % C% $'.&3(% -/#0% @'$%&-),"'$(*?%5-#30%'/*%0($0(*=%%!"#$%-/#0%'&&(')(*%0+%5(%$-#0'53(%'/*%'%*+<(/%-/#0$%@()(%5-#30=%C/%'3-.#/-.%,'$(%@'$%*($#1/(*%0+%"+-$(%0"(%'00(/-'0+)%'/*%2'5)#,'0(*=%%O-)#/1%2-33%$,'3(%0($0#/1?% 0"(%$@#0,"($%5(1'/%0+% 2'#3%'/*%'20()%,')(2-3%,+/$#*()'0#+/%.'/4%@()(% 2+-/*%0+%5(%2'-304=% %C%5(00()%$+3-0#+/%@'$%/((*(*%'/*%0"(%*(,#$#+/%@'$%.'*(%0+%*($#1/%'/*%5-#3*%+-)%+@/%*#1#0'3%$0(&%'00(/-'0+)$=%%C% *#1#0'3% '00(/-'0+)% ,"#&% 2)+.%:#/#QR#),-#0$% HOC!QS8QPPTL% @'$% #*(/0#2#(*% 0"'0% @+-3*% 5(%$-#0'53(%2+)%0"(%+6()'33%'00(/-'0+)=%%!"#$%,"#&%#$%$&(,#2#(*%0+%"'6(%'%-$'53(%2)(7-(/,4%)'/1(%2)+.%ORQJK99%:;<%@#0"%'/%#/&-0%'/*%+-0&-0%#.&(*'/,(%.'0,"(*%0+%E9%U".$=% %;+@(6()?%0"()(%@'$%3#003(%*'0'%2)+.%0"(%6(/*+)%+/%#0$%+&()'0#/1%,"')',0()#$0#,$%'0%2)(7-(/,#($%5(3+@%J%:;<=% % C% &)+0+04&(% -/#0% @'$% /((*(*% 2+)% 2-)0"()% (6'3-'0#+/% 2+)% #0$% $-#0'5#3#04% 0+% +-)%'&&3#,'0#+/=%%C%&)+0+04&(%+2% 0"(%*#1#0'3%'00(/-'0+)%@'$%5-#30%'/*% 0($0(*=% %!"(%-/#0$%@()(%5-#30%@#0"% 0"(%'5#3#04% 0+% &)+1)'.% 0"(% *#1#0'3% '00(/-'0+)% ,"#&% -$#/1% $@#0,"($% +)% '%.#,)+,+/0)+33()% 5+')*=%%!"(%$@#0,"($%,+-3*%5(%$(0%#/%'%5#/')4%.'//()%'/*%0"(/%'%3+'*%$@#0,"%,+-3*%5(%-$(*%0+%3+'*%0"(% /(@% '00(/-'0+)% 6'3-(=% % C/% C)*-#/+% V'/+% 5+')*% ,+-3*% '3$+% 5(% -$(*% 0+% 3+'*% 0"(%'00(/-'0+)% 6'3-(% #/0+% 0"(% ,"#&=% % ;+@(6()?% 0"()(%@'$% $+.(% )#$A% 0"'0% 0"(% $+20@')(% 2+)% 0"(%,+/0)+33()% @+-3*% &)+6(% *#22#,-30% 0+% 1(0% 0+% @+)A% )#1"0=% % >/% 0"(% (/*?% 0"(% $+20@')(% 2+)% 0"(%.#,)+,+/0)+33()%5+')*%@+)A(*%$+%@(33?%/+%-/#0$%-0#3#<#/1%%$@#0,"($%@()(%(6()%5-#30=%%U6()'33?%')+-/*%0@+%*+<(/%-/#0$%@()(%,+.&3(0(*=%%

Page 12: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

12

%

Page 13: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

13

2. STEP ATTENUATOR %W"(/% 0"(% /((*% 2+)% '00(/-'0+)$% @'$% 2#)$0% #*(/0#2#(*?% '% $('),"% +2% &+$$#53(% ,'/*#*'0($% @'$%-/*()0'A(/=% % >/#0#'334?% '% ,+-&3(% +2% 3'5+)'0+)4% 1)'*(% XY% $0(&% '00(/-'0+)$% @()(% #*(/0#2#(*%HC1#3#(/0% 5(#/1% +/(L=% % C% $(0% +2% )(7-#)(.(/0$% @'$% 1(/()'0(*% H$((% #/2+).'0#+/% 5(3+@L=%%;+@(6()?%0"(%,+$0%0+%+-02#0%'$%.'/4%'$%8Z%,"'//(3$%@#0"%'00(/-'0+)$%@'$%,+$0%&)+"#5#0#6(%2+)% '/% GOXO% ',0#6#04=% % [',"% '00(/-'0+)% ,+$0% '&&)+B#.'0(34% DE999=% % C% 3($$% (B&(/$#6(%'30()/'0#6(%@'$%$+-1"0=%%An attenuator was needed to match return signal levels between channels. The requirements on this design were as follows.

Bandwidth 100 kHz to 10 MHz Battery powered 9V Attenuation Factor >60 dB attenuation Power In > (1Vpp) dBm Controls Easy to use, must be able to adjust smoothly with single knob Insertion Loss <3 dB Single Bat. Op. > 9 hours continuous

%!"(% #/#0#'3% '00(.&0% '0% '% $#.&3(% $0(&% '00(/-'0+)% -0#3#<(*% '% ,+..(),#'3% +22% 0"(% $"(32% $0(&%'00(/-'0+)% $+3*% 0+% "+554#$0=% % !"#$% '00(/-'0+)% )(3#(*% -&+/%.-30#&3(% &#% '00(/-'0+)$8%@"#,"%-0#3#<(*%O+-53(% P+3(?% O+-53(% !")+@% HOPO!L% $@#0,"($% 0+% #/,)('$(% 0"(% '00(/-'0#+/% #/% -/#0%$0(&$=%%!"#$%'00(/-'0+)%"'*%'/%#/$()0#+/%3+$$%+2%')+-/*%8%*\%'/*%,+-3*%#/,)('$(%'00(/-'0#+/%#/%8%*\%$0(&$%0+%+6()%'%)'/1(%+2%]9%*\=%%!"(%-/#0%$0(&$%@()(%J9?%J9?%J9?%89?%E?%S?%J?%'/*%8%*\=%%!"($(% 5+')*$% @()(% &-0% #/0+% '% ,-$0+.% *($#1/(*% '3-.#/-.% "+-$#/1% @"#,"% "'*% 0@+% \VR%,+//(,0+)$% 2+)% $#1/'3% #/% '/*% +-0=% % !"(% 2)+/0% &'/(3% *($#1/% #$% $"+@/% #/% Y#1-)(% 8=% % !"(%,+/$0)-,0#+/%+2% 0"(%"+-$#/1% #$% $"+@/% #/%Y#1-)(%J=% %C%SO%6#(@% #$% $"+@/% #/%Y#1-)(%S=% % !"(%+6()'33%*($#1/%*)'@#/1%#$%$"+@/%#/%Y#1-)(%K=%%!"(%#/#0#'3%&()2+).'/,(%+2%0"($(%'00(/-'0+)$%@'$%(B,(33(/0%'/*%'%2-33%,+.&3(.(/0%@'$%5-#30=%%;+@(6()?%@#0"%2-)0"()%0($0#/1?% 0"(%$@#0,"($%@()(%2+-/*%0+%5(%2'-304% #/%$(6()'3%-/#0$=% %!"(%$@#0,"($%@()(%6()4%#/(B&(/$#6(%'/*%#0%@'$%*(0().#/(*%0"'0%'%5(00()%$+3-0#+/%@'$%/((*(*%#2%0"(%&)+^(,0%@()(%0+%&)+,((*%$-,,($$2-334=%

1 A pi attenuator is constructed from three resistors; a resistor to ground at the input, a resistor to ground at the output and a series resistor between the input and the output. A pi attenuator can be designed to attenuate the incoming signal at any level while maintaining a 50 ohm input impedance and a 50 ohm output impedance.

Page 14: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

14

���� �

Figure 1. Front Panel Manual Step Attenuator. �

Page 15: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

15

���

Figure 2. Step Attenuator Construction. �

Page 16: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

16

%Figure 3. Step Attenuator 3D View.

Page 17: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

17

Figure 4. Step Attenuator Design Drawing.

Page 18: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

18

Page 19: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

19

3. DIGITAL ATTENUATOR CHIP %!"(%(3(,0)+/#,%*#1#0'3%'00(/-'0+)%,"#&%,"+$(/%2+)%0"#$%&)+^(,0%#$%'%:#/#QR#),-#0$%OC!QS8QPPT=%%!"#$% ,"#&% .(0% .'/4% +2% 0"(% )(7-#)(.(/0$% 2+)% 0"(% +6()'33% $0(&% '00(/-'0+)% *($#1/=% % >0% "'*%(3(,0)+/#,%*#1#0'3%,+/0)+3%6#'%'%EQ5#0%&')'33(3%#/0()2',(%0"'0%@+-3*%&().#0%,+/0)+3%+2%0"(%,"#&%-$#/1%'%$.'33%.#,)+&)+,($$+)=%%P+@()(*%2)+.%'%$#/13(%TS_%&+@()%$-&&34%)(7-#)#/1%+/34%899%-C% +2% ,-))(/0% #/% 0"(% 7-#($,(/0% $0'0(% 0"#$% ,"#&% ,+-3*% +&()'0(% 2+)% "+-)$% 2)+.% '% $#/13(% `_%5'00()4=%%>0%"'*%0"(%',,-)',4%)(7-#)(*%+2%9=8%*\%'/*%0"(%'5#3#04%0+%$0(&%0")+-1"%S8%*\%+6()'33%'00(/-'0#+/%#/%8=9%*\%$0(&$=%%!"(%,"#&%@'$%&)+*-,(*%#/%'%$#3#,+/%R:Ua%&)+,($$%'/*%,+.($%#/%'%J9%&#/%&',A'1(=%%

%Figure 5. Digital Attenuator Chip Pinout (from Mini-Circuits DAT-31-PP+ Datasheet).

Page 20: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

20

Page 21: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

21

4. ATTENUATOR DESIGN %!"(%'00(/-'0+)%@'$%*($#1/(*%0+%2#0%#/0+%'%P+.+/'%C3-.#/-.%*#(%,'$0%5+B%.+*(3%SZ9J%@#0"%0"(% 2+-)% 3'4()% YXK% 5+')*% ',0#/1% '$% 0"(% 0+&% '$% $"+@/% #/% Y#1-)(% Z=% % !"(% `_% 5'00()4% @'$%.+-/0(*%+/%0"(%+-0$#*(%0+%.'A(%#0%('$4%0+%,"'/1(%0"(%5'00()4%@"(/%)(7-#)(*%H$((%Y#1-)(%bL=%%!@+%\VR%,+//(,0+)$%,'/%5(%$((/%#/%0"(%0+&%6#(@%HY#1-)(%]L%'/*%')(%0"(%#/&-0%'/*%+-0&-0%,+//(,0+)$=%%%%!"(%*#1#0'3%'00(/-'0+)%,"#&$%')(%.+-/0(*%+/%0"(%5',A%+2%0"(%&)#/0(*%,#),-#0%5+')*%'$%$"+@/%#/% Y#1-)(% `=% % !@+% '00(/-'0+)% ,"#&$% ')(% -$(*% #/% $()#($% #/% +)*()% 0+% ',"#(6(% '/% +6()'33%'00(/-'0+)%2',0+)%+2%I%Z9%*\=%%!"(%C)*-#/+%,+/0)+33()%5+')*%,'/%'3$+%5(%$((/%+/%0"#$%$#*(%+2%0"(% 5+')*% '3+/1%@#0"% '% "+$0% +2% $-)2',(%.+-/0% ,+.&+/(/0$=% % !"(% ,+/0)+33()%.+/#0+)$% 0"(%&+$#0#+/%+2%0"(%)+0'0#+/'3%,+/0)+3%H.('$-)#/1%'%6+30'1(L%'/*%$(0$%0"(%'00(/-'0#+/%+/%0"(%0@+%,"#&$%',,+)*#/134=% %!"(%,+/0)+33()%'3$+%.+/#0+)$%@"(/%0"(%A/+5% #$%/+0%5(#/1%.'/#&-3'0(*%'/*%1+($%#/0+%'%$3((&%.+*(%0+%$'6(%&+@()=% %!"(%2#/'3%-/#0$%@()(%*(.+/$0)'0(*%0+%+&()'0(%2)+.%'% 2)($"%`_%5'00()4% 2+)% '0% 3('$0% '/% (/0#)(%`%"+-)%*'4=% % C% )(2()(/,(% 0+% 0"(%`_%5'00()4%3#2(0#.(%#$%1#6(/%#/%C&&(/*#B%R=%%!"()(%')(%0")((%,+/0)+3$%+/%0"(%'00(/-'0+)=%%!"(%$@#0,"%'0%0"(%-&&()%3(20%#$%0"(%+/Q+22%$@#0,"=%%!"(%$@#0,"%'0%0"(%-&&()%)#1"0%3'0,"($%*'0'%#/0+%0"(%&')'33(3% #/&-0$%+2%0"(%'00(/-'0+)%,"#&$=%%!"#$%$@#0,"%#$%-0#3#<(*%+/34%#2%0"(%5+')*%#$%5(#/1%-$(*%#/%.'/-'3%.+*(=%%V+).'334?%0"(%$@#0,"%#$% 3(20% #/% 0"(% [/'53(% &+$#0#+/=% % !"(% )+0'0#/1% A/+5% #/% 0"(% ,(/0()% % +2% 0"(% -/#0% ,+/0)+3$% 0"(%+6()'33%'00(/-'0#+/=%%G[O$%'0%0"(%5+00+.%+2%0"(%5+')*%#/*#,'0(%0"(%'00(/-'0#+/%$(00#/1%'$%'%5#/')4%/-.5()%@#0"%@(#1"0#/1$%+2%8?%J?%K?%]?%8Z?%S8%'$%$"+@/%#/%Y#1-)(%Z=% %!"(%"#1"%5#0% #$%/+0%SJ%'$%+/(%@+-3*%(B&(,0%5(,'-$(%#0%)(&)($(/0$%+/(%+2%0"(%'00(/-'0+)%,"#&$%@#0"%'33%#/&-0$%"#1"%H0"(%.'B#.-.%$(00#/1%2+)%'%$#/13(%'00(/-'0+)%,"#&%#$%S8%*\=%%%%%

Page 22: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

22

%Figure 6. Digital Attenuator. %%

%Figure 7. Digital Attenuator Side View. %%

Page 23: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

23

%Figure 8. Digital Attenuator Top Down View. %

%Figure 9. Digital Attenuator Controller Installed.

Page 24: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

24

%% %

Page 25: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

25

5. ATTENUATOR PERFORMANCE �� � � � � � +� #� � ++� % , � +&)� ' � )� &)$ � % � � � .� *� $ � � *,)� � � � &)� � � � � � &� � +� � � *� ++ % � *� &-� )� +� � � � , ##�)� % � � � &� � +� � � � ++� % , � +&)� ;@� :� EA� � � <4� � � � *� � � +� � .� *� '#&++� � � % � � � , )� � @? 4� � � .&� � � +� #�� ++� % , � +&)*� .� )� � $ � � *,)� � 2� � @� � % � � � A4� � � � � � � � +� � *� )� � &)� � � � % � )� #� + -� � � ++� % , � + &% � &� � +� � �&,+',+� &� � � � @� 1� * � % � #4� � � � � � � � +� � � )&$ � +� � � +.&� � ++� % , � +&)*� *� *� &.% � % � � #, � � � % � � )� � 4� � � � +� �� )&$ � +� � � ')� - &,*#0 � � &% *+), � +� � � *. +� � � � � � ++� % , � +&)*� *� *� &.% � % � � )� � % 4� � +� *� � #� � )� +� � +� +� � �% � .� � � +� #� � ++� % , � +&)*� � )� � � /+)� $ � #0 � # % � � )� ;� J? 4H H H H H � � % � � � J? 4H H ACD<4� � � � � 0 � � � -� � � % � % *� )+ &% � #&**� &� � F4D� � � 4�����

�Figure 10. Attenuator Performance.

� � � � � � � � � � �

� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� � � � � � � � � � � � � � � � � � � ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� � #!"� � � !��� � � � � � � � � � �

Page 26: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

26

Page 27: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

27

6. CONTROLLER BOARD %!"(% ,+/0)+33()% 5+')*% ,"+$(/% 2+)% 0"#$% &)+^(,0% #$% 0"(% C)*-#/+% V'/+% S=9% H,+/0'#/$% '% $#/13(%C!.(1'SJ]%.#,)+&)+,($$+)L=%%!"#$%5+')*%"'$%'/%(B0)(.(34%$.'33%2++0&)#/0%'/*%"'$%'33%0"(%$-&&+)0%,+.&+/(/0$% 0+%7-#,A34%'/*%(22#,#(/034%$0')0%'%*($#1/%-$#/1% #0%'$% 0"(%,+/0)+33()=% % >0%,'/%5(%&+@()(*%6#'% 0"(%:#/#Qea\%,+//(,0+)%+)% 2)+.%4+-)%.+0"()5+')*=% %!"#$%5+')*%'3$+%,+/0'#/$% '% 6+30'1(% )(1-3'0+)% $+% 0"'0% 0"(%&+@()% ,'/% 6')4% 2)+.%b_% 0+% +6()% 8J_=% % >0% "'$% 8K%*#1#0'3% >fU%&#/$% H+2%@"#,"%Z% ,'/%5(%&)+1)'..(*% 0+% &)+6#*(%PW:%+-0&-0L=% % !"(%5+')*% #$%9=bSN% B% 8=b9N=% % R+.&3(0(% $&(,#2#,'0#+/$% ,'/% 5(% 2+-/*% '0%"00&gff')*-#/+=,,f(/f:'#/fC-*-#/+\+')*V'/+=%%!"(%C)*-#/+%V'/+%\+')*%,+/0'#/$%'%ea\%H$()#'3L%&+)0%0"'0%#$%-$(*%0+%3+'*%0"(%5+')*%'/*%,'/%5(%-$(*%2+)%*(5-11#/1%'$%'%$()#'3%#/0()2',(%0+%0"(%5+')*=%%%

%%

Figure 11. Arduino Nano Development Board Top and Bottom Views. %

Page 28: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

28

% Figure 12. Arduino Nano 3.0 with part descriptions (from ardunio.cc). %

Page 29: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

29

7. PRINTED CIRCUIT BOARD DESIGN %!"(%$,"(.'0#,%+2%0"(%&)#/0(*%,#),-#0%5+')*%#$%1#6(/%#/%0"(%C&&(/*#B%C=%%%%P'1(%8%+2%0"(%$,"(.'0#,%$"+@$%0"(%`_%5'00()4%1+#/1%0+%'%0+113(%$@#0,"?%aP8?%@"#,"%'&&3#($%&+@()% 0+% 0"(% )($0% +2% 0"(% 5+')*=% % !"()(% #$% '% .-30#Q6#5)'0+)% ,#),-#0% ,+/$#$0#/1% +2% VPV%0)'/$#$0+)$%h8%'/*%hJ%0"'0%@'$%*($#1/(*%0+%53#/A%0"(%&+@()%G[O?%G[O9=% %!"#$%*($#1/%@'$%#/0(/*(*%2+)%$0'/*Q'3+/(%+&()'0#+/?%#=(=%/+0%"'6#/1%0"(%,+/0)+33()%5+')*=%%>0%@'$%/+0%A/+@/%#2%0"(% ,+/0)+33()% ,"#&% @+-3*% 5(% '53(% 0+% @+)A?% $+% 0"(% 5+')*% @'$% *($#1/(*% @#0"% '% .'/-'3%,'&'5#3#04=%%!"(%G[O%.-$0%53#/A%+)%0"(%&+@()%#/%0"(%+/%$0'0(%@#33%7-#,A34%A#33%0"(%5'00()4=%%C/%'$$(.534%/+0(%*(0'#3$%"+@%0+%,+/2#1-)(%0"(%5+')*%2+)%C)*-#/+%,+/0)+3=%%P+@()%#$%'&&3#(*%0+%0"(%TS_%)(1-3'0+)%eS%@"#,"%1(/()'0($%&+@()%2+)%0"(%)($0%+2%0"(%5+')*=%%P'1(%J%+2% 0"(% $,"(.'0#,% $"+@$% 0"(% ,+/0)+3% $@#0,"($% H@"#,"%@()(%/+0%/((*(*% #/% 0"(%(/*L%'/*% a,".#00% 0)#11()% #/6()0#/1% 5-22()$?% eE% '/*% eZ?% 0"'0% ')(% -$(*% 0+% *)#6(% 0"(% *#1#0'3%'00(/-'0+)% ,"#&i$% *#1#0'3% #/&-0$=% % 89j% U".% &-33Q-&% )($#$0+)$% ')(% '00',"(*% 0+% (',"% +2% 0"(%#/&-0$=%%!"(%C)*-#/+%,+/0)+33()%*)#6($%(',"%+2%0"(%#/&-0$%&)+*-,#/1%+/(%$#1/'3%@"#,"%3#1"0$%0"(%G[O%'/*%'%$(,+/*%$#1/'3%0"'0%1+($%0+%0"(%'00(/-'0+)%,"#&=%%P'1(%S%+2% 0"(% $,"(.'0#,% $"+@$% 0"(%"#1"% ,+/0)+3%5#0$% 0"'0% ')(%5)'/,"(*%+-0% '/*%*)#6(% 0"(%$(,+/*%'00(/-'0+)%,"#&%H"#1"%5#0%#$%@+)0"%S8%*\L%'/*%0"(%,"#&%(/'53($?%G[9%'/*%G[8=%%C$%,'/%5(%$((/?%5+0"%,"#&$%')(%(/'53(*%'0%0"(%$'.(%0#.(=%%P'1(%K%+2%0"(%$,"(.'0#,%$"+@$%0"(%,+//(,0#+/$%0+%0"(%'00(/-'0+)%,"#&$=%%V+0(%0"'0%0"(%,"#&$%')(%#$+3'0(*%2)+.%0"(%#/&-0%'/*%+-0&-0%'/*%(',"%+0"()%6#'%J=J%-Y%,'&',#0+)$=%%P'1(% E% +2% 0"(% $,"(.'0#,% $"+@$% 0"(% ,+//(,0#+/$% 0+% 0"(% C)*-#/+% ,+/0)+33()% 5+')*=% % !"(%C)*-#/+% ,+/0)+33()% 5+')*% "'$% #0$% +@/% #/0()/'3% TE_% )(1-3'0+)% '/*% #$% 0"()(2+)(% ,+//(,0(*%*#)(,034%0+%0"(%T`_%$@#0,"(*%&+@()=%%XK9%#$%'%$#/13(%0-)/%899j%PU!%0"'0%1(/()'0($%'%6+30'1(%5(0@((/% 9% '/*% TE% 6+30$=% % XK8% '/*% XK8% ,)('0(% '% 6+30'1(% *#6#*()% 0"'0% '33+@$% 0"(% C)*-#/+%,+/0)+33()%0+%.+/#0+)%0"(%5'00()4%6+30'1(%'/*%$#1/'3%0"(%-$()%6#'%&+@()%G[O%23'$"($%0"'0%0"(%5'00()4%#$%/(')#/1%(/*%+2%-$(2-3%3#2(=%%

Page 30: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

30

Page 31: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

31

8. SOFTWARE OPERATION %!"#$% $(,0#+/%*($,)#5($% 0"(%+&()'0#+/%+2% 0"(%C)*-#/+%R+/0)+33()=% % !"(% $+20@')(% #$% 3#$0(*% #/%C&&(/*#B%\=%%!"(%$+20@')(%,+/0'#/$%0@+%&)+,(*-)($g%$(0-&HL%'/*%3++&HL=%%a(0-&%#$%(B(,-0(*%2#)$0% '/*% #$% )($&+/$#53(% 2+)% #/#0#'3#<#/1% '33% 0"(% *#1#0'3% &#/$=% % a(0-&% '3$+% $0')0$% 0"(% #/0()/'3%0#.()$=% %C20()%(B(,-0#+/?%a(0-&%&'$$($%,+/0)+3%0+%G++&=% %G++&%,+/$#$0$%+2%'%$#/13(%-/(/*#/1%3++&=%%%%a(0-&%#/#0#'3#<($%0"(%*#1#0'3%>fU%0+%'%A/+@/%$0')0-&%$0'0(=% %>0%0"(/%0-)/$%+/%0"(%&+@()%G[O?%$(0$% 0"(%CX[Y%+-0&-0% 0+%E_?%$0')0$% 0"(%0#.()%'/*%,'&0-)($% 0"(%,-))(/0% 0#.(=% %R+/0)+3% 0"(/%&'$$($%0+%G++&HL=%%!"(% 2#)$0% 0#.(% 0")+-1"% 0"(%G++&% H0"(%(/0#)(04%+2% 3++&%+/34% )('334% 1(0$% (B(,-0(*%+/,(L% 0"(%&+@()%G[O% #$%-$(*% 0+% $#1/'3%@"'0%6()$#+/%+2% 0"(% $+20@')(% #$% 3+'*(*%6#'%'% $()#($%+2% ,+*(*%23'$"($=% %!"#$% #$%&()2+).(*%54%0"(%)+-0#/(%$"+@6()$#+/HL=% %V(B0%0"(%#/#0#'3%)('*%#$%.'*(%+2%0"(%5'00()4% $0'0(% -$#/1% 0"(%&)+,(*-)(%53#/AP@)G(*HL=% % % !"#$% &)+,(*-)(%53#/A$% 0"(% G[O%'0%3('$0% +/,(?% 1#6(/% 0"'0% 0"(% 5'00()4% #$% 2)($"=% % C$% 0"(% 5'00()4% *)'#/$?% 0"(% /-.5()% +2% 23'$"($%#/,)('$($?%"+&(2-334%1(00#/1% 0"(%-$()i$%'00(/0#+/% 0+%,"'/1(% 0"(%5'00()4=% %C20()% 23'$"#/1?% 0"(%G[O%#$%0-)/(*%+22%0+%$'6(%&+@()=%%!"(%#/#0#'3%)('*#/1%+2%0"(%#/&-0%PU!%#$%&()2+).(*%54%0"(%)('*P+0HL%)+-0#/(=%%!"#$%6'3-(%#$%&-0%#/0+%0"(%6')#'53(%/(@_'3-(?%@"#,"% #$%-$(*%0+%,+.&')(%0"(%,-))(/0%'/*% 3'$0%$(00#/1$%+2% 0"(%PU!=%%>2%0"()(%#$%'%,"'/1(?%0"(/%0"(%/(@%PU!%$(00#/1%#$%-$(*%0+%,+.&-0(%'%/(@%*#1#0'3%@+)*%2+)% 0"(% '00(/-'0+)$% '/*%+-0&-0% '%/(@%$(00#/1%@"#,"% #$%*+/(%54% 0"(% )+-0#/(% ,"'/1(C00/HL=%%!"(%2#)$0%0#.(%0")+-1"?%0"(%/(@_'3-(%#$%^-$0%3+'*(*%#/0+%0"(%'00(/-'0+)$%@#0"+-0%,"(,A#/1%#2%0"()(%@'$%'%,"'/1(=%%!"(%,-))(/0% 0#.(% H,-))!#.(L% #$% 2+-/*%'/*%'% 2-0-)(% 0#.(% H*(30'!#.(L% #$% ,'3,-3'0(*=% %W"(/%0"#$%0#.(%#$%(B,((*(*?%0"(%G[O%#$%53#/A(*%89%0#.($?%-$#/1%0"(%)+-0#/(%$3((&\3#/AHL?%'/*%0"(%,+/0)+33()%#$%&-0%#/0+%'%3+@%&+@()%.+*(%-$#/1%0"(%)+-0#/(%$3((&V+@HL=%%!"(%$3((&%.+*(%#$%$(0% 0+% aG[[Pk:UO[kPWXkOUWV%@"#,"% "'$% 0"(%.+$0% &+@()% $'6#/1$% '/*% 0"(% -/#0% (/0()$%$3((&k.+*(HL=% %C/% #/0())-&0%@#33% +,,-)%@"#,"%@#33%@'A(% 0"(%-/#0% '/*%(B(,-0#+/% ,+/0#/-($%@#0"%'/+0"()%0#.(%0")+-1"%0"(%3++&HL=%%C$$-.#/1%/+%,"'/1($%"'6(%5((/%*(0(,0(*%#/%0"(%PU!%$(00#/1?%0"(%,+/0)+33()%1+($%5',A%0+%$3((&=%%!"(%-/#0%@#33%1+%#/%0"#$%&+@()%$'6#/1$%.+*(%'20()%'%$"+)0%0#.(%&()#+*%@"()(%0"(%-$()%"'$%

Page 32: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

32

7-#0%.'A#/1%,"'/1($% 0+% 0"(%'00(/-'0+)% $(00#/1=% %!"(%-$()%(B&()#(/,($%'% $"+)0%*(3'4%@"(/%0"(4%'1'#/%$0')0%0+%'*^-$0%0"(%PU!=%%!"(%0#.#/1%@'$%'*^-$0(*%0+%.'A(%0"(%-$()%(B&()#(/,(%'$%$('.3($$%'$%&+$$#53(=%%% %

Page 33: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

33

%

9. CONCLUSIONS !"#$% *+,-.(/0% *($,)#5($% 0"(% *($#1/% '/*% +&()'0#+/% +2% '% *#1#0'3% $0(&% '00(/-'0+)=% % !"#$%'00(/-'0+)% @'$% *($#1/(*% 0+% '#*% #/% 0"(% .('$-)(.(/0% +2% $#1/'3$% 2)+.% 8% 0+% 89% :;<=% % !"(%'00(/-'0+)%@'$% ,'&'53(% +2% '00(/-'0#/1% 0"(% #/&-0% $#1/'3% 2)+.% <()+% 0+% ZS%*\% #/% 8% *\% $0(&$%-$#/1% '% )+0')4% ,+/0)+3=% % C% 5#/')4% 3#/(')% '))'4% +2% G[O$% #$% -$(*% 0+% *#$&3'4% 0"(% '00(/-'0#+/%6'3-(=% % !"(% ,+/0)+3% +2% 0"(% '00(/-'0+)% ,"#&% @'$% ',,+.&3#$"(*% -$#/1% '/% C)-*#/+% .#,)+%,+/0)+33()%5+')*=%%!"(%$+20@')(%&().#00(*%0"(%-$()%0+%)+0'0(%'%*#'3%0+%,"'/1(%0"(%'00(/-'0+)%6'3-(=%

Page 34: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

34

Page 35: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

35

APPENDIX A

"#$%&'()#*!'+,!-)..!/0!1'(%2)'.*!%%%%%%%

Page 36: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

36 %

Page 37: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

37 %

Page 38: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

38

Page 39: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

39 %

Page 40: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

40

Page 41: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

41

%%%%

Page 42: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

42

%

Page 43: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

43

APPENDIX B %3/+(2/.!"/0(4'2%!5)*()+6!%The Ardunio board software was developed and compiled using the Arduino Development Environment (ADE). The ADE contains a text editor for writing code, a message area, a text console, a toolbar with common functions and other menus. The ADE also permits connections to be made with the microprocessor and transfers code into the same. Software written for the Ardunio boards is called a sketch. Sketches are C like programs that enable the programmer to call prewritten routines easily. In fact, the boards are simply AVR development boards and one can program them using AVR C or C++ (using avr-gcc and avrdude or AVR Studio programming environments). More information on Arduino can be found on the web site http://arduino.cc. Here is the listing of the final version of the software2. %%%%%

2 The software listing was made by copying the original code into MacVim then printing as a pdf document. The pdf document was broken into 8 separate pdf pages and imported one by one into this Word document. This was the only way to preserve the formatting and color coding that MacVim provides.

Page 44: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

44

%

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 1

/* * Name: Attn_v3_11_1_2011 * Desc: Control a digital attenuator from POT * Engineer: Perry Robertson * Sandia National Labs * Date: 11/1/2011 * * This code reads the voltage value on a POT from 0 to 5V * corresponding to integer values 0 to 1023 * * The data values are digitized (top 6 bits) and output to the * attenuator. * * Battery monitor circuit blinks power light when low battery detected * * The attenuation, in this version, increases with clockwise rotation * * A timer is used to put the Arduino to sleep after defined interval * using unsigned long millis() returns number of milliseconds since Arduino began * running the current program. Overflow after approx 50 days. * * Modified 11 1 11 to show version for 2 sec after power up * showversion(), make sure you change the routine when updating version */

#include <avr/sleep.h>#include <avr/interrupt.h>#include <avr/io.h>

//#define DEBUG

#define INIT_TIMER_COUNT 6#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT

// Set the pin numbers for the I/O on Deicimila Board#define POT A7#define PWR A6#define LED 13 // on board LED always connected to D13#define E5 12#define E4 11#define E3 10#define E2 9#define E1 8#define E0 7#define M1 3 // system clock for testing#define M2 4#define LED1 5#define LEA 6

// Battery indicator state voltages#define BatGreen 0 // V > .8V#define BatYellow 1 // .6V < V < .8V#define BatRed 2 // V < .6V

// int integer value 16 bit 32,767 to 32,768// long extended data type for long integer 32 bit 2,147,483,647 to 2,147,483,648// float floating point 32 bit 3.4028235E+38 to 3.4028235E+38

int sleepStatus = 0; // variable to store a request for sleepint count=0; // counterint potValue=1; // the last value of the input voltageint newValue=60; // the newest value of the potfloat pwrsupValue=0; // voltage of power supplyint lowBat=0; // low battery indicatorint delaycnt=750; // default delay count (basic loop delay)

// variables for Interrupt Timerint int_counter = 0;long starttime = 0;int clk = 0;unsigned long currTime = 0;unsigned long oldTime = 0;

Page 45: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

45

%

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 2

unsigned long deltaTime = 0; // difference between oldTime and currTimeunsigned long delayTime = 3600000; // time before we sleep approx 1 hour (3600000), 5000 for testing

void setup(){ // initialize all the digital pins as an output. // Set all the digital pins as inputs to emulate open collector outputs pinMode(LED, OUTPUT); // this is the LED on Arduino Nano Board pinMode(LED1, OUTPUT); // LED1 pinMode(LEA, INPUT); // LEA pinMode(E5, INPUT); // E5 pinMode(E4, INPUT); // E4 pinMode(E3, INPUT); // E3 pinMode(E2, INPUT); // E2 pinMode(E1, INPUT); // E1 pinMode(E0, INPUT); // E0 pinMode(M1, OUTPUT); digitalWrite(M1, LOW); pinMode(M2, INPUT); //digitalWrite(M2, LOW); // Turn on the LED until first cycle completes digitalWrite(LED, HIGH); // turn LED on at beginning digitalWrite(LED1, HIGH); // do likewise to the power LED #ifdef DEBUG Serial.begin(9600); // start a serial port for test outputs #endif // can put interrupt code here from Sleep demo analogReference(DEFAULT); // sets the AREF=5V count=0; // get the start time and set oldTime currTime = millis(); oldTime = currTime; #ifdef DEBUG Serial.println("Setup Complete"); #endif} // setup()

void showversion(){ // Setup has already turned on all the leds, we need to // display the version number on the leds // Set all the digital pins as inputs to emulate open collector outputs // Current Version = 3 pinMode(E5, OUTPUT); // E5 digitalWrite(E5, LOW); pinMode(E4, OUTPUT); // E4 digitalWrite(E4, LOW); pinMode(E3, OUTPUT); // E3 digitalWrite(E3, LOW); pinMode(E2, OUTPUT); // E2 digitalWrite(E2, LOW); pinMode(E1, INPUT); // E1 pinMode(E0, INPUT); // E0 // might need to cycle the LE to set the new value (all at once) // LEA normally an INPUT (attenuators digital inputs latched) // here we are going to enable the new data pinMode(LEA, OUTPUT); digitalWrite(LEA, LOW); // pull low delay(2); // wait just a little bit pinMode(LEA, INPUT); // relatch the new inputs } // showversion()

// this wake up routine is not really called because we never wake up!void wakeUpNow() // interrupt handler{ // execute code after wake up, before returning to the loop()} // wakeUpNow()

Page 46: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

46

%

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 3

// clock() creates a short pulse each cycle of the main loop()

void clock() // create cycle clock for testing{ if (clk = 0) { clk = 1; digitalWrite(M1, HIGH); } else { clk = 0; digitalWrite(M1, LOW); }

} // clock()

// update the Attenuator digital values from potValue

// they act like open collector outputs

// as inputs, they will float high

// as outputs, set to LOW, they will pull the line down

// potValue range 0 63

// stay in the while loop as long as changes are taking place

// when the counter exceeds limit, then return to main loop

void changeAttn(){ // set the bits one by one by doing a bit test

int delaycnt; // temp var how long to take for each cycle int count; // number of cycles since last change

delaycnt=25; // set the faster delay count for the little loop count=0;

while (count < 300) {

// Read the Analog Input newValue = readPot(); // read the analog input represents attn setting 6bits

#ifdef DEBUG Serial.print("POT = "); Serial.print(newValue, DEC); //Serial.print(" = "); //Serial.print(newValue, BIN); Serial.print(" Vsup = "); Serial.print(pwrsupValue, DEC);

Serial.print(" Count = "); Serial.print(count, DEC);

Serial.print(" lowBat = "); Serial.println(lowBat, DEC);#endif

// update based on the POT Value if (newValue == potValue) { count++; } else { potValue=newValue; // save the new value count=0; // clear the cycle count, we are a changing things

// make changes using the newest value

if ( potValue & 1 ) { pinMode(E0, INPUT); // set the output high } else { pinMode(E0, OUTPUT); // set the output low digitalWrite(E0, LOW);

Page 47: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

47

%

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 4

}

if ( potValue & 2 ) { pinMode(E1, INPUT); } else { pinMode(E1, OUTPUT); digitalWrite(E1, LOW); }

if ( potValue & 4 ) { pinMode(E2, INPUT); } else { pinMode(E2, OUTPUT); digitalWrite(E2, LOW); }

if ( potValue & 8 ) { pinMode(E3, INPUT); } else { pinMode(E3, OUTPUT); digitalWrite(E3, LOW); }

if ( potValue & 16 ) { pinMode(E4, INPUT); } else { pinMode(E4, OUTPUT); digitalWrite(E4, LOW); }

if ( potValue & 32 ) { pinMode(E5, INPUT); } else { pinMode(E5, OUTPUT); digitalWrite(E5, LOW); }

// might need to cycle the LE to set the new value (all at once) // LEA normally an INPUT (attenuators digital inputs latched) // here we are going to enable the new data pinMode(LEA, OUTPUT); digitalWrite(LEA, LOW); // pull low delay(2); // wait just a little bit pinMode(LEA, INPUT); // relatch the new inputs }

// as long as we are making changes, keep looping here faster // than we normally go through the main loop //clock(); //digitalWrite(LED, HIGH); // set the LED on delay(delaycnt); // wait for a second clock(); //digitalWrite(LED, LOW); // set the LED off delay(delaycnt); // wait for a second

}

// the guy has quit twiddling on the knob, go back to main loop} // changeAttn()

// read the POT ADC routineint readPot() { int v; v = analogRead(POT); // read the pot value (10 bits) v = 1023 v; // make attn increase with clockwise rotation v /= 16; // convert to a 6 bit value if (v > 62) {

Page 48: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

48

%

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 5

v = 62; } return v; // return value} // readPot()

// read the Power Supply valuefloat readPwr(){ int v; float f; v = analogRead(PWR); // read the power supply voltage (div 10) // reading will be scaled 5V=1023, scale .9*1023/5=184 f = 5.0*v/1023; // scale reading return f; // return value} // readPwr()

float batTest(){ float v; // read the power supply voltage v = readPwr(); // the 9V power supply Div 10 (0 .9V) if (v > .8) { lowBat = 0; // battery good } if ((v <=.8) && (v>=.6)) { lowBat = 1; } if (v < .6) { lowBat = 2; } #ifdef DEBUG Serial.print("Vsup="); Serial.print(v, DEC); Serial.print(" lowBat="); Serial.print(lowBat, DEC); #endif return v; } // batTest()

// blink the power LED a number of times depending on the level of the// battery. lowBat is gloabal variable set in batTest()void blinkPwrLed(){ int i; for(i=0; i<=lowBat; i++) { #ifdef DEBUG Serial.print(" lowBat="); Serial.print(lowBat, DEC); Serial.print(" BLINK "); #endif

// one pulse no matter what digitalWrite(LED1, HIGH); // turn on LED delay(100); digitalWrite(LED1, LOW); // leave LED off delay(100); }

} // blinkPwrLed()

// blink the LED 10 times just before we go to sleepvoid sleepBlink(){ int i;

Page 49: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

49

%

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 6

for(i = 0; i<10; i++) { digitalWrite(LED1, HIGH); // turn on LED delay(100); digitalWrite(LED1, LOW); // turn off LED delay(100); } } // sleepBlink()

// go to sleep routinevoid sleepNow() { /* Now is the time to set the sleep mode. In the Atmega8 datasheet * http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf on page 35 * there is a list of sleep modes which explains which clocks and * wake up sources are available in which sleep mode. * * In the avr/sleep.h file, the call names of these sleep modes are to be found: * * The 5 different modes are: * SLEEP_MODE_IDLE the least power savings * SLEEP_MODE_ADC * SLEEP_MODE_PWR_SAVE * SLEEP_MODE_STANDBY * SLEEP_MODE_PWR_DOWN the most power savings * * For now, we want as much power savings as possible, so we * choose the according * sleep mode: SLEEP_MODE_PWR_DOWN * */ // shut off all the digital outputs (and the LEDS // by setting their modes to INPUT // this should leave the digital attenuators in last state and keep // it from changing (until power on the board is cycled pinMode(LED, INPUT); // this is the LED on Arduino Nano Board pinMode(LED1, OUTPUT); // LED1 pinMode(LEA, INPUT); // LEA, leave high to keep from enabling board pinMode(E5, OUTPUT); // E5 pinMode(E4, OUTPUT); // E4 pinMode(E3, OUTPUT); // E3 pinMode(E2, OUTPUT); // E2 pinMode(E1, OUTPUT); // E1 pinMode(E0, OUTPUT); // E0 pinMode(M1, INPUT); pinMode(M2, INPUT); digitalWrite(E5, LOW); // write low turns off LEDs digitalWrite(E4, LOW); digitalWrite(E3, LOW); digitalWrite(E2, LOW); digitalWrite(E1, LOW); digitalWrite(E0, LOW); digitalWrite(LED1, LOW);

set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here

sleep_enable(); // enables the sleep bit in the mcucr register // so sleep is possible. just a safety pin

/* Now it is time to enable an interrupt. We do it here so an * accidentally pushed interrupt button doesn't interrupt * our running program. if you want to be able to run * interrupt code besides the sleep function, place it in * setup() for example. * * In the function call attachInterrupt(A, B, C) * A can be either 0 or 1 for interrupts on pin 2 or 3. * * B Name of a function you want to execute at interrupt for A. * * C Trigger mode of the interrupt pin. can be: * LOW a low level triggers

Page 50: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

50

%

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 7

* CHANGE a change in level triggers * RISING a rising edge of a level triggers * FALLING a falling edge of a level triggers * * In all but the IDLE sleep modes only LOW can be used. *//* // Perry doesn't need an interrupt attachInterrupt(0,wakeUpNow, LOW); // use interrupt 0 (pin 2) and run function // wakeUpNow when pin 2 gets LOW */

sleep_mode(); // here the device is actually put to sleep!! // THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP

sleep_disable(); // first thing after waking from sleep: // disable sleep... // detachInterrupt(0); // disables interrupt 0 on pin 2 so the // wakeUpNow code will not be executed // during normal running time.

} // sleepNow()

// Main loop enter here after setup()void loop(){ delay(50); // give time to see LED1 turn on digitalWrite(LED, LOW); // turn it off and leave it off digitalWrite(LED1, LOW); showversion(); // show the version number on LEDs delay(50); // every time through the loop, read the battery voltage // may want to slow this down to save power later on pwrsupValue = batTest(); // main loop delay delay(delaycnt); blinkPwrLed(); // flash the on board led with power state delay(delaycnt); //clock(); // every time through loop, read the pot and see if we need to respond to user input // Read the Analog Input newValue = readPot(); // read the analog input represents attn setting 6 bits count++; // increment each time through the loop // not really doing much with this except when debugging if (newValue != potValue) { changeAttn(); // change the values to the attenuators count=0; currTime = millis(); // reset the timer values oldTime = currTime; } // see if enough time has passed since the guy twiddled my knob currTime = millis(); deltaTime = currTime oldTime; // number of milliseconds #ifdef DEBUG Serial.print(" dtime="); Serial.print(deltaTime, DEC); #endif if (deltaTime > delayTime) { // we are going to sleep and save battery cause someone // has left me on for a long time

// create a pulse so we can tell when we go to sleep clock(); // blink the power led 10 times before going to sleep

Page 51: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

51

~/Documents/ULTRA/Arduino/Source Code/V3_11_1_2011.c[+] Page 8

sleepBlink(); sleepNow();

}

#ifdef DEBUG Serial.print(" POT = "); Serial.print(newValue, DEC);

Serial.print(" Count = "); Serial.println(count, DEC);#endif

} // loop()

Page 52: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

52

Page 53: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

53

APPENDIX C

� � � � � � � � � � �� � � � � � � � � �� � � �

•  � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

Page 54: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE

54

%7)*(2)89()/+!% All Electronic Copies 1 MS0341 Perry J. Robertson 1751 1 MS1064 Rick Kellogg 2616 1 MS0899 Technical Library 9536

Page 55: Digital Attenuator Design - Sandia National Laboratories · This document describes the design and operation of a electronic digital step attenuator. This attenuator was designed

UNLIMITED RELEASE