14
2017 Microchip Technology Inc. DS00002281A-page 1 AN2281 INTRODUCTION This application note describes ultrasonic proximity detection using PIC ® microcontroller Core Independent Peripherals (CIPs). The flexible control capabilities of Microchip’s PIC16F176X 8-bit microcontroller allow ultrasonic proximity detection of a person or an obstruction in an area with minimal software overhead. BLOCK DIAGRAM Figure 1 shows the block diagram of an ultrasonic proximity detector based on a PIC16F176X family microcontroller. The CIPs used in the design are: Data Signal Modulator (DSM) Configurable Logic Cell (CLC) Hardware Limit Timer (HLT) Comparator (CMP) Operational Amplifier (OPA) These CIPs are combined with on-chip peripherals, such as Analog-to-Digital Converter (ADC), Timers and Pulse-Width Modulation (PWM) to make the ultrasonic proximity detector a self-contained presence device with minimal component count. FIGURE 1: BLOCK DIAGRAM Authors: Kristine Angelica Sumague Heather Savage Keith Curtis Anthony Stram Microchip Technology Inc. PWM3 TMR0 Logic Controlled Driver TMR3 Transmitter Transmitter Signal TMR1 HLT4 ADC HLT6 CLC2 R S Q CLC1 Q R S OPA2 + - VREF Receiver R4 R5 R7 Reciever Amplifier OPA1 - + R6 C5 D1 Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q PIC16F1769 Microcontroller Receiver Signal Timer With Integrator Circuit R9 Ultrasonic Proximity Detection

AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

Embed Size (px)

Citation preview

Page 1: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281Ultrasonic Proximity Detection

INTRODUCTIONThis application note describes ultrasonic proximitydetection using PIC® microcontroller Core IndependentPeripherals (CIPs). The flexible control capabilities ofMicrochip’s PIC16F176X 8-bit microcontroller allowultrasonic proximity detection of a person or anobstruction in an area with minimal software overhead.

BLOCK DIAGRAMFigure 1 shows the block diagram of an ultrasonicproximity detector based on a PIC16F176X familymicrocontroller. The CIPs used in the design are:

• Data Signal Modulator (DSM) • Configurable Logic Cell (CLC)• Hardware Limit Timer (HLT)• Comparator (CMP) • Operational Amplifier (OPA)

These CIPs are combined with on-chip peripherals,such as Analog-to-Digital Converter (ADC), Timers andPulse-Width Modulation (PWM) to make the ultrasonicproximity detector a self-contained presence devicewith minimal component count.

FIGURE 1: BLOCK DIAGRAM

Authors: Kristine Angelica SumagueHeather SavageKeith CurtisAnthony StramMicrochip Technology Inc.

PWM3

TMR0

Logic Controlled

Driver

TMR3

TransmitterTransmitter Signal

TMR1

HLT4

ADC

HLT6

CLC2R

SQ

CLC1 QR

S

OPA2+

-

VREF

Receiver

R4

R5

R7

Reciever Amplifier

OPA1-

+

R6 C5D1

Peak Detector

DSMHCar

Mod

Q

R2C4

C8

R11

CLC3R

SQ

PIC16F1769 Microcontroller

Receiver Signal Timer

With Integrator Circuit

R9

2017 Microchip Technology Inc. DS00002281A-page 1

Page 2: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

THEORY OF OPERATION

FIGURE 2: ULTRASONIC PROXIMITY DETECTION OPERATION

Figure 2 depicts how ultrasonic proximity detectionworks. An ultrasonic pulse train containing multiplepulses that runs at ultrasonic frequency is generatedduring transmit period. After the transmission of thepulse train, the energy of the incoming reflected signalin the receiver is averaged over time to get the acousticfingerprint of the room. The resulting average isconverted by the ADC to get its digital representation.The primary result acquired from the ADC will be thereference point to derive the ultrasonic proximitythreshold. Once the threshold has been established,the successive ADC result will be compared to it. Whenthe current ADC result is greater or less than the presetthreshold, the proximity will be triggered. This isbecause any people or obstruction in the room willchange the acoustics, specifically it will change thereflection and absorption of the sound. As such, theresulting integration of energy in the receiver alsochanges, as does the ADC result.

