Application Note. Smart LED Dimmer Controlled via Bluetooth AN-CM-225

Similar documents
Application Note. Customized Glucometer using GreenPAK AN-CM-222

Application Note. Low Power DC/DC Converter AN-CM-232

Application Note. PWM Control for PC Fans AN-CM-248

Application Note. Servo Overload Protection AN-CM-247

Application Note. External Oscillator Solutions with GreenPAK AN-CM-233

Application Note. Brushless DC Motor Control AN-1114

Application Note. 3-Phase Brushless DC Motor Control with Hall Sensors AN-CM-244

Application Note. Over Current Latch with Low Side Sense AN-CM-223

iw3627 Off-Line Digital Constant-Voltage LED Driver with Power Factor Correction 1 Description 2 Features 3 Applications

iw1815 Product Summary

Reference Design EBC iw1760b-00 for 15W Dual Output Home Appliance Switched Mode Power Supply Design

AN1756 Application note

Driving LEDs with a PIC Microcontroller Application Note

AN-1164 Cycle Stealing Control

FILTER_0/Prog. Delay Combination Function Macrocells Pin 3 GPIO RC Oscillator. 2-bit LUT2_0 or DFF0. 3bit LUT3_0 or DFF2

UM0791 User manual. Demonstration firmware for the DMX-512 communication protocol receiver based on the STM32F103Zx. Introduction

AN2141 Application note

Pin 19 GPIO. Counters/Delay Generators CNT1 CNT2 CNT3 CNT4 CNT5 CNT6 CNT7 CNT8 CNT9. DFF/Latches. Pin 15 GPIO DFF0 DFF1 DFF2 DFF3 DFF4

High Group Hz Hz. 697 Hz A. 770 Hz B. 852 Hz C. 941 Hz * 0 # D. Table 1. DTMF Frequencies

AN3332 Application note

SPI Slave to PWM Generation

AN2581 Application note

AN4379 Application note

I hope you have completed Part 2 of the Experiment and is ready for Part 3.

AN4014 Application Note Adjustable LED blinking frequency using a potentiometer and STM8SVLDISCOVERY Application overview

AN3134 Application note

Counters/Delay Generators. FILTER_0/Prog. Delay Combination Function Macrocells Pin 3. Preliminary

In this lecture, we will look at how different electronic modules communicate with each other. We will consider the following topics:

STEVAL-ISA005V1. 1.8W buck topology power supply evaluation board with VIPer12AS. Features. Description. ST Components

BB Product profile. 2. Pinning information. 3. Ordering information. FM variable capacitance double diode. 1.1 General description

BAT30F4 Datasheet production data Features Description 0201 package Figure 1. Pin configuration and marking Table 1. Device summary Symbol Value

AN3248 Application note

CE PSoC 6 MCU Breathing LED using Smart IO

AN2979 Application note

Obsolete Product(s) - Obsolete Product(s)

AN4112 Application note

STLC4560. Single chip b/g WLAN radio. Features. Description. Applications

AN1449 Application note

STP16CPS05. Low voltage 16-Bit constant current LED sink driver with auto power saving. Features. Description. Order codes

The Frequency Divider component produces an output that is the clock input divided by the specified value.

HT /4 to 1/11 Duty VFD Controller. Features. Applications. General Description

High-speed switching in e.g. surface-mounted circuits

ZSSC3170 Application Note - LIN and PWM Interface Operation

AN1642 Application note

CDM10V programming user manual describes the COOLDIM_PRG_BOARD burner board usage, the UART protocol handling and the fusing details.

STCL1100 STCL1120 STCL1160

Atmel U6032B. Automotive Toggle Switch IC DATASHEET. Features. Description

FxLED & Backlight LED Driver Selection

6.5 mm. Pin 19 GPIO. Counters/Delay Generators CNT1 CNT2 CNT3 CNT4 CNT5 CNT6 CNT7 CNT8 CNT9. DFF/Latches DFF0 DFF1 DFF2 DFF3 DFF4

In data sheets and application notes which still contain NXP or Philips Semiconductors references, use the references to Nexperia, as shown below.

2STC4468. High power NPN epitaxial planar bipolar transistor. Features. Application. Description

Order codes Package Packaging

AN NTAG21xF, Field detection and sleep mode feature. Rev July Application note COMPANY PUBLIC. Document information

AN2446 Application note

ZKit-51-RD2, 8051 Development Kit

12-stage binary ripple counter

2STA1695. High power PNP epitaxial planar bipolar transistor. Features. Applications. Description

LM323. Three-terminal 3 A adjustable voltage regulators. Description. Features

