Senior Design ECE 480
Popular in Course
Popular in Electrical Engineering & Computer Science
This 72 page Class Notes was uploaded by Teagan Klocko MD on Saturday September 19, 2015. The Class Notes belongs to ECE 480 at Michigan State University taught by Erik Goodman in Fall. Since its upload, it has received 78 views. For similar materials see /class/207385/ece-480-michigan-state-university in Electrical Engineering & Computer Science at Michigan State University.
Reviews for Senior Design
Report this Material
What is Karma?
Karma is the currency of StudySoup.
Date Created: 09/19/15
Microcontroller The instruction set processor implemented as an integrated circuit that functions to control the embedded system Parts or Features of Microcontrollers Instruction set programmable RAM registers ROM PROM EPROM Instruction storage ROM Readonly memory PROM Programmable ROM Program set at factory OTP Onetime programmable EPROM Erasable programmable ROM IO Ports Serial Parallel 12C Clock generator Reset function Watchdog timer resets the controller after a problem occurs Timers AD converters DA converters Examples 8031 40 pins 128 bytes RAM 10 325 80C3l CMOS low power 40 pins 128 bytes RAM 10 549 D880C320 High speed 25 MHZ version of 80C3l 1295 8049 8bit microcontroller one of the oldest 095 BOSZAHBASIC Microcontroller with internal Basic 2495 MC SHCl 1A 1 P Microcontroller with internal AD 1095 ZSOH 40 pins 8 MHz speed 295 Other microcontroller terminology Package Type Various Types of Chip Packages Dual Inlme Package DIP Thin Small Outline Package TSOP Data path size 8 bit Example 8051 16 bit Intel MCS96 32 bit Intel i960 Instruction Sets Plasu39c Quad Flat Pack PQFP RISC Reduced instruction set computer CISC Complex instruction set computer 80331 111 Instructions 68HC1 1 62 Instructions TMP87C800NF 129 Instructions PIC16C57 33 Instructions 286C06 47 Instructions 12 MHz 8 MHz 8 MHz 20 MHz 12 MHz Plasuc Leaded Chip Carrier PLCC l MIPS 2 MIPS 2 MIPS 5 MIPS 6 MIPS Microconlroller RAM MIPS Instructions PWM AID Table 13 1 A sample oftw mivrmmuralcry available m the Muirw mlu Inlcrrupl Price Microcontroller Application Development Programmer Bums the microcontroller codeprogram into the EPROM memory The codeprogram is generated using either assembly language or C language generally Basic is also sometimes used Compiler Converts the C code or assembly code to machine language code for the microcontroller Simulator Software program that runs the microcontroller code Permits the interrogation of registers etc Emulator Functions as a software replacement of the microcontroller in an embedded system Allows ill testing of the microcontroller code Note for the PIC 16C77 we have a compiler and programmer in the EB 2221 lab Detailed Examination of the PIC 16C77 Microcontroller The full speci cation sheet for the 16C77 is available at the web site of Microchip Technology Inc microelnmn The full speci cation sheet is 288 pages long One copy is available in the EB 2221 lab for those interested The PIC 16C77 is a 8bit CMOS microcontroller with AD converter 8k x 14 EPROM size for program memory 368 bytes x 8 data memory RAM Three 8 bit ports B C and D One 6 bit port A One 3 bit port E DC to 20 MHz 8 bit 8 channel AD converter 35 instructions in the instruction set 12 interrupts Serial Communication USART Universal Synchronous Asynchronous ReceiverTransmitter Synchronous Serial Port SPI Serial Peripheral Interface IZC InterIntegrated Circuit Three timers LSI403WLP Digital Signal Processor Page 2 01 z Emazge gggggg bi G QGF i gkm igzzi igmta m Ly qu39g ia agigz LC S r r 13 r i iqi f m3ga 5 33 30 3303 B 6 Pin T232 http i fwwwIsilogiccon1i productsf zspwdspwsiandardjroducts lsi403w1phtm1 9 1 82005 Mp3 Audio Files Ancl speech processing in Matlab ECE 480 Fall 2007 Design Team 2 Jason Cooper Art Hallman Francis Okonkwo James Yang Jaeseung Shim Overview III Introduction to mp3 s l Function of mp3 files I Creation of mp3 files ie encoding I Features of mp3 s eg data tags III Processing speech mp3 s in Matlab I Reading mp3 files I Writing mp3 files I Analysis of speech signals in mp3 form Introduction to mp3 s Audio File III Movie Pictures Experts Group 1 Audio Layer 3 I E aka mp3 l Store digital Information i 39itif de a 33 r i39 ile anotheruser MPaaudio les I Audio specific file format I Utilizes compression to reduce size of audio reco rd in g iii a39iief ir downloaded from me Internet to your computer How the Works Your computer can rip MP3 liles or collecl them playars MP3 files can be transferred to a parlable MP3 player or made Into an audio CD Introduction to mp3 s Development III Invented by team of engineers at Philips CCETT Centre commun d39 tudes de t l vision et t l communications I l IRT Institut fiJr Rundfunktechnik I Fraunhofer Society III Digital Radio Research Program I EUREKA 147 DAB I ISOIEC standard in 1991 Introduction to mp3 s Function III Same basic function as CD I Fs 44 kHz sampling frequency l Sample Size 16 bit 2 bytes l Sound requires 1 sample per output III 2 samples for stereo 44000samplessec 16bitsample 20utputs 1408000 bitssec III Problem with standard digital format CD I 1408000bitssec N 176000 bytessec l Average song N 32000000 bytes of space I Download Time N 2 hours 56K modem Introduction to mp3 s Function III Goal of mp3 format I Compress CDquality without compromising quality III Factor of 10 to 14 III 32 MB song CD 3 MB mp3 I Advantages III Download songs in minutes not hours III Store hundreds of songs on hard drive Introduction to mp3 s Compression III Lossy compression of audio data I Equivalent but not identical to original data I Discards irrelevant data and then compresses file III Perceptual Noise Shaping l Utilizes limitations of human auditory perception I I III Limits sounds to those perceptible to humans There are certain sounds that the human ear hears much better than others If there are two sounds playing simultaneously we hear the louder one but cannot hear the softer one Auditory Masking Introduction to mp3 s Compression III Auditory Masking l Difficulty differentiating sounds with similar frequencies 100an 107qu Tonei ouu whom an DH 01 2 39 40811 quot 3 i I 39 I m E s a gt Grime Introduction to mp3 s Compression III Bitrate I Number of bits per second dedicated to data storage I Tolerance level I Lower tolerance means more data will be discarded and vice versa a all 77 Illlllll Emu IIIIIIIHIIIIIW Analog Signal IDigital Signal al 64 Hips Digiial Signal at 12339 MilliS Introduction to mp3 s Encoding Break audio Signal into frames Determine Spectral Distribution Bit L rate and max bits per frame Compare frame frequencies to human psychoacousch Compress file using Hoffman Algorithm Assemble frames into serial bit stream Introduction of mp3 s Data Tags III ID3 Tags I Data Container within an MP3 audio file III eg title artist album track number etc I Tag Standard El ID3V1 l Tag size is limited to only 35 bytes III ID3v2 l Total tag size is limited to 256MB I Optional Feature III Not all mp3 files tags Matlab mp3 files III mp3readm I YFSNBITS mp3read FiIename III Reads mp3 encoded audio file into a vector Y and returns sampling rate FS and bit depth NBITS III mp3writem I mp3writeYFSNBITSFILE III Writes waveform data Y to mp3 encoded file FILE at sampling rate FS using bit depth NBITS Matlab Reading mp3 files III Function mp3read I Existent Matlab script III Relies on two external binaries I mpg123exe mpeg audio decoder player Provides downsampling feature I mp3infoexe Read and modify ID3 Tags Display technical aspects eg sampling frequency bit rate playing time and other format information about the mp3 I Features III Reads only user specified frames in seconds III Only decodes required parts Matlab Writing mp3 files III Function mp3write I Existent Matlab script III Relies on one external binary I ameexe mp3 encoder Creates mp3 files from other formats data I Features III Writes only user specified frames III Only encodes specified parts Matlab Speech Processing Tools III Speech Processing in Matlab l audio in mp3 form III Various Tools I Energy Calculation Average Magnitude ZeroCrossing Rate Fourier Transform I I I I Autocorrelation Matlab Energy Calculation III Energy in a Signal III Distinguish between Voiced and Unvoiced speech speech He took me by surprise Matlab Average Magnitude El Magnitude of a Signal 111 7 g rmuu em mi inf El Provides smooth magnitude plot I Easier to analyze ie find specific values I Analog type plot Matlab Average Magnitude winLen 301 winOverlap 300 wHamm hammingwinLen magnitudeAv STAmagnitudespeechSignal wHamm winOverlap subplot111 plott speech ignalmaxabsspeechSignal title39speech He took me by surprise39 hold on delay winLen 12 plottdelay1enddelay energySTmaxenergyST 39g39 plottdelay1enddela m19nitUdEAVmaxmagnitudeAv 39r39 legend39Speech3939ShortTime Energy3939Average Magnitude39 xlabel39Time sec39 hold off speech He took me by surprise Speech ShortrTime Energy Average Magnitude TlmB sec Matlab ZeroCrossing Rate III Zero Crossing of Signal 2 lwnlzrlm nilww m III Finds average ratenaEIwhich signal crosses zero I Find regions voiced and unvoiced I Find regions between speech and silence Matlab ZeroCrossing Rate wRect rectwinwinLen ZCR STAzerocrossspeechSignal wRect winOverIap subplot111 plott speechSignaImaxabsspeechSignal title39speech He took me by surprise39 hold on delay winLen 12 plottdelay1enddelay ZCRmaxZCR39r39 speech He took me by surprise xlabel39Time sec39 egend39Speech3939Average Zero Crossing Rate39 39339 hold off mafm U o K x U JIIIIIMI W 1 i M T Speech Average Zero Crossing Rate Time sec Matlab Fourier Transform III Fast Fourier Transform FFT I Discrete Time I Discrete Frequency III Represent frequency content of signal Matlab Autocorrelation III Measures how a signal matches with itself III Finds periodicity within signal 006 01 I Voiced Speechl Autocorrelation usuiced Speech I 0011 U I 002 0055 lini 0 ill willilllllll 1le 032 335 034 01 i i i 0 200 400 500 800 500 0 500 002 Unvoiced Autocorrelation of Unvoiced 001 0005 0 0 39Um anus 001 0 200 1100 800 800 500 0 500 Matlab Demonstration III Reading mp3 file into Matlab I Plotting audio signal III Energy Calculation l Plotting energy spectrum of audio signal III Discrete Fourier Transform l Plotting frequency content I Downsampling Facilitator De ne what a success is Negotiate make sure it is reasonablerealistic ECE Side 7 looking at different control topologies 0 Analog timer 555 vs microcontroller 0 Time or event based 0 PIC simple to program and use ME Side 7 Valves Get on schedule Operating under ECE rules ME side may have additional requirements Find out our budget 0 ME department N 1000 0 ECE department N 500 0 Sponsor N 6000 Sponsor Offered 2 different proposals 12 port valve would give exibility C02 7 lmL N20 7 250mL Trap may expand when full blocking ow Length of ow path most important 810 inches in the lab Don t focus too much on the traps Nafion 7 good for awhile but doesn t work over time 7 perhaps use another cyro trap here Can t dual wind on a cold finger 12000 in budget N6000 to play with valves plumbing over parts 7 Not enough for coolers yet The other 6000 goes to out class Waiting on NSF funding 7 Mid October 10L of liquid nitrogen per day Check for cheaper coolers to trap water trap right after GC column 110 C 0 Pressure of Helium doesn t allow gases to condense N20 psi for Helium always need Helium going through system Field temperatures will vary Success 0 Ideally build a prototype by the end of semester 0 Realistically we re short funding 7 we can mechanically build most of the system without the coolers 0 We could test the system with liquid nitrogen 0 Have electronic controls for the Rikor coolers ready to go Control system interface Create our own or share with mass spec o Standalone screen or laptop 0 Needs to be rugged Constructing a LithiumIon Polymer Battery with an Imbedded Protection Circuit Module PCM Michael Kovalcik Team 10 ECE480FSO8 Executive Summary Rechargeable lithium ion LiIon and lithiumpolymer LiPo cells have a higher energy density and greater nominal voltage than conventional onetime use batteries LiIon and LiPo batteries are the ideal power source for many portable electronic devices In order to maximize their lifecycle and increase safety both Li Ion and LiPo cells require the use ofa Protection Circuit Model PCM when assembled together to form a battery The PCM will generally provide the battery with overcharge discharge protection short circuit protection current limitation and voltage and current balancing in each cell All of these factors are important in obtaining the maximum output and longest lifecycle from a rechargeable lithium battery These notes will discuss the need for and configuration of a PCM the advantages and disadvantages of these configurations and stepbystep instructions for the construction ofa rechargeable lithium battery with an onboard PCM Keywords Battery Cell LithiumIon LiIon LithiumPolymer LiPo Protection Circuit Module PCM Energy Density NickelMetalHydride NiMH NickelCadmium NiCad LeadAcid Introduction the bin ernv density associated with lithium ion and lithium polymer cells makes them the ideal yu e unit i r 39 39 nerau enttbi tenuiai dinital pU er tom In order 39 39 39 39 b H w ion LiIon andquot 39 El rv39quot 39 39 39 PCM when assembled together to form a battery See Figure 4 The PCM may be D m r t a a r y Figures 1a amp 1b neuueu rm I Onboard PCM Intelligent clinrger lgure 1a Figure 1b Objective 39 huyimueuljug a PCM and 39 howt t t 39 39 LiPo battery 39 onboard PCM Warning University arm n r r u r u n m n mmm constructan apparatus as described in these notes Ifyou have not mettne above requirements DO NOT BUILD THIS DEVICEV Background As Electrical Engineers it is likely at some point in our careers we will have some level ofprofessional involvement with battery operated systems Rechargeable NickelMetalHydride NiMH and NickelCadmium NiCad cells and LeadAcid batteries are no longer the standard rechargeable battery technologies These three technologies suffer from lower energy densities 50112 3375 amp 1855 Ikg respectively than conventional one time use ZinkCarbon or Alkaline cells This has made these onetime use batteries and cells more desirable for many consumer applications The new generation rechargeable cells have made it possible to combine higher energy density 95335 Ikg relatively high nominal voltage between 3 amp 4 volts and the ability to hold a charge for years into a compact rechargeable battery that outperforms onetime use batteries The ability oflithium ion LiIon and lithium polymer LiPo cells to charge and discharge more than 1000 times without a reduction in performance makes them environmentally friendly as well Increased mass production of these cells has made this technology more economical The culmination of these factors is quickly making rechargeable lithium cells the preferred power source for portable electronic devices Rechargeable lithium cells are not without their drawbacks The primary ingredient lithium is highly reactive making cells that contain it more dangerous than those utilizing another rechargeable cell technology Because of the increased safety risk both lithium ion and lithium polymer batteries require the inclusion of four safety features to reduce the risk of fire or explosion Shutdown Separator Disables a cell ifits temperature is too high TearAway Tab Disables a cell ifits internal pressure is too high Vent Releases built up internal pressure in a cell Thermal Interrupt Disables a cell ifit is being overcharged or if the current level used to charge it is too high Aside from increasing the overall complexity of these cells these safety features take up space add weight and limit design options Because the activation ofa safety feature can permanently and irreversibly disable a cell rechargeable lithium batteries usually include active circuit technology for protection especially during the charging cycle This protection circuitry is often contained in a PCM Protection Circuit Module See Figure 4 The PCM may be imbedded in the charger or permanently attached to an individual battery pack The remainder of these notes will discuss the advantages and disadvantages to each method of implementation and will go over the details for the construction of a LiIon or LiPo battery that contains a permanently attached PCM Comparing Methods There are two methods for implementing a lithium ion or lithium polymer battery utilizing a Protection Circuit Module or PCM First the PCM may be imbedded in the charger pack See Figure 1a While on the charger the battery will have the standard protection offered by a PCM including Overcharge Protection Short Circuit Protection Charge Current Limiting Balancing Functions for Each Cell This system however will not be able to protect the battery once it is removed from the charger This means that the battery its self has few or no attached active circuit elements which will monitor its operation The advantages and disadvantages of this system are shown below in Table 1 Next the PCM can be permanently attached to each individual battery pack See Figure 1b This system is generally used in rechargeable lithium batteries that have multiple cells are more expensive and where the small amount extra weight from a PCM will not effect performance The advantages and disadvantages of this system are shown below in Table 2 Use of Unspecialized Power Sources The advantages of the onboard PCM are usually worth the initial increased cost and weight The cost increase is often recouped by the extended battery life inplace charging and increased battery performance How to BatteryCell Size amp Rating This section includes instructions on how to assemble the second rechargeable LiIonPo battery system with an onboard PCM In order to construct a battery system that is the correct size for the intended application and assuming you have already determined the voltage needed you must calculate the amp hours that will be needed by using the formula below Current Required for Operation X Duration of Operation AH After determining the amp hours the item to be powered will use it is usually a good idea to add 10 to 20 to the calculated amp hour result Next you will need to select a lithiumion or lithiumpolymer cell that has an amp hour rating nearest the level calculated Ifyou cannot find the exact rating you require you should select a cell that has a higher amp hour rating Next you will need to determine how many of these cells you will require to obtain the voltage level your system requires Both types of rechargeable lithium cells usually have a nominal voltage of 37 volts The choice ofbattery voltages is usually limited to some multiple of this number ofCe11s12345671013 n Voltage I 37V I 74vl 111vl 148vl 185vI 222vl 259v 37v 481vl nx37 Select the appropriate number of cells in series required to reach the voltage level you require Where to Order Next you will need to select a PCM that is designed to utilize this voltage and rated for the current that you require A useful website for finding both batteries and a PCM is htt wwwbatte s acecom Assembly Once you have received the cells and the PCM it is a simple matter of soldering the cells together in series and then connecting it to the PCM as shown in Figure 4 lgure 4 Cnnneman schemmcfar athree c2110 1v Manpa PCM The PCM m Flgure 4 uullzes dlree LlrlonPD cells m senesto produce a 1 l lltululau 2 5vrespecuvely W39hlle the nomlnal voltage level ofdle hatterywlll usually be equal to the mu m ul r ll u hav selected For me 11 1v system m Flgure 4 the maximum battery voltage maybe and overdlscharge llmlts ofdle cells cells used ordle PCMwhlch ever ls lower Warning These asweassnnsses asemsenaeacssusesseaea use us use wanes ssase a a canshutc an apparatus as desmbedm these mates m nspzper Annendix I Final Circuit Schematic created using Eagle unmet 7 Appendix 11 Eagle Printed Circuit Board Layouts Via hco o G occooooaoooooc aaaooouaaeoooo Top ymma Cirad Bound Tap aPn39nlzd Circuit 5mde 00771110712711 Plaaemaltx Aggmdix m Seem Component Damsheet Serums and Apphcatum Notes APPLICA110N n 39r n r One Way rs to rncorporate rt we a forcetovonage crrcurt A rneans of cahbrauon must then decrease the sensuer or the sensor An examp e crrcurt rs snown be ow n ms case rt rs drwen by a 75 v DC excrtanon vo tage ans crrcurt uses an mvemng operatrona arnpnner arrangement can ma vonage to a orgrrar output rn ma crrcmt the sensmvrty or the sensor coma be r r a r r WM make the Sensor eSS Sensmve and ncrease S actwe force range n RRSKwheraR R Rn mm mm m McmmP Flash Din Package m momma rsin39scs Moum Package Max mannaquotEnded ourrenx 2 5 mA ad Resrstance Appruxrmaiew 20 M51 0 FLIHrLoad Resrsxance gt 20 m Possible Overload RasrsLance a 5 m o The two su ply manages 9v and raw arm VD175V shame remain mnsmnl MICHOCHIP PIC18F2420252044204520 2840447Piu Enhanced Flash Mirl39omun39ollers Wilh 1073i AD and nauont Tetlumloav Power Managed Modes Flexible Oscmalor Smlcture39 mm mm W V ox pnammoammm manna mm uscmwrs nEx ema RC modes upw4 m nEx EmMCYackmu es mum v mmmcmmmm x userse amb eV39EQuencai mm mmst 7 mm mm m mm s mmmcszmmmew PL 7 us rmnabencump quotEsteem 9mm gammy mm Tmer 32 m FNSaEC oanmmr Peripheral ngmlgm W mnsmsmksaurca 15 HAVIS m m mm mm mm u 1223 Wm mam cc mums rim AEMMDD as 25 Specml Mlcruccmmller Fealures mquot 02pm nmrarzvvwlzccw Cw mmr am on w urfuwPWM mm spamy Pmiramwuhla asquot m WWW m Amman mgmm Swa PMW sman am am mitnwt an 5 as ne a me Q mum gm Dumma nwmmvarammm h WWW r w w same we up m we ISFZSZ Mzmzommlm Datum Excerpt General Description The mxmmxm mange Nickel Mam mam mm and Mara 2mm may magmas m 2 u saurce a 52 1 5v lhe mm higherman 39u balmy wings 1 m 15 Gene caHs Inn by mm 2 was up mac Avdtzgemoadg znsi gm 393 c vging A m ma curven r handy charge curvam in be ragmaled mg smi swam mm a me baneivs ma 2 t9 mags c251 charge by dalecliivg mm mm ma MAxm usgs nagzuve ans me m is avdissipzimn Tm 9m gigs n in mums waihbia omarmemxngngow w um rim 4 me hnsar WW and me MAXHEEVKW 13 m sushisz cmnzav the swimming Applications aamwmvaa Euuip39nenl szlnv Notebook anszim wCamDuleva mi mmzvi nipso lVIJXIVI NiOdNiMH Battery FastCharge Controllers Features Ordering lnlormatlon minus a TYpIcal operating clicult Mm mngmndedum 4 NM lathy imam emu 0mm Eurp CLLXVWZLLXVW Appendix IV Budget Information Quantity Part Number Description Total 1 MAX603CPA lC LDO REG LOWIQ 5VADJ 8DIP 435 1 CD4541 BE lC PROGRAMABLE TIMER 14DIP 055 1 L7809ABV lC PREC 1A REGULATOR 9V TO 220 049 4 2N5401 BU lC TRANS PNP SS HV 600MA TO 92 052 1 ZFLEXA20114PK A2011 Sensor 4Paok 5999 3 2N6109G PNP Transistor 419 2 MAXMAX712CPE lC BATT FASTCHRG NlCDNIMH16DIP 1542 2 PlC18LF2520lSP lC MCU FLASH 16KX16 28SDP 198 BATTERY NIMH AA 2000MAH 8 HHR210AAB2B WBUTTON 304 2 2465 HOLDER BATTERY 3CELL AA 6quotLEAD 26 4 2N6109G TRANS PNP PWR GP 7A 50V TO22OAB 48 Total Shipping 2419 Total Cost 16728 Project Development Budget Partlist EAGLE Version 416r2 Part Value Device Package BATTERY 36 V RUS02042V 0204V C1 10 uF CPOL USB45181A B45181A C2 10 uF CPOL USB45181A B45181A C3 1 uF CPOL USB45181A B45181A C9 001 uF CUS050024X044 C050024X044 C10 001 uF CUS075042X103 C075042X103 C11 10 uF CUS050024X044 C050024X044 C12 10 uF CPOL USB45181A B45181A D1 1N4001 1N4148 DOS510 DZ1 LZR184 LZR184 LZR184 lC1 MAX712CPE MAX712CPE DlL16 lC2 MAX604 MAX665 DIL08 J1 JACKPLUGO SPC4077 LED1 Yellow LEDLD260 LD260 LED2 Red LEDLD260 LD260 LH1526AB AQW21 AQW21 DIL08 ONOFF 94501 94501 94501 Q1 2N6109 2N6107 TO220 R1 560k RUS02042V 0204V R2 560k RUS02042V 0204V R3 330 RUS02042V 0204V R4 330 RUS02042V 0204V R5 330 RUS02042V 0204V R6 330 RUS02042V 0204V RACON12 RACON12 FKQMBHI PIC18F2520ISP 150309 150309 150309 RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS02042V RUS061315 RUS02042V DI P048 RACON12 RACON12 FQM BI PIC18F2520ISP 1 50309 1 50309 1 50309 Total Cost Device Component List and Total Cost 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v 02o4v P0613H5 02o4v DP04S RACON12 RACON12 FKDMBHI DIL28 3 150309 150309 150309 4800 Appendix V Microprocessor Calibration Code include ltp180xxxhgt include ltpwrnhgt include ltADChgt include lttimers hgt pragma con g WDTOFF pragma con g OSC INTIO7 long int count adciresult long int thresholdA 307 threshold defaults to 15V for Sensor A long int thresholdB 307 threshold defaults to 15V for Sensor B short int rstA l used for setting new threshold in Sensor A short int rstB l used for setting new threshold in Sensor B short int BisOn 0 short int Acount 0 short int Bcount 0 long int buzzCount 0 short loop 0 void beepON int freq OpenTimer2TlMERilNT70FF amp T27PS7171 amp T27POST7171 OpenPWMl freq SetDCPWM10x14D SetOutputPWMl SINGLEioUTPWM7MODE71 void beepOFF void ClosePWMl O void main OSCCON 0b01000010 CLK lMHZ TRISB OXOF 0000 1111 PORTB 0 TRISC 0X8C 1000 l 100 PORTC 0 OpenADCADC7FOSC732 amp ADCiRlGHTiJUST amp ADC7127TAD ADC7CH0 amp ADCilNTioFF 0 open adc port for reading ADCONl OXOO39 set VREF to Pin 4 and VREF to GND VSS ADCONl ADCONl A 0b0111 SetChanADCADC7CH1 Set ADC to Pin 5 whilel check if either of the cal switches are hit if PORTCbitsRC7 H PORTCbitsRC3 Sensor A RC7 puts us into cal for sensorA if PORTCbitsRC7 SetChanADCADC7CH1 Set ADC to Pin 5 ConvertADC perform ADC conversion whileBusyADC wait for result adciresult ReadADCO get ADC result ifthis is the rst cycle we see the switch delete the old threshold value if rstA thresholdA 307 set minimum value avoids incorrect cal rstA 0 reset this value PORTCbitsRCl l calibration light on set the threshold to the maximum value read while cal button is pressed if adciresult gt thresholdA l end of calA thresholdA adciresult Sensor B RC3 puts us into cal mode for sensorB if PORTCbitsRC3 SetChanADCADC7CH0 Set ADC to Pin 2 ConvertADC perform ADC conversion whileBusyADC wait for result dciresult ReadADCO get ADC result ifthis is the rst cycle we see the switch delete the old threshold value if rstB thresholdB 307 set minimum value avoids incorrect cal rstB 0 reset this value PORTCbitsRC4 l calibration light on set the threshold to the maximum value read while cal button is pressed if adciresult gt thresholdB thresholdB adciresult end of calB end of cal mode otherwise we are not in calibration lse Not in calibration so reset rst ags thresholdA 80100 thresholdB 80100 rstA l rstB l Turn off cal lights PORTCbitsRCl 0 PORTCbitsRC4 0 Sensor A SetChanADCADC7CH1 Set ADC to Pin 3 ConvertADC perforrn ADC conversion WhileBusyADC Wait for result adciresult ReadADCO get ADC result turn on relay A if adciresult gt thresholdA neW stu V H PORTCbitsRCO ampamp adciresult gt AisOn l Acount else AisOn 0 Sensor B SetChanADCADC7CH0 Set ADC to Pin 2 ConvertADC perforrn ADC conversion WhileBusyADC Wait for result dciresult ReadADCO get ADC result turn on rela if adciresult gt thresholdB neW stu quot H PORTCbitsRC5 ampamp adciresult gt BisOn l Bcount else BisOn 0 Bcount 0 l buzzer con g if PORTCbitsRC5 H PORTCbitsRCO buzzCount if PORTBbitsRBO ampamp IPORTBbitsRBl buzzer on if AisOn beepON0X67 else if BisOn beepON0X7C else if PORTBbitsRBO ampamp PORTBbitsRBl buzzer on momentary if buzzCount lt 50 if AisOn beepON0X67 else if BisOn beepON0X7C else beepOFFO else beepOFFO else beepOFFO buzzCount 0 l timing con g if PORTBbitsRB2 0 timing delay is off if AisOn PORTBbitsRB4 l PORTCbitsRCO 1 else PORTBbitsRB4 0 PORTCbitsRCO 0 if BisOn PORTCbitsRCS l PORTBbitsRBS 1 else PORTCbitsRCS 0 PORTBbitsRBS 0 l else timing delay is on if PORTBbitsRB3 0 shelter delay if AisOn ampamp Acount gt 50 Technical Communications Engineers need to have a knowledge of what they are talking or writing about and the ability to communicate their knowledge in straightforward reports Know your reader or audience communicate so they can understand but are not bored target your communication to the level of the reader or audience Write or talk with a purpose in mind what do you want the outcome of report or talk to be Avoid the use of excessive technical jargon de ne technical terms your audience may not know Visuals can greatly assist understanding on your part but also communication of an idea or concept to others In technical communications clarity of the communication is always essential Technical Reports Put it in writing 0 Writing helps thinking 0 Types of Technical Reports Proposal presents a solution to a technical problem Progress Report written to inform management customer about the status of a project Final Report informs managementcustomer of the nal result of a project Operating Manual describes use care repair of a product 0 Variation is the application note detailed description of the use of a product could be hardware software process etc Feasibility study analyzes one or more solutions to a problem or assesses multiple opportunities Memosletters 0 Written reports can be both formal or informal Formal Report Structure Title page Table of Contents Abstract or Executive Summary Introduction Body ConclusionsRecommendations References Appendix This is the general organization some variation occurs to meet the requirements of the reader Momentary Pushbutton Switch Implementation with PIC Microcontroller Application Note Cammi Stewa rt ECE 480 Spring 2007 March 30 2007 Executive Summary This application note explains both the hardware as well as the software behind using a momentary pushbutton switch with a PIC peripheral interface controller The hardware portion details the inner workings of a basic pushbutton switch and how it makes contacts with a circuit The software portion details how to handle user input in the PIC programming when the button is pressed Keywords Switch pushbutton actuator PIC bounce debounce Introduction Switches can be used for a variety of applications but their basic purpose is simple Switches denoted by the name are used to make break or change connections in a circuit There are many different kinds of switches Some switches such as sliders when toggled will remain in that position until further intervention Figure 1 These are used to select between multiple contact points to close the circuit Other switches are only temporary when pressed A momentary pushbutton switch contains a spring that returns the actuator to the original position This type of switch can be used when a user wants to use the same switch for multiple triggers C CD 0 O D Slider SPST Slider SPDT Single Pole Single Throw Single Pole Double Throw Circuit closed when slid Circuit closed when slid either way Figure 1 Example of different switch types slider switches Objective This application note explains how a momentary pushbutton switch works and how to implement it with a PIC microprocessor r J Figure 2 Pushbutton Switch Hardware There are two types of momentary pushbutton switches When a momentaryon switch is pressed the circuit is closed it then opens again when the button is released Momentaryoff switches act in a very similar way except the circuit is closed until the button is pressed at which time it opens The following wiring diagramFigure 4 and sample code use a momentaryoff pushbutton but similar logic can be applied to a momentaryon button 40 of Pushbutton Pushbutton Momentary On Mome ry Off Circuit closed when pressed Circuit open when pressed Figure 3 Pushbutton Switches Wiring a pushbutton is very simple There are only two contact pins The pushbutton is connected between two desired contact points In order to toggle a port bit when interfacing with a PIC microcontroller one button pin will be connected to the voltage source and the other will be connected to the PIC input pin as well as the ground The wiring diagram is shown below To PIC 10kg 5V Figure 4 Wiring diagram using momentaryoff pushbutton switch When the button is pressed a bounce also known as a contact bounce or chatter occurs The bounce is a problem that happens due to the materials and construction of the button itself When the contacts are made the current rapidly pulses and oscillates like a sinusoid before it finally sticks at the proper logical value Figure 5 This is a problem because the PIC may receive multiple triggers when the button is only pressed once Logic High K ill Logic Low Figure 5 Button bounce1 There are two methods for correction called debouncing The first approach is to add additional hardware to the circuit Inserting a capacitor across the switch and a pullup resistor will be sufficient When the switch is closed the capacitor is discharged and has no effect When the switch is opened the capacitor takes time to recharge so the bounce has minimal effect on the input to the PIC This approach is easier to implement but costs more due to the additional hardware components The other method to account for bounce uses a software approach After the initial button press a delay is triggered in the code sufficiently long to keep the bounce from being detected This approach is cheaper but the delay must be determined based on the switch model for optimal operation Softwa re There are multiple ways to implement a switch in the PIC programming An inline method using a loop is adequate for simple applications Typically a continuous loop runs until the button is pressed and then the intended action is performed The logic is very simple as outlined below Loop Code PORTBbitsRB7 l PlC input pin Whilel ifPORTBbitsRB7 O delay set time accounts for bounce perform action here 7 l button press l ifPORTBbitsRB7 O delay set time accounts for bounce perform action here 7 2mlbutton press l ifPORTBbitsRB7 O delay set time accounts for bounce perform action here 7 3m1 button press l if another button press recycle Another probably more efficient way to program the PIC to handle a button is to use an interrupt When the button is pressed the interrupt handles the actions to be performed then jumps back to the main code The following code was used to change between three modes on a particular device when the button is pressed This assumes the user accounts for bounce using the hardware method Interrupt Code setup the mode switching button interrupt ConfiglNTlRlSlNGiEDGEilNT amp EXTilNTiENABLE amp EXTilNTiPRliw This interrupt is for the mode selection button void Aiattribute4747interrupt47 ilNTllnterruptVoid switch activeimode case PEAKiMODE activeimode AVERAGEiMODE activeimodeistr quotAVERAGEquot displayinumbercurrentipeak send peak value to Display break case AVERAGEiMODE activeimode lNTEGRATED MODE activeimodeistr quotlNTEGRquot break Implementing Pulse Width Modulation using the PIC18F4520 Bryan Thomas A353451oz October 23 2007 Keywords Pulse Width Modulation Voltage Levels Duty Cycle Analog Control Table of Contents Abm39mt IntvoahLDi on PWMImplemenmll39on PWMAppliLHIY39A my m Useful Figure 2 x ference PWM IS used to regulate the o Abstract The technque ofpulse wldth modulatlon utput Voltage ln a cllcu l tt By changlng the W be adyusted even though the output pulse dlffelent duty cycles The uses of pwm any F0 ate m t out ptoyect PWM Wlll be lmplemented to create vanable r I ftdt calculated By changlng the length of hlgh also known as the duty cycle the areaundeltheslgialcan e mantpulated thhout changing the n H A commg hon the base be dlffelent than the hequenty of the sound comlng from the ball Keeptng thls In mlnd we h Ve declded to make the frequency of the base be undet l klla Introduction Pulse Wldth modulatton ls a technque used to mantpulate the average powet seen at a load By uslng the formulaquot The mlclocontlollel that we are to manlpulate out slgnal golngto the speaket uslng PWM PWM Implementation To ptopetly lmplement PWM lnto out deslgi a reference of the PICISFASZU datasheet had to be made Upon Vlewmg the block dlagtann of the PWM module ccptcontsa nutclue mm Ftme Rczbnvl mm mlscltgt cl Ymnn ccpt mum lamh c Natal mu blmmzwhalmulemled AM nt mm a buck clams amt wagBl new m 1Dhlnw a It can be seen that the PWM telles upon the companson between t e CPR teglstets nghLow TMRZ Tunet 2 and the PR2 Iegls CCPRlL and e T met 2 ptescalet blts e otnnula speclflc to the PICIEFASZO for the duty cycle IS as follows the PWM penod talnngth Usmg e lnyetse wlll glye you the frequency of your slgnal ln otdet to ptopetly utlllze the PWM module on the PICIEFASZO the followlng steps should be taken 1 Conflgute the penod of the PWM b Wntlng the apptopnate value to the PR2 teglstet 2 Conflgute the duty cycle of the P by Wntlng the apptopnate yalue tothe CCP1C0Nlt524gt s e c RN 3 Set the CCPl n s manlpulatlng the appropnate S re Isle 4 Set the Tunet 2 ptescale value 5 Enable Tlmel 2 by Wnung to the TZCON register 5 wtlte tothe CCPl register to enable PWM opetatlon PWM Application Another aspect of the PWM module whlch must be taken Into consldemtlon lst e penod of the slgnal slnnllatlyto the duty cycle calculatlon the PR2 teglstet Tunet 2 ptescalet value and the penod of the osclllatot Tosc The formula fort e PWM penod IS a follows by looklng at Flgute 5 we have 1C In most appllcatlons the PIC wlll ptobably not be able to soutce enough cunent to powet a load When thls IS the case a hanslstol can bep ace m betweent e PIC outputpm and the load In older to boost the current For 0 setup the le4520 can soutce upto ZSmA on any IO pm The Plaza that we are using only dmws a maximum of l 77m l 7 output pm Wll be sufficient Sllmmry Being able to use pulse Width onboaid microconuollei With the datasheet the control we have over the PWM module IS quite good The oonoept of PWM IS relatively simple and With the availability of a PWM module on the it IS a p are p r the extemal sound Circuit that is our de gn ounently In use In the beep baseball The mam purp se fthis sound Circuit IS to output signals at different frequencies which are programmable through the Useful gures t list l tt m Mammum Resolumquot ms lu a V GEE gure 2 Example frequencies with their corresponding resolutions nmmxzx gure 3 Example circui Full bridge output with 4 PWM outpllm troru PIC driving the load suemu 7 Fanadm 4 pumith pus Mister m damn P DMHrHi VF New 1 Yheaimwunbmn is now new 39aws CCP1CDNltD39i3wnf w anvunaaunnv he ewuw 1 A3rdF CS gnabswicnaaor lh endu m m39mwl ismeme assentng mt me39 p39 scs 39va ua ammo ms m Pm E ira s tusth gure 4 Direction change with regards to the four PWM outputs possible operation ruurriug a ruot r AOPin PDIP 4 R5119 EFBD RV kE are my 2 we wuwzwjm 4 paws Mm 5 Vi V irv 5 RES A JE CC RMTECKW CIDUT r REEIMTANS RAEJAWE HL nmzom 7 Rawmmma ammmi H a c c RBZJ NTQ FJMMZ quot 9 2 V3 19 z a a a PM Outputs F 39 g g 3me w L L QCDH CISD IZCIz 5 RCi TVOEL CCO quot E RCZJCCP L FTA H 7 a S L v RDDFSC E amps Figure 5 PWM Output pin locations on the PIC 18F4520 mme Figure 6 Our speci c application of dliving a Piem buzzer with PWM Sound Circuit Samuel Davis Team 1 November lSt 2007 Executive Summery The sound circuit for the base is similar to the one in the base ball It will consist of a boost converter and a single frequency piezo buzzer We will drive it with a signal from the PIC run through a boost converter This will produce the sound at the designated level Keywords CEPl l 14 Boost Converter Buzzer Sound circuit Introduction Piezo based sound circuits differ from speaker base ones in two main points Sound variability and power consumption during operation are quite different between the two types of sound circuits In a piezo the sound frequency is usually set as is the volume Only real way to alter it is to limit the voltage given to the piezo so that it doesn t operate at full capacity Thus reducing the sound output The power consumption from a piezo is much less then a traditional speaker because it uses less force to move the diaphragm of a buzzer then that of a traditional speaker The voltage used in a piezo is high then the rest of the circuit in use so we must boost it Objective To explain how we will be implementing the buzzer in our design Also to show how a buzzer can be used as a more efficient replacement for a speaker that would be driven with a single frequency Design and Analysis For our sound circuit we are using a piezo in this case the CEPlll4 and a boost converter as well as the supporting units The boost converter will be used so that we can power the piezo properly Most of our system runs at 3 volts but the buzzer requires significantly more This means that we are forced to find a way to get more power The best way to achieve that for us is to use a boost converter to up the voltage about ten times This will give ample power to run the buzzer in a way that will be loud enough to be heard by the batter The chip that we will be using is going to be the same as that of last semester s team the MAX5026 Since we have the sound circuit designed from last semester it means that the calculations for us are signi cantly reduced We are planning to have a variable frequency in this project This will make the base easier to hear since a changing sound is easier to here then a steady one In making the sound circuit we originally were going to have the sound circuit built into the main board Our other option was to have a main board that powered andor switch the sound circuit on and off This is what we have decided to do This is for two reasons It means that instead of having to have three different boards to make one for the ball one for the base and one for the remote We instead are using only two boards a control board and a soundboard This is so that the manufacturers can make only 2 boards and the program them as needed High frequency sound with a manual switching system for the ball a transmitter board for use in the base remote and a pair of boards for the base a low frequency soundboard and a receiver board We will be using BJT to switch the soundboard for the base because it is reliable and able to be switched by a low voltage in this case 3 volts and able to pass through the 9 volts for the sound circuit Though this is a simple design it is done for important reasons and will be durable long term This also will allow us to have a way to add charging ability to the base by use of the charging circuit already in the ball Results Well for our design we will basically be having the PIC output a command to activate the sound generator This signal will trigger the BJT that we are using as our relay to turn on the power for the previous sound circuit This is being done as a way to Controlling a 7 Segment Display Using a PIC Microcontroller and 7 Segment Driver VINOD NATLA 1 1072008 Application Notes Team I Executive Summary One universal requirement for most of the digital devices is an image numeric display A seven segment display which is also known as seven segment indicator is an electronic device that are used to display decimal values These devices are used in digital meters digital clocks watches house hold appliances and other electric parts for displaying numerical information These are implemented in many circuit applications to perform a desired task This application note will describe how to design a circuit to display the any of the ten decimal digits from 0 7 9 using a PIC microcontrollers and drivers 1 Keywords Dual digit 7 segment Display 18f4520 PIC Microcontroller BCD to 7 7 segment driver switch Objective The purpose of this document is for the reader to get familiar on how to operate dual digit 7 segment display using a microcontroller with the help of driver This document will help to identify the pins of parts and design will be discussed along with some factors that should be taken into account Introduction An 18f4520 PIC microcontroller is used to display decimal values on the 7 segment display Using the data pins on the PIC we can send the information to driver data pins to display the decimal values as an output Hardware Before I explain the design process I want to discuss about the parts that I will be using and their pin structure m run h n hm but the basre xdea of funeuonahty rs same for all the parts The pans you rnrght be usmg may have ddfferent pm strueture so rt would be good xdea to eheek the datasheet to 1dennfy the nght pms before you start wrth your desrgnrng proeess 1n thrs partreular example 1 used a LDDrCSMRI dual dgrt 7 segrnent dsplay Fouowrng preture shows detaued rnforrnauon about the pms a Dual Digit 7 Segment Display 2 PWIS DIGITFA PmlerIGlTZrA PWIS DIGITFB meeDIGIrzeB PWE DIGITFC meemcrrzec szeDIGIrleD PmoeDIGrrzeD PWI DIGITFE PmseDIGIrzeE PWIS DIGITFF PmlzeDIGrrzeF PmneDIGIrleG pmmmcrrzec PmAeDIGIr 1 7 1st Deerrnalpornt pmoDIGn22nd Denmalpom PJN 147DIGIT 1 7 Ground PJN 137DIGII27 Ground Internal strueture Wmng ofthe above rnentroned dual 7 segrnent dsplay In other words funetronsd ddagram u thle mun t3 mm 11 m7 AEJDEFEDP tuwuz tat39t n wt uusvztc For more information regarding to voltage and current measurements follow the data sheet 2 httpwwwlumeXcompdfLDDCS l4RIpdf b 18f4520 PIC lVIicrocontroller 40 Pm PDIP MCLRNDPIRE3 4 1 1 V 40 3H RE7KEI3WGD AND lt gt 2 39 I H RBGIKEIZ PGC RM 1 E 3 33 RBSIKBIIPGM RAllANZ VREFn C 4 37 j lt RB4IKED AN11 RA3AN3139VREF RAATOCKImOUT H E zMi r der SiSe39HLVDINCZO JT H 1 RE Ri quot AN3 j H Realmscam j H REZINTZ ANE j H stmnmm H RsmINTmFLmAmz j c j H V35 wumu AN6 1 REZICS AW H 10 Vng 439 I 11 a PC18F4420 PIC1BF4520 12 oscwcmurw H E 13 OSCZICLKOJ RAIS H I 14 I Rcumosomzcm H E 15 j H RC7JRXJDT RC1IT1USL CCF 2m H5 15 RCZJCCPVFTA H 17 Heyscmsa H E a 1 DH1g j RFAISDUSDA j H RD3 PSPE RD1JPSF 1 H1 28 21 j RDZ PSF Z The data sheet and some basic information and sample programs can be found at the following website This website will provide detailed information on the pin structures and also tells us how to use MPLAB software to program the PIC 3 httpwww egr msu ed 39 180 J Fun quot 39 39 I ah ndf c BCD t0 7 segment latchdecoderdriver The driver used in this example is HEF4543B These driver acts as a mediator between the PIC and the display It takes binary information from the PIC and helps to output a decimal number on the display In other words it converts the binary value to decimal value Following picture shows detailed information about the pins Ea 39 b bl I BREE 1 u m u 15 u Fm 1 7 LD 7 Latch msahle Input7 cemeeted tn VDD Fm a 7 PH 7 Phase mput 7 Fur this example we esh geuha this pm Fm 7 7 B17 Blanking Input 7 Fur this example we esh gmuha this pm Fm a 7Vss 7cm Fm 9 7 Pm 15 7 Output data pms Each quhese pms Will he eumeetea tn 7 segment hhsplsy seeermhgly Fm 15 7W1 Fm mure mfurmanun hegsmhg tn vultage and emeht measurements chew the data sheet 4 De g nmcess Use pun D pms tn hensmtt the data tn drivers We need 4 plus hum pun D D mspley ans 1 w ufpun D The no sends the data m a 4 bit hmary farm tn the denuder tn display the mspley the number an the 7 stagnant display all the maepehaeht uutputs are euhheetea tn the denuda zppmpnately Use the mu uhm res urs betwem dnva39 and display D have a hhght may Fm clear understanding ufwmng luuk atthe picture prumded beluw We use the same method to display more than two digits the only concern could be we will be using most of the IO pins on PIC This could be solved by using a multiplexer In this case PIC will output the binary number and the multiplexer will activate the driver to display the appropriate digit on user s choice In this example we used Vdd as 5v and Vss is GND It would be easy and good if you follow the color code while doing the wiring This helps you to gure out if there are any problems in your circuit Once you are done building the circuit you have to write the program for the PIC to display the numbers You could also use a switch to control the numbers The switch could be connected to Port B In our 480 project we used this display for the user to input the length that could be viewed on the display to cut the material Wiring DiagIam PIC1HF4420 PIC1HF4520 F454 B HE Hertsase Software This program will display the numbers upto 17 on the multi digit 7 segment display using a switch Every time you press a switch the number will increment by 1 include ltp180xxxhgt include lttimers hgt pragma con g WDTOFF pragma con g OSC INT1067 long int count int valueonestenthsteenicountloopaddress void main TRISA 0X00 TRISB OXFO TRISC 0X01 TRISD 0X00 TRISE OXF ones 0 tenths 0 teenicount 0 address OXOC PORTDbitsRDO PORTDbitsRD2 PORTA OXOC PORTB 0X01 PORTC 0X00 PORTD 0X00 While1 value ones16 tenths PORTD value 00 Wh l I F ifPORTBbitsRB5 0 INCREMENT VALUE BLOCK ones teenicount forc ount1 countlt4000count ifones 10 ones 0 PORTBbitsRB3 l I ifteen7count 18 I ones 0 teenicount 0 PORTA 0X06 PORTD ones16 tenths PORTBbitsRB3 039 I END INCREMENT VALUE Tenths Inches ifPORTCbitsRCO 0 I INCREMENT VALUE BLOCK tenths forc ountl countlt4000count iftenths 10 I tenths 0 PORTA 0X06 I END INCREMENT VALUE PORTD ones16 tenths Recommendations Rather than using 4 data pins on the PIC for each driver We could use a demuX to send the data to all the drivers This could take 6 pins on the PIC 4 pins to transmit the binary data to driver to display the number and two pins to select the driver This only disadvantage of this programming part gets little bit complex compared to the other Conclusions 7 segment displays can be used in most of the electronic instruments residential appliances and other electric parts for displaying numerical information This application note describes how to use a PIC and a driver to display a desired numbers on the 7 segment display