Aside from detecting the presence of an obstructionwithin the area, it can also measure the distance rangebetween a particular obstruction and the detector. Thisis made possible by averaging the returned energy atdifferent bands, with one foot resolution, whilecontinually comparing its result to the presetthresholds. For this application, it is important to notethat the band refers to a particular distance range thatthe ultrasonic proximity enables its detection to detectthe presence of an obstruction within the area.

DS00002281A-page 2 2017 Microchip Technology Inc.

Page 3: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

The interaction of the peripherals used for thisapplication is shown in Figure 3.

FIGURE 3: ULTRASONIC PROXIMITY TIMING DIAGRAM

Figure 3 depicts the operation of the PIC16F1769 CIPsand on-chip peripherals. The PWM generates thespecified frequency to drive the ultrasonic transmitter.This PWM is tied to the carrier input while the CLC1 istied to the modulator input of the DSM. The CLC1 isconfigured to operate as an SR flip-flop with its set andreset inputs controlled by Timer3 and Timer0,respectively. The CLC1 connects and disconnects thePWM to the output pin through the DSM to generate apulse of ultrasonic wave. The CLC1 output is alsoconnected to the HLT4 and to the reset input of theCLC2 SR flip-flop. The HLT4 operates as a one-shottimer and is tied to the CLC2 set input. When the HLT4times out, the CLC2 output will be set which triggers theHLT6 gate and enables the OPA2 integrator throughCLC3.

Effectively, the CLC3 is controlled by a mono-stableHLT6 with its input tied to CLC2. When the signal isreceived and amplified by the OPA1, the peak detectorwill pass the measure of the energy to the integrator foraccumulation. When Timer1 overflows, it will trigger theADC conversion which samples the output of theintegrator. The digital representation from the ADCconversion will be compared to a preset threshold. Ifthe ADC result is greater or less than the presetthreshold, proximity is detected. But, if it is within thepreset detection threshold, then the process isrepeated.

CLC1

CLC2

TMR3

TMR0

DSM1

HLT4

HLT6

CLC3

OPA1

OPA2

TMR1

PWM

ADC

0 to 1 ft detection 1 to 2 ft detection

2017 Microchip Technology Inc. DS00002281A-page 3

Page 4: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

TRANSMISSION OF AN ULTRASONIC PULSEOnce power is supplied to the ultrasonic proximitycircuit and the VDD is high enough (usually theminimum VDD of the microcontroller), Timers, ADC,CLCs, PWM, DSM, Comparator, EUSART and OPAare initialized. After initialization, the DSM emits anultrasonic pulse train which contains multiple pulsesrunning at 40 kHz.

The 40 kHz drive signal of the ultrasonic devices canbe easily created in a PIC microcontroller with nosoftware overhead. As shown in Figure 4, theinterconnection of the PWM output and CLC1 output tothe DSM and the interconnection of the TMR0 outputand TMR3 output to CLC1 creates the ultrasonic pulse.The CLC1 is periodically set by Timer3 and reset by theTimer0 when the specified number of PWM pulses hasbeen reached. CLC1 effectively sets the period of theultrasonic pulse. This means that the duration of timethat PWM pulses are output through the DSM outputpin depends on the CLC1 state. When the CLC1 is low,the PWM is disabled on the DSM output and when theCLC1 is high, the PWM is enabled on the DSM output(see Figure 5). This implies that DSM effectivelymodulates the PWM pulses with CLC1 output.

FIGURE 4: MCP14E8 CIRCUIT CONFIGURATION

FIGURE 5: TRANSMISSION SIGNAL

Note: Ultrasonic devices should be driven asclose as possible to their specified fre-quency to maximize the output power.

PWM3DSM

TMR0CLC1

TMR3

PIC16F1769 Microcontroller Transmitter

R

SQ

Mod

HCarQ

ENB_A ENB_BIN_A

IN_BMCP14E8

OUT_A

OUT_B

DS00002281A-page 4 2017 Microchip Technology Inc.

Page 5: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

The pulse train emitted by the DSM is amplified by thelogic controlled driver MCP14E8YM. Microchip’sMCP14E8YM has enable pins (ENB_A and ENB_B) toindependently control its inverting and noninvertingoutputs (OUT_A and OUT_B), respectively. Table 1summarizes the operation of the MCP14E8YM. For thisapplication, the input pins (IN_A and IN_B) of theMCP14E8 are connected to the CLC1 while ENB_Aand ENB_B are connected to the DSM, as shown inFigure 4. This configuration produces a differentialdrive to the ultrasonic transducer. By driving the pins ofthe ultrasonic transducer that has opposite state andchanging its state at the same time ensures the 40 kHzdrive and prevents jitter.