DESCRIPTION DOCUMENT FOR WIFI SINGLE DIMMER ONE AMPERE BOARD HARDWARE REVISION 0.3

2ST2121. High power PNP epitaxial planar bipolar transistor. Features. Applications. Description 1 2 TO-3

High-speed switching diode in dual series configuration, encapsulated in a small SOT23 (TO-236AB) Surface-Mounted Device (SMD) plastic package.

UM Description of the TDA8029 I2C Demo Board. Document information

In data sheets and application notes which still contain NXP or Philips Semiconductors references, use the references to Nexperia, as shown below.

AN243 Application note

Roland Kammerer. 13. October 2010

Color Stabilization of RGB LEDs in an LED Backlighting Example Application Note

HT /4 to 1/11 Duty VFD Controller

2STC5242. High power NPN epitaxial planar bipolar transistor. Features. Application. Description

Web-Enabled Speaker and Equalizer Final Project Report December 9, 2016 E155 Josh Lam and Tommy Berrueta

Obsolete Product(s) - Obsolete Product(s)

3STL2540. Low voltage high performance PNP power transistor. Features. Applications. Description

HT162X HT1620 HT1621 HT1622 HT16220 HT1623 HT1625 HT1626 HT1627 HT16270 COM

50 ma LED driver in SOT457

Full bridge control IC for HID automotive lighting

2STC4468. High power NPN epitaxial planar bipolar transistor. Features. Application. Description

L9914. All silicon voltage regulator. Features. Description. Multiwatt8

STCL1100 STCL1120 STCL1160

Part numbers Order codes Packages Temperature range. LM137 LM137K TO-3-55 C to 150 C LM337 LM337K TO-3 0 C to 125 C LM337 LM337SP TO C to 125 C

Macroblcok MBI5042 Application Note-VB.01-EN

Obsolete Product(s) - Obsolete Product(s)

Obsolete Product(s) - Obsolete Product(s)

Description. Table 1. Device summary. Order code Temp. range Package Packing Marking

Module -18 Flip flops

HEF4518B. 1. General description. 2. Features and benefits. 3. Applications. 4. Ordering information. Dual BCD counter

Lab 1.2 Joystick Interface

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

AN2243 Application note

Atmel ATA6629/ Atmel ATA6631 Development Board V2.2. Application Note. Atmel ATA6629/ATA6631 Development Board V

The HC-5560 Digital Line Transcoder

STTH60AC06C. Turbo 2 ultrafast high voltage rectifier. Features. Description

TSYS01 Digital Temperature Sensor

RAM Mapping LCD Controller for I/O MCU. Built-in LCD display RAM Built-in RC oscillator

AN2333 Application note

2STA1943. High power PNP epitaxial planar bipolar transistor. Features. Application. Description

MMBTA42. Small signal NPN transistor. Features. Applications. Description

BUX87. High voltage NPN power transistor. Features. Applications. Description

AN4269. Diagnostic and protection features in extreme switch family. Document information

Description. Notes: (1) Qualification and characterization according to AEC Q100 and Q003 or equivalent,

In data sheets and application notes which still contain NXP or Philips Semiconductors references, use the references to Nexperia, as shown below.

74HC377; 74HCT General description. 2. Features and benefits. 3. Ordering information

Transcription:

Application Note Smart LED Dimmer Controlled via Bluetooth AN-CM-225 Abstract This application note describes how to build a smart digital dimmer using GreenPAK SLG46620V. A dimmer is a common light switch that is used in houses, hotels and many other buildings. Older versions of dimmer switches were manual, and would typically incorporate a rotary switch (potentiometer) or buttons to control the light level. This Application Note comes complete with design files which can be found in the References section.

Contents Abstract... 1 Contents... 2 Figures... 2 Tables... 2 1 Terms and Definitions... 3 2 References... 3 3 Introduction... 4 4 GreenPAK Design... 5 4.1 UART receiver... 5 4.2 Control unit... 6 4.3 CLK Generators and multiplexer... 7 4.4 PWM... 7 5 Android app... 8 6 Conclusion... 10 Revision History... 11 Figures Figure 1: Dimmer Block Diagram... 4 Figure 2: UART Receiver... 6 Figure 3: Control Unit Design... 7 Figure 4: Clock Generator Design... 7 Figure 5: PWM Block... 7 Figure 6: Programming blocks of buttons... 8 Figure 7: Programming blocks of buttons... 9 Figure 8: Circuit Schematic... 9 Figure 9: Prototype Interface... 10 Tables Table 1: Command-Bit Representation... 8 CFR0014 2 of 12 2018 Dialog Semiconductor

