Principle and design of intelligent lighting controller based on LPC2104

Publisher:楼高峰Latest update time:2012-08-20 Source: 国外电子元器件 Keywords:LPC2104 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

With the improvement of people's quality of life, lamps are no longer just basic indoor lighting tools, but also a kind of practical art for architectural decoration. When there are various kinds of lamps at home, it is necessary to carefully match them together to achieve the most suitable atmosphere effect for high-quality life. At present, the control of lights is mainly manual, controlling all lamps one by one, which is not only troublesome but also inefficient, and does not meet the standards of modern comfortable life.

Therefore, designing an intelligent lighting system that can conveniently control lighting and provide functions such as scene combination not only has practical value, but also has broad market prospects.

2 Design Goals

Design an intelligent light controller and install it in each room of the house, providing rich functions such as wireless remote control, light touch light control, scene combination, preset storage, etc. Use a handheld remote control to control all lights in the house; use the scene setting button on the remote control to conveniently set the light scene and quickly switch. You can control the switch and brightness of the light by touching the button on the panel, or multiple lights enter a certain preset scene. Each light controller communicates with the home Ethernet network terminal through the RS485 bus to realize remote control and query of light brightness.

Inquiry.

The intelligent lighting control system is divided into two parts: receiving external control signals and executing control operations. In order to receive control signals, the system needs to have wireless receiving function and key input panel. In order to control the lamps, a 220V dimming control circuit needs to be designed.

LPC2104 has rich peripheral interface resources, high reliability and computing speed, and is very suitable for the design of this system. The principle of the intelligent lighting controller is shown in Figure 1.
Intelligent lighting controller principle


3 LPC2104 Functional Overview

LPC2104 is a cost-effective microcontroller solution provided by PHILIPS for embedded applications. It adopts ARM's 16-bit/32-bit RISC structure, the core is ARM7TDMI-S, the CPU operating frequency can reach 60MHz, and the on-chip integration includes: 128KB Flash program memory with ISP and IAP functions, 16KB static RAM, 2 UARTs, 1 I2C serial interface, 1 SPI serial interface, up to 6-way PWM output, 2 timers, each with 4 capture/compare channels, real-time clock and watchdog timer, etc. It can achieve seamless connection with commonly used peripheral devices and has powerful functions. This article takes LPC2104 as the core to design an intelligent lighting controller with simple structure and stable performance.

4 Wireless Data Transmission Module Design

4.1 Introduction to nRF401

There are three solutions for wireless communication: Bluetooth communication, infrared wireless remote control, and short-range wireless data transmission devices. For the Bluetooth solution, the transmission distance and device cost are issues worth considering. Bluetooth is mainly used for short-range transmission (up to 10m), and the cost has always been high. Although infrared transmission does not need to consider the cost issue, from the perspective of the power consumption that handheld devices can provide, the transmission distance is too short, only a few meters, and there are certain requirements for the infrared emission angle. There are fatal defects such as "it must be ensured that the two devices transmitting information are facing each other, and there must be no obstacles in the middle". Compared with the first two solutions, the short-range and low-power wireless RF device nRF401 is the best choice.

The nRF401 wireless communication transceiver integrates functions such as high-frequency transmission/reception, PLL synthesis, FSK modulation/demodulation and multi-channel switching. It has outstanding technical advantages in low-cost digital communication applications. Its main technical features are: (1) It works on two internationally used channels: 433.92MHz and 434.32MHz, and can be used without channel application; (2) It adopts DSS+PLL frequency synthesis technology, and the external components are only one crystal oscillator and several resistors, capacitors and inductors. It can basically work without debugging and has good stability; (3) Digital communication adopts FSK modulation with high anti-interference ability, supports direct data input and output operations, and can be directly connected to the UART serial port of the MPU; (4) There are 2 selectable working channels, using half-duplex working mode, and the maximum data transmission rate can reach 20bk/s; (5) The operating voltage is 2.7V-5V, and the power consumption in standby state is only 8μA, which can meet the requirements of low-power devices.

The nRF401 device does not require initialization and configuration, does not require Manchester encoding of data, and can use cheap PCB antennas. It does not require complex RF circuit design and debugging, making product development and application more convenient.

4.2 Connection between nRF401 and LPC2104

There are many options for connecting nRF401 and LPC2104, such as GPIO, I2C, UART, etc. From the perspective of hardware connection and communication protocol simplification, it is the best solution to connect the serial port to the wireless module. TXD1 and RXD1 of UART1 are connected to DIN and DOUT of nRF401 respectively. The interface circuit of nRF401 and LPC2104 is shown in Figure 2.