ULTRASONIC PROXIMITY BAND SELECTIONAfter the ultrasonic pulse train is created, the next taskbefore receiving the returned signal is to select theband to be evaluated by the ultrasonic proximity. Forthis application, it is important to note that a band refersto a particular distance range within which theultrasonic proximity detector can detect an obstructionin the area. This is made possible by adding HLT4,CLC2, HLT6 and CLC3 in the design. The HLT4 periodchanges over time with each transmitted ultrasonicpulse. The HLT4 period increments its value to a countcorresponding to the starting distance of the band, asshown in Figure 6. This means that as the value of theHLT4 period increases, the distance associated withthe band also increases. When transmission of theultrasonic pulse ends, and CLC1 transitions from set toreset, it triggers the HLT4 timer. When HLT4 times out,CLC2 is set, enabling the HLT6 that automatically setsthe CLC3 output. The period of the HLT6 is keptconstant because it serves as the band resolution to beevaluated by the ultrasonic proximity. When HLT6times out, CLC3 is reset. The CLC3 output statecontrols the operation of the OPA2 integrator circuit.This implies that when the CLC3 is set, the OPA2integrator circuit is enabled. Hence, when CLC3 isreset, OPA2 is in the Tri-state mode.

FIGURE 6: BAND SELECTION TIMING DIAGRAM

TABLE 1: MCP14E8 ENABLE PIN LOGICENB_A ENB_B IN_A IN_B OUT_A OUT_B

H H H H L HH H H L L LH H L H H HH H L L H LL L X X L L

2017 Microchip Technology Inc. DS00002281A-page 5

Page 6: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

RECEIVING AN ULTRASONIC PULSEAs the ultrasonic signal propagates in the air during thetransmission, the intensity of the signal decreases withdistance due to air absorption and beam spreading.Thus, the returning sound wave obtained by thereceiver is significantly attenuated. To alleviate thisproblem, signal amplification is necessary to detect thereturned signal. This amplification can be achievedusing a single on-chip op amp, as shown in Figure 7.This OPA circuit amplifies the voltage across theultrasonic receiver connected between the two inputpins (VIN+ and VIN-).

FIGURE 7: DIFFERENCE AMPLIFIER CIRCUIT

The resulting voltage from the amplifier circuit will bepassed to the peak detector circuit, as shown inFigure 8. The peak detector circuit measures themaximum magnitude of a signal over a period of time.When the input signal on the peak detector is rising, D1is forward biased and C5 charges rapidly to thedifference of VAMP and D1 voltage drop. When the inputsignal is falling, D1 becomes reverse biased, and theC5 stored charge releases slowly through R6. Thedischarging of C5 continues until the VAMP becomesgreater than the C5 charge. When VAMP is greater thanthe voltage across C5, D1 conducts again and theprocess is repeated (see Figure 9).

FIGURE 8: PEAK DETECTOR CIRCUIT

FIGURE 9: PEAK DETECTOR OUTPUT WAVEFORM

The output of the peak detector (VPEAK) is tied to thenoninverting integrator circuit to average the returnedultrasonic signal. Figure 10 shows the noninvertingintegrator configuration. It is obtained when the valuesof the resistors and the values of the capacitors areequal. This means that the two time constants in anoninverting integrator (R2, C4 and R11, C8) shouldmatch.

The output of the noninverting integrator can becalculated using Equation 1.

EQUATION 1: NONINVERTING INTEGRATOR OUTPUT

FIGURE 10: NONINVERTING INTEGRATOR CIRCUIT

R4

R5

R7

-

+

OPA1VR IN+

VR IN-

PIC16F1769

VAMP

VREF

R9

R6C5

D1VAMP VPEAK

VAMP

VPEAK

VINT1RC-------- V PEAK td=

OPA2+

-

C4

C8

R11

R2VPEAK

R11 = R2 C4 = C8

DS00002281A-page 6 2017 Microchip Technology Inc.

Page 7: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

FIGURE 11: NONINVERTING INTEGRATOR OUTPUT