1 Terms and Definitions CMIC UART LED SPI PWM FSM LUT DFF Configurable Mixed-Signal Integrated Circuits Universal asynchronous receiver-transmitter Light-emitting diode Serial Peripheral Interface Pulse-width modulation Finite-state machine Look-up table D-type flip-flop 2 References For related documents and software, please visit: https://www.dialog-semiconductor.com/configurable-mixed-signal. Download our free GreenPAK Designer software [1] to open the.gp files [2] and view the proposed circuit design. Use the GreenPAK development tools [3] to freeze the design into your own customized IC in a matter of minutes. Dialog Semiconductor provides a complete library of application notes [4] featuring design examples as well as explanations of features and blocks within the Dialog IC. [1] GreenPAK Designer Software, Software Download and User Guide, Dialog Semiconductor [2] AN-CM-225.gp, GreenPAK Design File, Dialog Semiconductor [3] GreenPAK Development Tools, GreenPAK Development Tools Webpage, Dialog Semiconductor [4] GreenPAK Application Notes, GreenPAK Application Notes Webpage, Dialog Semiconductor [5] SLG46620V, Datasheet, Dialog Semiconductor CFR0014 3 of 12 2018 Dialog Semiconductor

3 Introduction This application note describes how to build a smart digital dimmer. A dimmer is a common light switch that is used in houses, hotels and many other buildings. Older versions of dimmer switches were manual, and would typically incorporate a rotary switch (potentiometer) or buttons to control the light level. This application note describes how to build a digital dimmer that has two ways of controlling light intensity; a smart phone and physical buttons. The two modes can work seamlessly together so that the user can increase or decrease luminosity from both a button and smart phone. The project is implemented using a SLG46620V CMIC, HC-06 Bluetooth module, push buttons and LEDs. We are going to use the SLG46620V CMIC as it helps minimize discrete project components. GreenPAK IC s are small and have multiuse components, which allows a designer to decrease components and to add new features. Additionally, the project cost is subsequently reduced. The SLG46620V also contains a SPI connection interface, PWM blocks, FSM and a lot of useful additional blocks in one tiny chip. These components allow a user to build a practical smart dimmer which can be controlled via a Bluetooth device or wall buttons, support extended-time dimming, and the addition of selectable features without using a microcontroller or expensive components. Project features: 1. Two methods of control; mobile app and real buttons. 2. Smooth on-off transition for the light. This is healthier for a consumer s eyes. It also gives a more luxurious feeling, which is appealing to hotels and other service industries. 3. Sleep mode feature. This will be an added value for this application. When the user activates this mode, light brightness decreases gradually in 10 minutes. This helps people who suffer from insomnia. It is also useful for kid s bedrooms and retail shops (closing time). Project Interface The project interface has four push buttons, which are used as GreenPAK inputs: ON\OFF: turn the light ON\OFF (soft-start\stop). UP: increase light level. Down: decrease light level. Sleep Mode: by activating sleep mode, light brightness decreases gradually over a period of 10 minutes. This gives the user time before sleeping and guarantees that the light will not stay ON all night. The system will output a PWM signal, which will be passed to an external LED and sleep mode LED indicator. Figure 1: Dimmer Block Diagram The GreenPAK design is comprised of 4 main blocks. The first is a UART receiver, which receives data from the Bluetooth module, extracts orders, and sends them to a control unit. The second block is a control unit, which receives orders coming from the UART receiver or from the external CFR0014 4 of 12 2018 Dialog Semiconductor