nRF401 and LPC2104 interface circuit

As shown in Figure 2, the control interface of the embedded CPU to the wireless module is mainly composed of 5 signal lines, namely DIN, DOUT, TXEN, PWR_UP, and CS. Among them, TXEN is the transmission enable terminal, which realizes the switching of the transmission state and the reception state by setting and resetting TXEN, and is controlled through the GPIO port. PWR_UP is the energy-saving control terminal, which is programmed using a GPIO port of LPC2104 to realize the switching of the working mode and the sleep state of the wireless module; CS can be used for channel selection. Through GPIO settings, the UART1 serial port of LPC2104 can be used to control the DIN and DOUT signals.

In order to save energy, nRF401 should be turned off in most cases. The wireless hardware does not have an automatic wake-up function, and a reasonable communication protocol must be adopted through software to ensure energy saving without data loss.

5. Dimming control circuit design

The thyristor is controlled by the method of current injection through the microcontroller I/O port to realize switching and dimming control. The optocoupler MOC3041 with an internal zero-crossing detection circuit is used as the driver of the thyristor, which can also realize the isolation of strong and weak currents.

Traditional dimming methods use phase-shifted triggering of thyristors to control the output power by controlling the conduction angle of the thyristors.

Only the synchronous detection circuit is complex, and high-order harmonic interference will be generated at the moment the thyristor is turned on, causing distortion of the grid voltage waveform and affecting the normal operation of other electrical equipment and communication systems. In this system, the ratio of the turn-on and turn-off time of the zero-crossing triggered thyristor is used to adjust the power of the lamp. Since the zero-crossing trigger does not change the waveform of the voltage but only changes the number of times the voltage passes through the full wave, it will not cause pollution to the grid. Therefore, this system adopts the zero-crossing trigger method.

MOC3041 contains a zero-crossing detection circuit. When a 15mA current is input to input pin 1 and the voltage between output pins 6 and 4 slightly passes zero, the internal bidirectional thyristor is turned on, triggering the external thyristor to turn on. When the input current of the MOC3041 input pin is 0, the internal bidirectional thyristor is turned off, and the external thyristor is also turned off. The dimming control circuit is shown in Figure 3.

Dimming control circuit [page]

6 Wireless module software design

The wireless module is connected to the system through the UART serial port, so the UART must be initialized. The UART serial port of LPC2104 complies with the RS232 standard and also supports the 550 industrial standard.

LPC2104 has two universal asynchronous serial interfaces (UARTs). The UARTs are disabled by default at startup and must be enabled by programming the GPIO registers.

This system uses UART1 to connect to nRF401. UART1 has a modem interface, 16-byte receive and transmit FIFOs, a built-in baud rate generator, and standard modem interface signals.

When using UART1, you must first set the connection method of the TXD1 and RXD1 pins, and then set the baud rate and working mode of the serial port to send and receive data. This system uses an 11.0592MHz crystal oscillator, does not apply PLL, and VPB is divided by 4. Set the UART1 baud rate to 9600bit/s, then the divisor value N=18, that is, 12H. The initialization procedure of UART1 is as follows:


In the operating system environment, the serial port will be automatically initialized when the system starts, so it will become easier for the application to call serial port resources. It is worth noting that applications are often multi-arbitrary systems. In order to monitor serial port messages in real time, a serial port scanning task is generally opened in the operating environment to ensure that information is not lost. The serial port register initialization code is added to the main function of an existing project file, and a serial port scanning task is added. Due to the control of the wireless module and the system's GPIO, the scanning program must also include I/O operations. When the system receives serial port information, it will actively send a serial port information to the main task. The main task will call the response function after receiving the information to respond to the message.

7 Conclusion

The wireless communication module nRF401 integrates transmission and reception, which greatly simplifies the complexity of the lighting controller design. The intelligent lighting controller can be easily networked through the RS485 interface, providing convenience for the realization of smart home networking.

Keywords:LPC2104 Reference address:Principle and design of intelligent lighting controller based on LPC2104

Previous article:Design of USB-CAN converter based on LPC2119
Next article:LPC2148 micro urine analyzer design

Recommended ReadingLatest update time:2024-11-16 19:27

How to count the number of interrupt sources in the interrupt controller of s3c2410
All interrupt sources can be seen through the INTERRUPT SOURCES in the data sheet, where they are described in the Descriptions column, and those with multiple interrupt sources are expressed in brackets. The following interrupt source registers are connected to INTPND through their respective MASTs (only one position
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号