The noninverting integrator circuit is only active during acertain period of time. From the previous discussion inUltrasonic Proximity Band Selection section, OPA2 isonly enabled during the band duration. This bandduration depends on the CLC3 operation. The time thatthe CLC3 is high is the time that the ultrasonic proximityband is active. When CLC3 becomes high, OPA2 startsto integrate the returned ultrasonic signal. At the sametime, the TMR1 starts to increment. When TMR1interrupts and CLC3 transitions from high-to-low, theADC conversion will be triggered and OPA2 will be tri-stated, respectively (see Figure 11). The ADC convertsto its digital representation the integrated voltage of thepeak detector. When OPA2 is tri-stated, the capacitorswere able to discharge its stored energy. This digitalvalue is compared to the ultrasonic proximity threshold.When the ADC value exceeds or is behind thethresholds, the proximity is triggered. When the ADCvalue is within the thresholds, the ultrasonic proximitycontinues its process.

Note: The obstruction being detected must staywithin the detectable area for at least 450ms for a reliable detection. This is theamount of time the ultrasonic proximitysensor completes a whole room scan.

2017 Microchip Technology Inc. DS00002281A-page 7

Page 8: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

ULTRASONIC PROXIMITY DETECTION FIRMWARE

FIGURE 12: FIRMWARE FLOWCHART

Figure 12 shows the flowchart of the ultrasonic proxim-ity detection firmware. During start-up, the firmware ini-tializes and establishes the connections of theperipherals. After peripherals initialization, the ADCchannel is selected, the firmware captures the finger-print of an area. Capturing the fingerprint of an area isdone by saving the sum and the difference of the ADCresult value and the predefined marginal error toADCReferenceMax[ctr] and ADCReference-Min[ctr], respectively, in every distance band. Thevalue of the ctr indicates the location of the band in thepredefined array values (see Section Appendix A:,Constants Used in the Firmware). It increments until allband location has its equivalent thresholds. When the

firmware already established the thresholds in everyband, the ctr variable is cleared and the firmwareenters the infinite loop.

START

Initialize peripherals and capture the fingerprint

of an area

Is TMR3

interrupts?

Is TMR4

interrupts?

Is TMR1

interrupts?

1. Change TMR4 Periodfor every ctr increment2. Reload TMR03. Start TMR44. Clear TMR3 interrupt

1. Reload TMR12. Start TMR13. Clear TMR4 interrupt

1. triggers the ADCconversion 2. DisplayResult = 13. Stop TMR14. Clear TMR1 interrupt

Get ADC ResultClear DisplayResult

Is ADC Result > ADCReferenceMax[ctr]

or ADCResult < ADCReferenceMin[ctr]?

Display Band locationClear ctr

Increment ctrWhen ctr =9; then

Display “no detection” and clear ctr

Yes No

Wait for interrupt to occur

AA A

A

No No No

Yes Yes Yes

DS00002281A-page 8 2017 Microchip Technology Inc.

Page 9: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

In this infinite loop, the firmware continuously evaluatesthe obstruction in the area. The firmware waits until thereturned signal has been averaged. When theaveraging of the signal is done, the TMR1 interrupts theCPU, which sets the DisplayResult variable andtriggers the ADC to convert the resulting average to itsdigital representation. When DisplayResult is set, itgets the ADC result and compares it to theADCReferenceMax[ctr] andADCReferenceMin[ctr] thresholds, then it clearsDisplayResult. When the ADC result is within theband thresholds, the ctr value increments to detectchanges in the other band locations. If there is nogreater difference on the ADC result with respect to thethresholds until the maximum band location, thefirmware displays “No detection” and clears the ctrvalue and repeats the process. But, when the ADCresult is greater than or less than the thresholds, itmeans that an obstruction is present that causeschange in acoustics reflection and absorption in thearea. The firmware clears the ctr value and displays theband location of the obstruction and repeats theprocess.

Additionally, there are several service routines (ISRs)that are automatically executed when certain criteriahad been met:

1. TMR3 interrupt – Executed periodically toinitiate the transmission of the ultrasonic pulsetrain. When the TMR3 interrupts, it changes theTMR4 period for every ctr value increment. Atthe same time, it reloads the TMR0 value,enables the TMR4 HLT and clears the TMR3interrupt.

2. TMR4 interrupt – Executed when the HLT one-shot times out. When the TMR4 interrupt occurs,it reloads the TMR1 value, starts TMR1 andclears the TMR4 interrupt.

