AN2863 Application note Smart inductive proximity switch with SPT01-335DEE 1 Introduction The STEVAL-IFS006V2 demonstration board shows an inductive proximity switch based on the principle of metal body detection using the eddy current effect on the HF losses of a coil. It consists of a single transistor HF oscillator, a ST7LITEUS5 microcontroller, an intelligent TDE1708DFT power switch, and an SPT01-335DEE triple Transil™ array. The board demonstrates a very simple compact and cost-effective solution of an inductive proximity switch with regard to a wide temperature range, supply voltage variation, and noise immunity in industrial environments. Features ■ Metal body detection using the eddy current effect on the HF losses of a coil ■ Good flexibility: MCU firmware can be modified depending on the application requirements - sensitivity and hysteresis adjustment ■ In-circuit programming and in-circuit debugging capabilities ■ Analog and digital temperature compensation ■ PNP (high-side) sensor functionality configuration ■ Complete Transil protection of the output and power supply lines ■ Overload and short-circuit protection ■ GND and Vs open wire protection ■ Indicator status LED ■ Compact design ■ Supply voltage: 7 V to 32 V DC ■ Temperature range: –25 °C to +85 °C. Figure 1. February 2011 Smart inductive proximity switch board Doc ID 15277 Rev 1 1/13 www.st.com Contents AN2863 Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Sensor overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 Sensor circuit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.1 Initial configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.2 ICC connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4 Software implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 6 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2/13 Doc ID 15277 Rev 1 AN2863 List of tables List of tables Table 1. Table 2. Table 3. Table 4. Bill of material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Diagnostic LED blinking modes (power up self test). . . . . . . Diagnostic LED blinking modes (normal operation) . . . . . . . Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . Doc ID 15277 Rev 1 ...... ...... ...... ...... ....... ....... ....... ....... ...... ...... ...... ...... .....9 . . . . 10 . . . . 10 . . . . 12 3/13 List of figures AN2863 List of figures Figure 1. Figure 2. Figure 3. Figure 4. Figure 5. Figure 6. Figure 7. 4/13 Smart inductive proximity switch board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Smart inductive proximity switch block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Initial configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Application schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Demonstration board self test inducing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Oscillator amplitude vs. temperature (MCU pin 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 D2 voltage vs. temperature (MCU pin 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Doc ID 15277 Rev 1 AN2863 2 Sensor overview Sensor overview Proximity switches are generally applied to sense the position of a moving object in manufacturing processes. Typically, they utilize an oscillator drive circuit in combination with an induction tank circuit. The tank circuit includes an induction coil as a means for sensing the presence of an object such as metal. The magnetic field induces eddy currents in a conductive object which comes within the generated magnetic field. The oscillation amplitude is attenuated due to the energy drawn from the induction coil. The amount of the oscillation attenuation is directly related to the distance between the metal object and the induction coil. A typical inductive proximity switch employs a ferrite cup core as the sensing element. It allows the flux field to be focused in front of the cup and further prolong the sensing distance. The oscillator usually operates between 100 kHz and 800 kHz, where the eddy current losses are significant. Some benefits of the MCU approach compared with a traditional solution include: Figure 2. ● More reliable operation thanks to the sensor self diagnostics ● Easy and cheap sensor trimming in the production line ● Digital temperature compensation ● Linearization of the sensor characteristic ● Easy realization of an analog or a PWM output. Smart inductive proximity switch block diagram )#0 4EMPSENSOR nM6+ /SCILLATOR ^ K(Z 345LTRALITE 4IMERS $ETECTOR 4$%$&4 6 62%'6 &LASH + !$# $#TO6 BIT '0)/ # 6TO6 3UPPLYVOLTAGE (IGHSIDEOUTPUT "!3 , 304 '.$ #& 3ELFDIAGNOSTICS,%$ )NDICATORSTATUS,%$ Doc ID 15277 Rev 1 !- 5/13 Sensor circuit description 3 AN2863 Sensor circuit description The sensor HF oscillator circuit is based on the Colpitts oscillator type which has a simple circuit configuration, produces a very clean sinusoidal wave signal, and is capable of oscillating in a wide range of frequencies. The resonant circuit made up of the inductor L1 and capacitors C12, C9, and C8 determine the frequency of the oscillations according to Equation 1. The circuit actually oscillates at a slightly lower frequency due to the coupling capacitor C10, junction capacitances of the transistor Q1, and other stray capacitances. Equation 1 1 f = -------------------------------------------------------------C C ⎞ ⎛ 8 9--------------------⎟ 2π L 1 ⎜ C 12 + C ⎝ 8 + C 9⎠ The oscillator employs a transistor Q1 operating in common base configuration which derives its feedback from the capacitor divider C9 and C8. Resistors R3 and R6 set its bias point and diode D2 temperature stabilizes it. The oscillator signal amplitude is further detected by diodes D4 and D5 and filtered by capacitor C13. Together with C10, this circuit acts as a charge pump, therefore the full range of the ST7 ADC converter (0 V - 5 V) is used. Another function of the diode D2 is temperature sensing. The voltage across a diode operated at constant current is linear in a very large range of temperatures and reduces with an increasing temperature with approximately –2 mV/K (see Figure 7). With the ST7 10-bit ADC converter, the temperature can be measured with the resolution of approximately 2.5 °C which is enough for the overall correction of the sensor temperature variations (see Figure 6). The output power stage of the sensor is equipped by the intelligent TDE1708DFT power switch integrating overload and short-circuit protection, GND and Vs open wire protection, +5 V linear regulator, indicator status LED driver, and many other functions. The triple Transil array SPT01-335DEE realizes the overall protection of the sensor. This device was specially developed for 24 V proximity sensors. It provides a very compact solution for the efficient protection of bus, output power switch, and power supply reverse blocking. Demagnetization of an inductive load is another key feature. 3.1 Initial configuration Figure 3 shows the initial demonstration board configuration in relation to the power supply and the load. Compared to the previous version of this board (STEVAL-IFS006V1) this new board only supports the more frequently used PNP (high-side) output driver configuration, although the intelligent TDE1708DFT power switch and the triple Transil array SPT01335DEE support both. The reason for this is the number of necessary jumpers needed for functionality change. 6/13 Doc ID 15277 Rev 1 AN2863 3.2 Sensor circuit description ICC connector The board ICC connector offers in-circuit programming and in-circuit debugging capabilities and therefore simplifies the firmware development. More information about ST7 development tools is available at www.st.com/mcu. Figure 3. Initial configuration $ (3 , ,n 0OWER ,OAD SUPPLY $ !- Doc ID 15277 Rev 1 7/13 0! 6 8/13 Doc ID 15277 Rev 1 # N& 2 2 , 1 "#" 2 0! 0! 0! # P& # P& # P& # N& '.$ )##$!4! )###, + '.$ 2%3%4 '.$ 6$$ '.$ #,+). 0 #ON)## 6 # N& 2 '.$ (3/54 $ $IAG,%$ $%,!9 6 2%'6 6S , 3/54 ). ,%$$2)6%2 5 4$%$&4 # N& $ "!37 2 0! 6 6 # N& 0! 0! # N& 6 # N& # N& 304 ,3 6 + 5 # (3 6n ! 6 6SS $$ 0!!).!407-) ##$!4! 0!!).#,+). 0!!).)###,+ 0!!). 0!,4)#!). 0!2%3%4 5 34,)4%53 # N& $ 3TATUS,%$ 0 ,n 0 (3 0 , !- 0! 0! 2 + 6 Figure 4. $ . 6 Sensor circuit description AN2863 Application schematic AN2863 Table 1. Sensor circuit description Bill of material Reference Value Description Quantity Supplier Order code U1 TDE1708DFT Intelligent power switch 1 STMicroelectronics™ TDE1708DFT U2 ST7LITEUS5 8-bit MCU 1 STMicroelectronics ST7FLITEUS5U3 U3 SPT01-335DEE Triple Transil array 1 STMicroelectronics SPT01-335DEE C1, C3, C11 10 nF Capacitor 3 EPCOS B37931A5103K0 C2 100 nF Capacitor 1 EPCOS B37941A5104K0 C4, C5 100 nF Capacitor 2 EPCOS B37931K0104K0 C6 10 µF / 6.3 V Polarized capacitor 1 C7 10 nF Capacitor 1 EPCOS B37941A1103K0 C8, C13 1.5 nF Capacitor 2 EPCOS B37931A5152K0 C9 100 pF Capacitor 1 EPCOS B37930A5101J0 C10 47 pF Capacitor 1 EPCOS B37930A5470J0 C12 470 pF Capacitor 1 EPCOS B37930A5471J0 D1 Status LED LED 1 D2 Diag. LED LED 1 D3 BAS69-04W Schottky barrier double diode 1 STMicroelectronics BAS69-04W D4 1N4148 High conductance fast diode 1 L1 80 µH PS-core inductor 1 BOHEMIA ELECTRIC BS361 P1 HS Header, 1-pin 1 P2 L+ Header, 1-pin 1 P3 L– Header, 1-pin 1 P4 Con ICC ICC connector 1 Q1 BC857B PNP transistor 1 R1 220 KΩ Resistor 1 R2 5.6 KΩ Resistor 1 R3, R4 1.5 KΩ Resistor 2 R5, R6 10 KΩ Resistor 2 Doc ID 15277 Rev 1 9/13 Software implementation 4 AN2863 Software implementation After the first startup following the firmware upload, the ST7 MCU performs a simple board self test. It reads the oscillator amplitude level and voltage across the temperature sensing diode D2 and checks whether these values are in a specific range (this state is indicated by diagnostic LED D3 blinking, see Table 2). The oscillator amplitude level detected during this test is also considered as an initial oscillator level when no metal object approaches the sensing inductor L1 and its value is recorded in the Flash memory (address 0xfc00) using the in-application programming (IAP) method. This value is later used for amplitude reduction comparisons caused by metal objects. Note: The initial board self test procedure can be induced anytime by placing a jumper on the ICC connector (pins 3-4, see Figure 5) and powering up the application. Figure 5. Demonstration board self test inducing #ON)## !- During normal operation the MCU controls the sensor output based on the information regarding the oscillator amplitude and the actual temperature. The main sensor part of the firmware is realized in an auto-reload timer interrupt service routine. In equi-distant time intervals the oscillator amplitude is sampled and its value is compared with two system variables (ucUpperCompThreshold and ucLowerCompThreshold). One of these defines onto-off transition while the other defines off-to-on transition of the sensor state. The distance between them determines the hysteresis. These threshold variable values are defined as a percentage of the initial oscillator level recorded in the Flash memory and are further modified depending on the temperature by a co-efficient from a lookup table. Table 2. Table 3. Diagnostic LED blinking modes (power up self test) LED status Meaning Blinking Input values within limits Constant Error Diagnostic LED blinking modes (normal operation) Flashing style ❋ ❋ ❋❋ ❋❋❋ 10/13 ❋ ❋❋ ❋ ❋❋ ❋❋❋ ❋ Meaning ❋ Undertemperature ❋❋ Overtemperature ❋❋❋ Doc ID 15277 Rev 1 Ferrite approaching the coil AN2863 Software implementation Figure 6. Oscillator amplitude vs. temperature (MCU pin 3) /SCILLATOR AMPLITUDE6 n n 4EMPERATURE # !- Figure 7. D2 voltage vs. temperature (MCU pin 5) $VO LTAGE6 4EMPERATURE # !- Doc ID 15277 Rev 1 11/13 References 5 6 AN2863 References 1. ST7LITEUSx datasheet. 2. TDE1708DFT datasheet. 3. SPT01-335DEE datasheet. 4. BAS69-04W, see BAS69 datasheet. 5. AN495 application note. 6. EN60947-5-2; Low-voltage switchgear and controlgear - Part 5-2: Control circuit devices and switching elements - Proximity switches”. Revision history Table 4. 12/13 Document revision history Date Revision 10-Feb-2010 1 Changes Initial release. Doc ID 15277 Rev 1 AN2863 Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST’s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. © 2011 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com Doc ID 15277 Rev 1 13/13