buttons. The control unit decides the required action (Turn ON/OFF, Increase, decrease, enable sleep mode). This unit is implemented using LUTs. The third block supplies the CLK generators. In this project, a FSM counter is used to control the PWM. The FSM's value will change (up, down) according to the orders given by 3 frequencies (high, medium, and low). In this section the three frequencies will be generated and the required CLK passes to FSM according to the required order; In turning on/off operation, high frequency passes to FSM to soft start/stop. During dimming, the medium frequency passes. The low frequency passes in sleep mode to reduce the FSM value more slowly. Then, light brightness decreases slowly too. The fourth block is the PWM unit, which generates pulses to external LEDs. 4 GreenPAK Design The best way to build a dimmer using GreenPAK is by using the 8-bit FSM and a PWM. In the SLG46620, FSM1 contains 8 bits and can be used with PWM1 and PWM2. The Bluetooth module must be connected, which means the SPI parallel output must be used. The SPI parallel output bits 0 through 7 connections are muxed with DCMP1, DMCP2, and LF OSC CLK, OUT1, OUT0 OSC outputs. PWM0 obtains its output from FSM0 (16 bits). FSM0 does not stop at 255; it increases up to 16383. To limit the counter value at 8 bits another FSM is added; FSM1 is used as a pointer to know when the counter reaches 0 or 255. FSM0 was used to generate the PWM pulse. As the two FSM's values must be changed at the same time to have the same value, the design becomes a bit complex where in both FSMs have a predefined, limited, selectable CLK. CNT1 and CNT3 are used as mediators to pass the CLK to both FSMs. The design consists of the following sections. 4.1 UART receiver First, we need to set up the HC06 Bluetooth module. The HC06 uses the UART protocol for communication. UART stands for Universal Asynchronous Receiver / Transmitter. UART can convert data back and forth between parallel and serial formats. It includes a serial to parallel receiver and a parallel to serial converter which are both clocked separately. The data received in the HC06 will be transmitted to our GreenPAK device. The idle state for Pin 10 is HIGH. Every character sent begins with a logic LOW start bit, followed by a configurable number of data bits, and one or more logic HIGH stop bits. The HC06 sends 1 START bit, 8 data bits, and one STOP bit. Its default baud rate is 9600. We will send the data byte from the HC06 to the GreenPAK SLG46620V s SPI block. Since the Silego SPI block does not have START or STOP bit control, those bits are instead used to enable and disable the SPI clock signal (SCLK). When Pin 10 goes LOW, the IC has received a START bit, so we use the PDLY falling edge detector to identify the start of communication. That falling edge detector clocks DFF0, which enables the SCLK signal to clock the SPI block. Our baud rate is 9600 bits per second, so our SCLK period needs to be 1/9600 = 104 µs. Therefore, we set the OSC frequency to 2 MHz and used CNT0 as a frequency divider. 2 MHz-1 = 0.5 µs (104 µs / 0.5 µs) - 1 = 207 Therefore, we want the CNT0 counter value to be 207. To ensure that data is not missed, a half clock cycle delay on the SPI clock is added so that the SPI block is being clocked at the proper time. This is accomplished by using CNT6, 2-bit LUT1, and the OSC block s External Clock. The output of CNT6 does not go high until 52 µs after DFF0 is clocked, which is exactly half of our SCLK period of 104 µs. When it goes high, the 2-bit LUT1 AND gate allows the 2 MHz OSC signal to pass into the EXT. CLK0 input, whose output is connected to CNT0. CFR0014 5 of 12 2018 Dialog Semiconductor

4.2 Control unit Figure 2: UART Receiver In this section, commands will be executed according to the received byte from the UART receiver, or according to the signals from the external buttons. Pins 12, 13, 14, 15 are initialized as inputs and are connected to external buttons. Each pin is internally connected to an OR gate input, while the second input of the gate is connected with the corresponding signal that coming from the smart phone via Bluetooth which is going to appear on SPI Parallel output. DFF6 is used to activate sleep mode where its output changes to high with the rising edge coming from 2-bit LUT4, while DFF10 is used to maintain the lighting status, and its output changes from low to high and vice versa with every rising edge coming from 3-bit LUT10 output. FSM1 is an 8-bit counter; it gives a high pulse on its output when its value reaches to 0 or 255. Consequently, it s used to prevent FSM0 (16-bit) from exceeding the value 255, as its output resets DFFs and it changes DFF10 status from on to off and vice versa if lighting is controlled by the buttons +, - and the maximum/minimum level has been reached. The signals connected to FSM1 inputs keep, up will reach FSM0 through P11 and P12 to synchronize and keep the same value on both counters. CFR0014 6 of 12 2018 Dialog Semiconductor

4.3 CLK Generators and multiplexer Figure 3: Control Unit Design In this section, three frequencies will be generated, but only one will clock the FSMs at any one time. The first frequency is RC OSC, which is fetched from the matrix 0 through P0. The second frequency is LF OSC which is also fetched from the matrix 0 through P1; the third frequency is the CNT7 output. 3-bit LUT9 and 3-bit LUT11 allow one frequency to pass, according to the 3-bit LUT14 output. After that, the chosen clock transmits to FSM0 and FSM1 through CNT1 and CNT3. 4.4 PWM Figure 4: Clock Generator Design Finally, FSM0 value transforms to PWM signal to appear through pin 20 which is initialized as an output and it is connected to the external LEDs. Figure 5: PWM Block CFR0014 7 of 12 2018 Dialog Semiconductor