3. TMR1 interrupt – Executed at every end of theband. It serves as the trigger for the ADC’s auto-conversion. When the TMR1 interrupt occurs, itsets the DisplayResult variable, stops TMR1and clears the TMR1 interrupt.

It should be noted that after initialization, the evaluationof the obstruction is dependent on the ISRs. This isbecause the CIPs, which are configured to control theoperation of the ultrasonic proximity detection, performtheir tasks independently. As a result, the complexity ofthe firmware is reduced.

All peripherals used in the firmware are configured andinitialized using the MPLAB® Code Configurator(MCC).

Note: The source code of this application note isavailable from the Microchip website(www.microchip.com).

2017 Microchip Technology Inc. DS00002281A-page 9

Page 10: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

APPENDIX A: CONSTANTS USED IN THE FIRMWARE

Table A-1 summarizes the corresponding value of theHLT4 when the ctr variable increments. Thecorresponding HLT4 period value is initialized in theProximity.c file.

TABLE A-1: FIRMWARE CONSTANTS FOR BAND LOCATION

CTR value

Constant Declaration

HLT4 period value

Corresponding Distance of the

Band

0 Range_12 0x00 0 to 1 foot1 Range_24 0x1B 1 to 2 feet2 Range_36 0x36 2 to 3 feet3 Range_48 0x52 3 to 4 feet4 Range_60 0x6E 4 to 5 feet5 Range_72 0x89 5 to 6 feet6 Range_84 0xA5 6 to 7 feet7 Range_96 0xC1 7 to 8 feet8 Range_108 0xDD 8 to 9 feet

DS00002281A-page 10 2017 Microchip Technology Inc.

Page 11: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

2017 M

icrochip Technology Inc.D

S00002281A

-page 11

AN

2281

AP

FIG

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

��

��!�!&'#

��

�#�

(�#�

!)2)�

��

!)2)�

��&�

��

&�

�������

�����

���

��-

�2�1+��

���

���� ���

����

��,�����3��

���3�&

��,�!

���$

���,� �

����

���,�

����!�&���#�

��

�� �%

!�*:

%����

�� �%

!�*:

�����

PENDIX B: ULTRASONIC PROXIMITY SCHEMATIC

URE B-1: ULTRASONIC PROXIMITY SCHEMATIC

���

���

����

����

����

����

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

��

��

��� !�

��

�"�#���������

��

���! $

��#�

��"���������������%

��

����&

