TI Designs Remote Controller of Air Conditioner Using MSP430 User's Guide TI Designs Design Features TI Designs provide the foundation that you need including methodology, testing and design files to quickly evaluate and customize the system. TI Designs help you accelerate your time to market. • • • • Ultra Low Power with FRAM Technology Infrared Code Sending with Optimized Timer Matrix Key Scan for 14 Buttons Segment LCD Design Resources Featured Applications TIDU513 Design Page MSP430FR4133 Product Folder • Infrared LCD Remote Controller ASK Our E2E Experts WEBENCH® Calculator Tools An IMPORTANT NOTICE at the end of this TI reference design addresses authorized use, intellectual property matters and other important disclaimers and information. All trademarks are the property of their respective owners. TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 1 System Description 1 www.ti.com System Description This board demonstrates an ultra-low power, general purpose, infrared remote controller solution. The board uses a FRAM-based MCU MSP430FR4133, which supports features such as real time clock, button scan, infrared encoding, LED backlight, and LCD display. 1.1 MSP430FR4133 The MSP430FR4133 is a FRAM-based ultra-low power mixed signal MCU. With the following features, the MSP430FR4133 is highly suitable for portable device applications. • 16-bit RISC architecture up to 16 Mhz • Wide supply voltage range from 1.8 V to 3.6 V • 64-Pin/56-Pin/48Pin TSSOP/LQFP package options • Integrated LCD driver with charge pump can support up to 4x36 or 8x32 segment LCD • Optimized 16-bit timer for infrared signal generation • Low power mode (LPM3.5) with RTC on:0.77 uA • Low power mode (LPM3.5) with LCD on: 0.936 uA • Active mode: 126 uA/MHz • 10^15 write cycle endurance low power ferroelectric RAM (FRAM) can be used to store data • 10-channel, 10-bit analog-to-digital converter (ADC) with built-in 1.5 V reference for battery powered system • All I/Os are capacitive touch I/O 2 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback Circuit Design www.ti.com 2 Circuit Design The highly-integrated mixed signal processer MSP430FR4133 has a small amount of components necessary to realize a fully-functional air conditioner remote controller. Refer to Figure 1 for the design block diagram. Figure 1. Remote Controller Block Diagram A 4x28 segment LCD is directly connected to the MSP430FR4133 LCD driver pins. Designers can swap the COM and SEG pins to simplify the PCB layout. A 4x4 matrix is used to detect 15 buttons. The matrix columns are connected to interrupt-enabled GPIOs (P1) to wake up the MSP430FR4133 from low power mode. MCU internal pull up/pull down resistors are used as button scan matrix pull up resistors. No external resistor is needed for button detection, and no external circuit is needed for battery voltage detection. The function is also realized by the MCU ADC module without any external component. TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 3 Circuit Design www.ti.com A 32.768 KHz watch crystal serves as the MCU FLL and RTC clock source. Two chip capacitors, C4 and C6, are used as the crystal loading capacitor. Designers must choose C4 and C6 values carefully according to crystal specification. Cautious PCB layout design for the crystal is strongly recommended, to secure system clock robustness. Figure 2 illustrates an example of the crystal PCB design. Figure 2. Crystal PCB Layout Refer to SLAA322B-MSP430 32-kHz Crystal Oscillators for detailed design considerations. 4 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback Software Description www.ti.com 3 Software Description The software implements an interrupt-driven structure. In the main loop, the MCU stays in LPM3.5 mode. Interrupts from the button, RTC, and timer wake up the MCU for task processing. Inputs from the button are processed in task KeyProcess (), which handles system status and generates the content for the LCD display and infrared signal. RTC generates a 3S interval interrupt to inform the system of battery voltage measurement. Figure 3. Software Structure 3.1 Infrared Signal Generation There are several kinds of infrared modulation protocols in the industry. This design illustrates pulse distance protocol with data frame format, the most commonly-used format for air conditioner remote controllers. As shown in Figure 4, each bit is composed of a carrier-modulated pulse and a space. The space’s width distinguishes logic 1 and logic 0 respectively. The carrier-modulated pulse width is constant. In this design, space length for 1 is 1690 uS, and 560 uS for digit 0. Modulated pulse width is 560 uS. Figure 4. Pulse Distance Protocol, Bit Encoding TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 5 Software Description www.ti.com A complete data frame format is shown in Figure 5. Figure 5. Pulse Distance Protocol, Data Frame Format The envelope waveform depends on the frame format. Quantize all of the above items with a minimum time slot of 0.56 ms, as shown in Table 1. Table 1. Table 1. Pulse Distance Protocol, Data Encoding Quantization Table Leading Code Logic ‘1’ Logic ‘0' Tail Code Items Carrier Modulated Pulse Space Carrier Modulated Pulse Space Carrier Modulated Pulse Space Carrier Modulated Pulse Space Length 9 ms 4.5 ms 0.56 ms 1.69 ms 0.56 ms 0.56 ms 0.56 ms 0 ms Quantizatio n 16 8 1 3 1 1 1 0 TA1 is used to generate an envelope waveform, and each pair of carrier-modulated pulse and space must update the CCR0 and CCR2 once. The CCR0 depends on the carrier-modulated pulse period plus the space period, while the CCR2 depends on the carrier-modulated pulse period. For instance, if TA1 sources from SMCLK of 4 MHz and uses default divider configuration, CCR0 and CCR2 are individually configured as 54,000 and 36,000, to generate the leading code (9 ms carrier modulated pulse paired with 4.5 ms space), and updated to 9,000 and 2,240 for logic 1 (see Figure 6). To send one full data frame, CCR0 and CCR2 must be updated 34 (1+8*2+8*2+1) times, which is achieved in the TA1 interrupt routine. Figure 6. Pulse Distance Protocol, TA1 in Envelope Generation 6 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback Test Setup and Results www.ti.com To generate 38 kHz carrier with ¼ duty, CCR0 and CCR2 of TA0 are configured according to SMCLK. For example, with a 4 MHz SMCLK, CCR0 and CCR2 are individually configured to be 105 (4,000/38) and 26 (4,000/38/4). Figure 7 shows how the duty setting works. Figure 7. Pulse Distance Protocol, TA0 in Carrier Generation 4 Test Setup and Results 4.1 Power and Infrared Code Test 2 AAA batteries power the board. By pressing the button pads with conductors, the user can observe the contents on the LCD. Typical air-conditioner working modes and parameters can be configured. A microampere meter is inserted in the power path to monitor the board power consumption as shown in Figure 8. Table 2 shows the sample board test results. To observe the infrared signal, use P1.0 with an oscilloscope. Figure 9 shows the infrared driving signal, typically 38 KHz PWM carriers, 30% duty. TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 7 Test Setup and Results www.ti.com Figure 8. Current Test Setup 8 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback Test Setup and Results www.ti.com Figure 9. Infra Transmitter Driving Signal from MCU Table 2. Power Consumption Test Result (VCC = 3.0 V with RTC ON and LCD ON, LPM3.5) Board NO# Vcc(V) Low Power Mode with RTC and LCD ON Standby Current (uA) 1# 3.0 LPM3.5 2.6 2# 3.0 LPM3.5 3.4 3# 3.0 LPM3.5 3.6 4# 3.0 LPM3.5 2.8 TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 9 Test Setup and Results 4.2 www.ti.com Oscillation Frequency, Peak-Peak Voltage and Allowance Test The ultra-low power 32.768 KHz crystal is the MCU RTC clock source and FLL reference clock source. It is essential to secure the robustness from noises. According to SLAA322B-MSP430 32-kHz Crystal Oscillators, the user can test the oscillation frequency and allowance to calculate the SF (Safety Factor), and evaluate system clock robustness. As described in SLAA322B, the SF should be greater than 3. To perform the oscillation frequency test, download FR4133CrystalTest.c to the board. Then observe the MCLK frequency on P1.4, which indicates crystal oscillation frequency. For an oscillation peak-peak voltage test, observe the signal on XOUT with a low capacitor (<2 pF) probe. For an oscillation allowance test, add a resistor (Rq) in series with the crystal, as shown in Figure 10. Figure 10. Oscillation Allowance Test with Added Resister Rq Table 3 shows the test results of sample boards with different value Rq. Table 3. Oscillation Test with VCC = 3.0 V, Temperature = 25℃ ℃,Crystal ESR = 35 KOhm Board Rq = 0Ohm Rq=100KOhm Rq=200KOhm SF Freq.(Khz) Vp-p(mV) Freq.(Khz) Vp-p(mV) Freq.(Khz) Vp-p(mV) 1# 32.769 512 32.770 616 32.770 560 >6.7 2# 32.769 504 32.770 624 32.770 568 >6.7 3# 32.770 448 32.770 536 32.771 488 >6.7 4# 32.769 488 32.770 560 32.770 520 >6.7 5# 32.770 512 32.770 600 32.771 584 >6.7 6# 32.769 472 32.770 568 32.771 528 >6.7 7# 32.770 630 32.768 608 32.769 520 >6.7 8# 32.767 480 32.770 576 32.770 536 >6.7 As shown in Table 3, even with a 200 KOhm resistor added in series with the crystal, the crystal works normally, which indicates the SF is greater than 6.7. 10 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback Design Files www.ti.com 5 Design Files 5.1 Schematics To download the schematic, see the design files at http://www.ti.com/tool/TIDU513 1 2 3 4 U1 C3 104 104 104 C4 200 R1 none GND 1M R2 0R C6 200 GND B C5 104 32768 C7 104 C8 106 R3 47K C9 105 P1 4 3 2 1 GND DVCC RST TEST R4 2K JTAG-SBW C16 101 L8 L9 L10 L11 L12 L13 L14 L15 L16 L17 L18 L19 L20 L21 L24 L25 L26 L27 L28 L29 L30 L31 KEYOUT1 KEYOUT2 KEYOUT3 KEYOUT4 J1 L0 L1 L2 L3 L4 L5 L8 L9 L10 L11 COM1 L12 COM2 L13 COM3 L14 COM4 L15 15 16 17 18 19 20 21 22 23 24 25 26 27 28 A L16 L17 L18 L19 L20 L21 L24 L25 L26 L27 L28 L29 L30 L31 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Header14*2 B DVCC R5 0R C12 C10 C11 104 104 4.7uF 3V 2 GND 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 1 C1 C2 P7.5/L5 P3.0/L8 P7.4/L4 P3.1/L9 P7.3/L3 P3.2/L10 P7.2/L2 P3.3/L11 P7.1/L1 P3.4/L12 P7.0/L0 P3.5/L13 P4.7/R13 P3.6/L14 P4.6/R23 P3.7/L15 P4.5/R33 P6.0/L16 P4.4/LCDC2 P6.1/L17 P4.3/LCDC1 P6.2/L18 P4.2/XOUT P6.3/L19 P4.1/XIN P6.4/L20 DVSS P6.5/L21 MSP430FR4133 DVCC P2.0/L24 RST/NMI/SBWTDIO P2.1/L25 TEST/SBWTCK P2.2/L26 P4.0/TA1.1 P2.3/L27 P8.3/TA1.2 P2.4/L28 P8.2/TA1CLK P2.5/L29 P1.7/TA0.1/TDO/A7 P2.6/L30 P1.6/TA0.2/TDI/TCLK/A6 P2.7/L31 P1.5/TA0CLK/TMS/A5 P5.0/UCB0STE/L32 P1.4/MCLK/TCK/A4 P5.1/UCB0CLK/L33 P1.3/UCA0STE/A3 P5.2/UCB0SIMO/UCB0SDA/L34 P1.2/UCA0CLK/A2 P5.3/UCB0SOMI/UCB0SCL/L35 P1.1/UCA0RXD/UCA0SOMI/A1/Veref+ P5.4/L36 P1.0/UCA0TXD/UCA0SIMO/A0/Veref– P5.5/L37 | + A GND 1 2 3 4 5 6 7 8 9 10 11 12 XOUT 13 XIN 14 GND 15 DVCC 16 RST 17 TEST 18 19 20 21 KEYSHIFT 22 23 KEYIN1 BACKLI GHT 24 25 KEYIN2 26 KEYIN3 27 KEYIN4 SEND 28 L5 L4 L3 L2 L1 L0 VCC R6 0R U2 C13 C14 C15 100uF Battery 106 104 GND VCC KEYIN4 KEYIN3 KEYIN2 COLD/BLOW.HEAT SLEEP/SWINGLR C 1 2 1 Button-2p TIMER/SWINGUD 1 KEYSHIFT 2 1 2 Button-2p GND TEMP.DIS 1 Button-2p SILENT 2 Button-2p 1 1 TURBO 2 Button-2p 1 ON/OFF 1 2 Button-2p 2 BACKLI GHT R7 2R2 HEAT/HEALTH.AIR 1 Button-2p 1 Button-2p SHIFT 2 VCC SEND KEYIN1 Button-2p 2 1 SAVE 2 Button-2p 2 1 LIGHT 2 Button-2p MODE 1 2 Button-2p 1 FAN 2 Button-2p Button-2p + Button-2p R9 220R KEYOUT1 LED2 Backlight R8 300R 2 LED1 Infrared Radiation Q2 KEYOUT2 R10 10R R11 100K KEYOUT3 KEYOUT4 GND GND Title D C Q1 Size D Number Revision A Date: File: 1 2 3 2014-9-11 Sheet of Z:\Share_F older\..\RemoteControlerB.SchDoc Drawn By: 4 Figure 11. Schematic TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 11 Design Files 5.2 www.ti.com Bill of Materials To download the bill of materials (BOM), see the design files at http://www.ti.com/tool/TIDU513. Table 4. BOM Designator 12 Description Quantity +, -, COLD/BLOW.HEAT, FAN, HEAT/HEALTH.AIR, LIGHT, MODE, ON/OFF, SAVE, SILENT, SLEEP/SWINGLR, TEMP.DIS, TIMER/SWINGUD, TURBO Buttons 14 C1, C2, C3, C5 0805, Chip Capacitor, X7R,16 V, +-10% 4 C4, C6 0805, Chip Capacitor Chip Capacitor 200 X7R,16 V, +10% 2 C7, C10, C11, C14 0805, Chip Capacitor 104 X7R, 16 V, +-10% 4 C8, C16 0805, Chip Capacitor 106 X7R,16 V, +-10% 1 C9 0805, Chip Capacitor 105 X7R,16 V, +-10% 1 C12 0805, Chip Capacitor Cap Pol1 X7R,16 V, +-10% 1 C13 0805, Chip Capacitor Cap Pol1 X7R,16 V, +-10% 1 C15 0805, Chip Capacitor 102 X7R,16 V, +-10% 1 Crystal 32.768 Khz crystal 1 J1 Header14*2 1 LED1 Infrared Radiation transmitter 1 LED2 Backlight LED 1 P1 JTAG-SBW 1 Q1, Q2 Transistor 2 R1, R2, R3, R4, R5, R6, R8, R9, R10, R11 0805 Chip Resistor 10 R7 0805 Chip Resistor 1 SHIFT Button 1 U1 MSP430F4133 1 U2 Battery 1 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback Design Files www.ti.com 5.3 PCB Layout To download the layer plots, see the design files at http://www.ti.com/tool/TIDU513. TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 13 Design Files www.ti.com Figure 12. PCB Layer 1 14 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback Design Files www.ti.com Figure 13. PCB Layer 2 TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 15 Design Files 5.4 www.ti.com Gerber Files To download the Gerber files, see the design files at http://www.ti.com/tool/TIDU513. 6 Software Files To download the software files, see the design files at http://www.ti.com/tool/TIDU513 16 Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated TIDU513 – October 2014 Submit Documentation Feedback About the Author www.ti.com 7 About the Author JASON GUO is a system application engineer at Texas Instruments, where he is responsible for developing reference design solutions for the industrial segment. Jason earned his Engineering Master of Integrated Circuits Design from Peking University, and Bachelor of Electronic Engineering from Shanghai Jiaotong University. TIDU513 – October 2014 Submit Documentation Feedback Remote Controller of Air Conditioner Using MSP430 User's Guide Copyright © 2014, Texas Instruments Incorporated 17 IMPORTANT NOTICE FOR TI REFERENCE DESIGNS Texas Instruments Incorporated ("TI") reference designs are solely intended to assist designers (“Buyers”) who are developing systems that incorporate TI semiconductor products (also referred to herein as “components”). Buyer understands and agrees that Buyer remains responsible for using its independent analysis, evaluation and judgment in designing Buyer’s systems and products. TI reference designs have been created using standard laboratory conditions and engineering practices. TI has not conducted any testing other than that specifically described in the published documentation for a particular reference design. TI may make corrections, enhancements, improvements and other changes to its reference designs. Buyers are authorized to use TI reference designs with the TI component(s) identified in each particular reference design and to modify the reference design in the development of their end products. HOWEVER, NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE TO ANY OTHER TI INTELLECTUAL PROPERTY RIGHT, AND NO LICENSE TO ANY THIRD PARTY TECHNOLOGY OR INTELLECTUAL PROPERTY RIGHT, IS GRANTED HEREIN, including but not limited to any patent right, copyright, mask work right, or other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information published by TI regarding third-party products or services does not constitute a license to use such products or services, or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. TI REFERENCE DESIGNS ARE PROVIDED "AS IS". TI MAKES NO WARRANTIES OR REPRESENTATIONS WITH REGARD TO THE REFERENCE DESIGNS OR USE OF THE REFERENCE DESIGNS, EXPRESS, IMPLIED OR STATUTORY, INCLUDING ACCURACY OR COMPLETENESS. TI DISCLAIMS ANY WARRANTY OF TITLE AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT, QUIET POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO TI REFERENCE DESIGNS OR USE THEREOF. TI SHALL NOT BE LIABLE FOR AND SHALL NOT DEFEND OR INDEMNIFY BUYERS AGAINST ANY THIRD PARTY INFRINGEMENT CLAIM THAT RELATES TO OR IS BASED ON A COMBINATION OF COMPONENTS PROVIDED IN A TI REFERENCE DESIGN. IN NO EVENT SHALL TI BE LIABLE FOR ANY ACTUAL, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT OF TI REFERENCE DESIGNS OR BUYER’S USE OF TI REFERENCE DESIGNS. TI reserves the right to make corrections, enhancements, improvements and other changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All semiconductor products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms and conditions of sale of semiconductor products. Testing and other quality control techniques for TI components are used to the extent TI deems necessary to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily performed. TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide adequate design and operating safeguards. Reproduction of significant portions of TI information in TI data books, data sheets or reference designs is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards that anticipate dangerous failures, monitor failures and their consequences, lessen the likelihood of dangerous failures and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use of any TI components in Buyer’s safety-critical applications. In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and requirements. Nonetheless, such components are subject to these terms. No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties have executed an agreement specifically governing such use. Only those TI components that TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components that have not been so designated is solely at Buyer's risk, and Buyer is solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.IMPORTANT NOTICE Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2014, Texas Instruments Incorporated