AN204734 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution Associated Part Family: MB95200 Series This application note describes the features of a Smoke Detector demo board. Contents 1 2 3 4 1 Overview ..................................................................... 1 Demo Platform............................................................. 2 2.1 Platform............................................................... 2 Features ...................................................................... 3 3.1 High dB Alarm ..................................................... 3 3.2 Powered by Battery............................................. 3 3.3 Low Power Consumption .................................... 3 Functions ..................................................................... 4 4.1 Normal State Indication ....................................... 4 4.2 Self-test Function ................................................ 4 4.3 Low Battery Output Warning ............................... 4 4.4 Automatic Alarm ................................................. 4 5 Hardware ..................................................................... 5 5.1 System Block Diagram........................................ 5 5.2 Schematic ........................................................... 6 5.3 Modules .............................................................. 7 6 Firmware ................................................................... 10 6.1 Flow Chart ........................................................ 10 6.2 Project............................................................... 12 7 Additional Information ................................................ 13 Document History............................................................ 14 Overview This Demo board is a smoke detector which is used to detect fire. It is a photoelectric detector that senses the infrared refracted by mote or dust caused by fire. The MCU is Cypress MB95202K from MB95200 series. This demo set supports the following features: High dB alarm Powered by battery Low power consumption www.cypress.com Document No. 002-04734 Rev. *A 1 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 2 Demo Platform 2.1 Platform Figure 1 shows the platform of smoke detector. D1 and D2 are alarm LEDs. The key is used for self-test. Figure 1. Demo Platform www.cypress.com Document No. 002-04734 Rev.*A 2 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 3 Features 3.1 High dB Alarm The sound is higher than 70 dB in the field of 3 m. When the detector is fixed lower than 5 m above the floor, it can cover 60 m2. 3.2 Powered by Battery The detector is battery powered equipment. Two 5# batteries can drive it. It runs at 1.8 V to 3.3 V DC voltage. 3.3 Low Power Consumption In battery powered system, the power consumption is a key parameter. There is a table below to illuminate the main current consumptions. Table 1. Current Consumption Test Condition DC to DC 65 mA (EMH7600) 3V Amplifier 20 mA MCU 10 mA Others 5 mA Total 100 mA*3 V=300 mW In 3 V condition, the total current is 100 mA. If it is powered by two 5# batteries which have a capacity of 2300 mAh, the batteries can last 958 days which is calculated by this formula: (2300 mAh*1000) / (100 mA*24 h) = 958, Of course this is an ideal data. The actual time will be shorter. The designer can reduce the power consumption by using low power consumption ICs, reducing the system leak current, and using more prefect firmware and so on. www.cypress.com Document No. 002-04734 Rev.*A 3 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 4 Functions 4.1 Normal State Indication When power is on, D1 and D2 will flash for one time to indicate that the demo works normally. 4.2 Self-test Function In order to test the demo, we can press the key. The buzzer will sound periodically when the key is continuously pressed. That means the detector is in normal state. 4.3 Low Battery Output Warning In this demo set, the DC-DC converter has battery capacity monitor function which can supply a signal to the MCU to warn low battery output. When low battery output occurs, the buzzer will sound and the LEDs will flash at the same time. 4.4 Automatic Alarm The detector senses the refracted light that reflects the thickness of mote or dust. Stronger light means more mote or dust, and also means high risk of fire. When the thickness of the mote or dust rises up to a threshold, the red firealarm light will flash first, then buzzer will sound for 11s later. www.cypress.com Document No. 002-04734 Rev.*A 4 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 5 Hardware 5.1 System Block Diagram The demo system contains the following elements as shown in Figure 2. MCU DC/DC boost converter IR receiver and amplifier circuit IR LED driver EEPROM Buzzer Temperature sensor Figure 2. System Block Diagram Batteries 3.3 V DC-DC convertor Receiver and Amplifier Infrared-Emitting Diode EEPROM MB95F202K LEDs Temperature Sensor www.cypress.com Buzzer Document No. 002-04734 Rev.*A 5 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 5.2 Schematic This schematic is a full version, and the temperature and EEPROM are alterable devices. Figure 3 shows the schematic. Figure 3. Smoke Detector www.cypress.com Document No. 002-04734 Rev.*A 6 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 5.3 Modules Some main modules will be introduced in this section. MCU In this demo, the MCU is MB95F202K from Cypress excellent MB95200 series. It has following main features: • • • • • • 4 KB FLASH, 240 bytes RAM 4 clock resources: main OSC, sub OSC, main CR, sub CR. 2 channels of 8/16bits timer LIN module supporting main and slave mode 6 channels for 8/10bit A/D LVD So, this MCU is absolutely competent in this system. The peripheral circuit is like Figure 4. Figure 4. MCU www.cypress.com Document No. 002-04734 Rev.*A 7 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution Table 2 shows the pin assignment. Table 2. Pin Assignment Number Pin Function 1 PF0 EEPROM clock 2 PF1 EEPROM data 8 RST REST input 9 P62 Buzzer 10 P63 LED D1 11 P64 LED D2 12 P00 Voltage input transformed from reflected infrared current 13 P01 Temperature input 16 P04 Infrared output 18 P06 Monitor the battery capacity 19 P07 Key input 20 P12 One line debug DC-DC Boost Converter The DC-DC boost converter is used to fix the power output at 3.3 V when the battery voltage is lower than 3V. In this design, we select EMH7600 which is a boost converter with 0.3 V – 6 V input and 3.3 V output. The output current is up to 500 mA. About this part, the efficiency has to be considered. Low efficiency will bring huge power consumption. This IC has a battery capacity monitoring function which is useful here. The pin LBI is battery comparator input and LBO is the output. When the voltage on LBI is lower than 1.195 V, the LBO will switch to low from high level. Figure 5 gives the DC-DC circuit. Figure 5. DC-DC www.cypress.com Document No. 002-04734 Rev.*A 8 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution IR Receiver and Amplifier Circuit This demo is a photoelectric detector which contains an IR-emitted diode and an IR-received diode. The IR-received diode is fixed in a dark cavity. Amplifiers circuit is needed here to magnify the signal for the following AD stage. The current was transformed to voltage before the amplifier. The amplifier circuit contains two stage amplifiers with total plus of 50 times. PD204-6B is IR receiver. Figure 6. Amplifier Circuit IR Emitter Circuit Actually IR emitter is an IR emitting diode. It is driven by a dynatron. Figure 7 shows the circuit. Figure 7. IR Emitter www.cypress.com Document No. 002-04734 Rev.*A 9 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 6 Firmware As many battery powered systems, to reduce power consumption from firmware side is as important as hardware side. Sleeping with periodical wake-up is a widely used method to reduce the power consumption, so does this demo. 6.1 Flow Chart 6.1.1 Main Function The Low power modes are set in the main function. The MCU can enter SLEEP or STOP mode according to the key and alarm state. Figure 8 illuminates the main function. Figure 8. Main Function Start Initialize MCU Key pressed or in pre-alarm? N Y Enter SLEEP 6.1.2 Enter STOP Watch Timer ISR Usually, the MCU will be waked up by watch timer interrupt one time in every 4s. MCU will give a plus to the infrared LED, and samples the voltage input at the same time when it is waked up. If it is the first time that the A/D value is greater than the threshold, the wake-up interval will be set to 1s and start a counter. Figure 9 illuminates the watch timer ISR (see next page) www.cypress.com Document No. 002-04734 Rev.*A 10 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution Figure 9. Watch Timer ISR Clear watch timer interrupt flag Send IR plus and sample A/D LBO happened? Y LED and buzzer warning Y LED and buzzer alarm Y Switch to 1s interval, led and buzzer indicate N Clear counter N Fire alarm happened? N Key pressed? N AD > threshold? Y Counter+1 Set 4s interval Counter > 9? N Y Switch to 1s interval and set fire alarm flag Return www.cypress.com Document No. 002-04734 Rev.*A 11 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution NOTE: LBO means low battery output. 6.2 Project In this project, all functions and definitions can be found in main.c. The others are files supplied by Cypress. Mb95200.asm is a memory definition. startup.c is start file. vectors.c is a vector definition. Figure 10. Project www.cypress.com Document No. 002-04734 Rev.*A 12 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution 7 Additional Information For more information on Cypress MB95200 products, please visit following website: http://www.cypress.com/MB95200 www.cypress.com Document No. 002-04734 Rev.*A 13 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution Document History Document Title: AN204734 – F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution Document Number: 002-04734 Revision ECN Orig. of Change Submission Date ** - HUAL 11/04/2009 Initial release *A 5250250 HUAL 05/18/2016 Migrated Spansion Application Note MCU-AN- 500054-E-10 to Cypress format. www.cypress.com Description of Change Document No. 002-04734 Rev.*A 14 F²MC-8FX Family MB95200 Series 8-Bit Microcontroller Smoke Detector Demo Reference Solution Worldwide Sales and Design Support Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find the office closest to you, visit us at Cypress Locations. PSoC® Solutions Products ARM® Cortex® Microcontrollers cypress.com/arm PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP Automotive cypress.com/automotive Cypress Developer Community Clocks & Buffers cypress.com/clocks Interface cypress.com/interface Lighting & Power Control cypress.com/powerpsoc Memory cypress.com/memory PSoC cypress.com/psoc Touch Sensing cypress.com/touch USB Controllers cypress.com/usb Wireless/RF cypress.com/wireless Forums | Projects | Videos | Blogs | Training | Components Technical Support cypress.com/support PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corporation. All other trademarks or registered trademarks referenced herein are the property of their respective owners. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone Fax Website : 408-943-2600 : 408-943-4730 : www.cypress.com © Cypress Semiconductor Corporation, 2009-2016. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited. TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in this document. Any information provided in this document, including any sample design information or programming code, is provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of Cypress products. Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their respective owners. www.cypress.com Document No. 002-04734 Rev.*A 15