5 Android app The Android app has a virtual control interface similar to the real interface. It has five buttons; ON\OFF, UP, DOWN, Sleep mode, and Connect. This Android Application will be able to convert button presses into a command, and will send the commands to the Bluetooth module to be carried out. This app was made with MIT App Inventor, which doesn t require any programming experience. The App Inventor lets the developer create an application for Android OS devices using a web browser by connecting programming blocks. You can import our App into the MIT App Inventor by clicking on Projects -> Import project (.aia) from my computer, and selecting the.aia file included with this App Note. To create the Android Application a new project must be started. Five buttons are required: one is a list picker for Bluetooth devices, and the others are the control buttons. We need to add a Bluetooth client as well. Figure 6Помилка! Джерело посилання не знайдено. is a screen capture of our Android Application s user interface. After we add the buttons, we are going to assign software function for each button. We are going to use 4 bits to represent the status of the buttons. One bit for each button, therefore, when you press the button, a specific number will be sent via Bluetooth to the physical circuit. Figure 6: Programming blocks of buttons These numbers are shown in Table 1: Table 1: Command-Bit Representation Action 8-Bit Represent In Decimal + 10000000 1-01000000 2 Turn ON/OFF 00100000 4 Sleep mode 00010000 8 Button released 00000000 0 CFR0014 8 of 12 2018 Dialog Semiconductor

Figure 7: Programming blocks of buttons Figure 8: Circuit Schematic CFR0014 9 of 12 2018 Dialog Semiconductor

Figure 9: Prototype Interface 6 Conclusion This app note describes a smart dimmer that can be controlled in two ways; an Android app and real buttons. Four separate blocks are outlined within the GreenPAK SLG46620V which control the process flow for increasing or decreasing the PWM of a light. Additionally, a Sleep-mode feature is outlined as an example of extra modulation available for the application. The example shown is low voltage, but can be modified for higher voltage implementations. CFR0014 10 of 12 2018 Dialog Semiconductor

Revision History Revision Date Description 1.0 28-Feb-2018 Initial version. CFR0014 11 of 12 2018 Dialog Semiconductor

Status Definitions Status DRAFT APPROVED or unmarked Definition The content of this document is under review and subject to formal approval, which may result in modifications or additions. The content of this document has been approved for publication. Disclaimer Information in this document is believed to be accurate and reliable. However, Dialog Semiconductor does not give any representations or warranties, expressed or implied, as to the accuracy or completeness of such information. Dialog Semiconductor furthermore takes no responsibility whatsoever for the content in this document if provided by any information source outside of Dialog Semiconductor. Dialog Semiconductor reserves the right to change without notice the information published in this document, including without limitation the specification and the design of the related semiconductor products, software and applications. Applications, software, and semiconductor products described in this document are for illustrative purposes only. Dialog Semiconductor makes no representation or warranty that such applications, software and semiconductor products will be suitable for the specified use without further testing or modification. Unless otherwise agreed in writing, such testing or modification is the sole responsibility of the customer and Dialog Semiconductor excludes all liability in this respect. Customer notes that nothing in this document may be construed as a license for customer to use the Dialog Semiconductor products, software and applications referred to in this document. Such license must be separately sought by customer with Dialog Semiconductor. All use of Dialog Semiconductor products, software and applications referred to in this document are subject to Dialog Semiconductor s Standard Terms and Conditions of Sale, available on the company website (www.dialog-semiconductor.com) unless otherwise stated. Dialog and the Dialog logo are trademarks of Dialog Semiconductor plc or its subsidiaries. All other product or service names are the property of their respective owners. 2018 Dialog Semiconductor. All rights reserved. Contacting Dialog Semiconductor United Kingdom (Headquarters) Dialog Semiconductor (UK) LTD Phone: +44 1793 757700 Germany Dialog Semiconductor GmbH Phone: +49 7021 805-0 The Netherlands Dialog Semiconductor B.V. Phone: +31 73 640 8822 Email: enquiry@diasemi.com North America Dialog Semiconductor Inc. Phone: +1 408 845 8500 Japan Dialog Semiconductor K. K. Phone: +81 3 5769 5100 Taiwan Dialog Semiconductor Taiwan Phone: +886 281 786 222 Web site: www.dialog-semiconductor.com Hong Kong Dialog Semiconductor Hong Kong Phone: +852 2607 4271 Korea Dialog Semiconductor Korea Phone: +82 2 3469 8200 China (Shenzhen) Dialog Semiconductor China Phone: +86 755 2981 3669 China (Shanghai) Dialog Semiconductor China Phone: +86 21 5424 9058 CFR0014 12 of 12 2018 Dialog Semiconductor