�� ����(�����(��#�#����"������#��������#����"(�� �)��!���������#�#����#����"��#����"(��� �������$�(���#����*���"����� �

�� ����+����+����(������ ���!����������������"���� �����������������,����������������-�����!�������������������� ���"���� !

��$���&����������##

������)��������- $

���������-��!���-��( ���$������-������-�#�"�#�( &�� �������������-��% )��!���������������#���#�� ��

������$�������������������������-���������������������������� �������� �����!������!�(���"���� ��������!������-��!���-�� �(� ��

��������.������(������������� �!�����������+-�������!��+-�����!�������#��"( � ���������/�0��������!��+��������!����������-������-���#���� �$

�##��

������

����$+��$)����"

���

���

��

��� !

� �

��1+���

� ��2�1+ ��

� �

���

�2�1+��

�1+���

!���

���

�������

���

�2�1+ ��

��

���

���

���

��

#��

�##�$

��# �)

��� ���� &

��� )

��� ��

��! ��

�� ��

��$�#�" ��

����#� �!

������

����-�&

������)

����-��

����-��

�������

����

���!��� �!�$� ��

�&$ �&

�� �

��# �

���# �

�� !

��'3�'�

���3� $

����

�� ��

(��� �-��

�����&$!+#��

"���

"��,�����&$!+#��

�1+�$�

��

���

��'��,�2 44

5�

���

�2�1+���

��

�2�1+

�"��

�"���#�

�#�

����

����

�����6+��

�����

�����6+��

���(

���

���

��#�

#�(

�#���

����

�����-��-

�������

2���

!�1+�$�

��!�1+�$�

���

��

��

��

� ���(

��-

-)���

"����

���

���

���� ���

�������

�1+ �$�

���

�1+�$�

��

�1+�$�

���

�1+�$�

���

�1+�$�

���

�1+�$�

���

�1+�$�

���

�1+�$�

���

�1+�$�

���

#�,#������

�,7#�"��8

�,7��#*��8

+�������

���%����

�����

��#�����

5#������#�9�

$

!

��

��

��,)�,����,��#

$�$

�-

��,)�,����,���

$�

��

������ ����

��

Page 12: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

AN2281

NOTES:

DS00002281A-page 12 2017 Microchip Technology Inc.

Page 13: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

Note the following details of the code protection feature on Microchip devices:• Microchip products meet the specification contained in their particular Microchip Data Sheet.

• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.

• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.

• Microchip is willing to work with the customer who is concerned about the integrity of their code.

• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”

Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of ourproducts. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such actsallow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.

Information contained in this publication regarding deviceapplications and the like is provided only for your convenienceand may be superseded by updates. It is your responsibility toensure that your application meets with your specifications.MICROCHIP MAKES NO REPRESENTATIONS ORWARRANTIES OF ANY KIND WHETHER EXPRESS ORIMPLIED, WRITTEN OR ORAL, STATUTORY OROTHERWISE, RELATED TO THE INFORMATION,INCLUDING BUT NOT LIMITED TO ITS CONDITION,QUALITY, PERFORMANCE, MERCHANTABILITY ORFITNESS FOR PURPOSE. Microchip disclaims all liabilityarising from this information and its use. Use of Microchipdevices in life support and/or safety applications is entirely atthe buyer’s risk, and the buyer agrees to defend, indemnify andhold harmless Microchip from any and all damages, claims,suits, or expenses resulting from such use. No licenses areconveyed, implicitly or otherwise, under any Microchipintellectual property rights unless otherwise stated.

2017 Microchip Technology Inc.

Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.

QUALITY MANAGEMENT SYSTEM CERTIFIED BY DNV

== ISO/TS 16949 ==

TrademarksThe Microchip name and logo, the Microchip logo, AnyRate, AVR, AVR logo, AVR Freaks, BeaconThings, BitCloud, chipKIT, chipKIT logo, CryptoMemory, CryptoRF, dsPIC, FlashFlex, flexPWR, Heldo, JukeBlox, KEELOQ, KEELOQ logo, Kleer, LANCheck, LINK MD, maXStylus, maXTouch, MediaLB, megaAVR, MOST, MOST logo, MPLAB, OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, Prochip Designer, QTouch, RightTouch, SAM-BA, SpyNIC, SST, SST Logo, SuperFlash, tinyAVR, UNI/O, and XMEGA are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

ClockWorks, The Embedded Control Solutions Company, EtherSynch, Hyper Speed Control, HyperLight Load, IntelliMOS, mTouch, Precision Edge, and Quiet-Wire are registered trademarks of Microchip Technology Incorporated in the U.S.A.

Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BodyCom, CodeGuard, CryptoAuthentication, CryptoCompanion, CryptoController, dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial Programming, ICSP, Inter-Chip Connectivity, JitterBlocker, KleerNet, KleerNet logo, Mindi, MiWi, motorBench, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PureSilicon, QMatrix, RightTouch logo, REAL ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI, SuperSwitcher, SuperSwitcher II, Total Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock, Wireless DNA, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.

Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.

GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries.

All other trademarks mentioned herein are property of their respective companies.

© 2017, Microchip Technology Incorporated, All Rights Reserved.

ISBN: 978-1-5224-1437-7

DS00002281A-page 13

Page 14: AN2281 - Ultrasonic Proximity Detectionww1.microchip.com/downloads/cn/AppNotes/cn594785.pdf · Peak Detector DSM HCar Mod Q R2 C4 C8 R11 CLC3 R S Q ... ULTRASONIC PROXIMITY DETECTION

DS00002281A-page 14 2017 Microchip Technology Inc.

AMERICASCorporate Office2355 West Chandler Blvd.Chandler, AZ 85224-6199Tel: 480-792-7200 Fax: 480-792-7277Technical Support: http://www.microchip.com/supportWeb Address: www.microchip.comAtlantaDuluth, GA Tel: 678-957-9614 Fax: 678-957-1455Austin, TXTel: 512-257-3370 BostonWestborough, MA Tel: 774-760-0087 Fax: 774-760-0088ChicagoItasca, IL Tel: 630-285-0071 Fax: 630-285-0075ClevelandIndependence, OH Tel: 216-447-0464 Fax: 216-447-0643DallasAddison, TX Tel: 972-818-7423 Fax: 972-818-2924DetroitNovi, MI Tel: 248-848-4000Houston, TX Tel: 281-894-5983IndianapolisNoblesville, IN Tel: 317-773-8323Fax: 317-773-5453Los AngelesMission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608New York, NY Tel: 631-435-6000San Jose, CA Tel: 408-735-9110Canada - TorontoTel: 905-695-1980 Fax: 905-695-2078

ASIA/PACIFICAsia Pacific OfficeSuites 3707-14, 37th FloorTower 6, The GatewayHarbour City, KowloonHong KongTel: 852-2943-5100Fax: 852-2401-3431Australia - SydneyTel: 61-2-9868-6733Fax: 61-2-9868-6755China - BeijingTel: 86-10-8569-7000 Fax: 86-10-8528-2104China - ChengduTel: 86-28-8665-5511Fax: 86-28-8665-7889China - ChongqingTel: 86-23-8980-9588Fax: 86-23-8980-9500China - DongguanTel: 86-769-8702-9880 China - GuangzhouTel: 86-20-8755-8029 China - HangzhouTel: 86-571-8792-8115 Fax: 86-571-8792-8116China - Hong Kong SARTel: 852-2943-5100 Fax: 852-2401-3431China - NanjingTel: 86-25-8473-2460Fax: 86-25-8473-2470China - QingdaoTel: 86-532-8502-7355Fax: 86-532-8502-7205China - ShanghaiTel: 86-21-5407-5533 Fax: 86-21-5407-5066China - ShenyangTel: 86-24-2334-2829Fax: 86-24-2334-2393China - ShenzhenTel: 86-755-8864-2200 Fax: 86-755-8203-1760China - WuhanTel: 86-27-5980-5300Fax: 86-27-5980-5118China - XianTel: 86-29-8833-7252Fax: 86-29-8833-7256

ASIA/PACIFICChina - XiamenTel: 86-592-2388138 Fax: 86-592-2388130China - ZhuhaiTel: 86-756-3210040 Fax: 86-756-3210049India - BangaloreTel: 91-80-3090-4444 Fax: 91-80-3090-4123India - New DelhiTel: 91-11-4160-8631Fax: 91-11-4160-8632India - PuneTel: 91-20-3019-1500Japan - OsakaTel: 81-6-6152-7160 Fax: 81-6-6152-9310Japan - TokyoTel: 81-3-6880- 3770 Fax: 81-3-6880-3771Korea - DaeguTel: 82-53-744-4301Fax: 82-53-744-4302Korea - SeoulTel: 82-2-554-7200Fax: 82-2-558-5932 or 82-2-558-5934Malaysia - Kuala LumpurTel: 60-3-6201-9857Fax: 60-3-6201-9859Malaysia - PenangTel: 60-4-227-8870Fax: 60-4-227-4068Philippines - ManilaTel: 63-2-634-9065Fax: 63-2-634-9069SingaporeTel: 65-6334-8870Fax: 65-6334-8850Taiwan - Hsin ChuTel: 886-3-5778-366Fax: 886-3-5770-955Taiwan - KaohsiungTel: 886-7-213-7828Taiwan - TaipeiTel: 886-2-2508-8600 Fax: 886-2-2508-0102Thailand - BangkokTel: 66-2-694-1351Fax: 66-2-694-1350

EUROPEAustria - WelsTel: 43-7242-2244-39Fax: 43-7242-2244-393Denmark - CopenhagenTel: 45-4450-2828 Fax: 45-4485-2829France - ParisTel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79Germany - DusseldorfTel: 49-2129-3766400Germany - KarlsruheTel: 49-721-625370Germany - MunichTel: 49-89-627-144-0 Fax: 49-89-627-144-44Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781Italy - VeniceTel: 39-049-7625286 Netherlands - DrunenTel: 31-416-690399 Fax: 31-416-690340Poland - WarsawTel: 48-22-3325737 Spain - MadridTel: 34-91-708-08-90Fax: 34-91-708-08-91Sweden - StockholmTel: 46-8-5090-4654UK - WokinghamTel: 44-118-921-5800Fax: 44-118-921-5820

Worldwide Sales and Service

06/23/16